aboutsummaryrefslogtreecommitdiff
path: root/dot-config/yambar
diff options
context:
space:
mode:
Diffstat (limited to 'dot-config/yambar')
-rw-r--r--dot-config/yambar/config.yml19
-rwxr-xr-xdot-config/yambar/scripts/pacman-label7
-rwxr-xr-xdot-config/yambar/scripts/pacman-notify18
3 files changed, 44 insertions, 0 deletions
diff --git a/dot-config/yambar/config.yml b/dot-config/yambar/config.yml
index 9c9cdaf..e7bdb3a 100644
--- a/dot-config/yambar/config.yml
+++ b/dot-config/yambar/config.yml
@@ -36,6 +36,8 @@ define:
- &volume-down volume down 1%
- &brightness-up brightnessctl set +1%
- &brightness-down brightnessctl --min-value=10 set 1-%
+ - &pacman-notify ~/.config/yambar/scripts/pacman-notify
+ - &pacman-update footclient -T update sudo pacman -Syyu && >~/.cache/updates
# MODULES
battery: &battery
@@ -204,6 +206,22 @@ backlight: &backlight
wheel-up: *brightness-up
wheel-down: *brightness-down
+pacman: &pacman
+ path: ~/.config/yambar/scripts/pacman-label
+ args: []
+ content:
+ string:
+ text: "{count} "
+ foreground: *red
+ margin: *margin
+ deco:
+ stack:
+ - {underline: {size: *line, color: *red}}
+ - {background: {color: *bg}}
+ on-click:
+ left: *pacman-notify
+ right: *pacman-update
+
# LAYOUT
bar:
location: top
@@ -218,6 +236,7 @@ bar:
- i3: *workspace
right:
+ - script: *pacman
- network: *network
- backlight: *backlight
- battery: *battery
diff --git a/dot-config/yambar/scripts/pacman-label b/dot-config/yambar/scripts/pacman-label
new file mode 100755
index 0000000..7015e5b
--- /dev/null
+++ b/dot-config/yambar/scripts/pacman-label
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+# Get package count
+count=$(wc -l < ~/.cache/updates)
+
+# Display count
+printf "%s\n\n" "count|int|$count"
diff --git a/dot-config/yambar/scripts/pacman-notify b/dot-config/yambar/scripts/pacman-notify
new file mode 100755
index 0000000..a9ce535
--- /dev/null
+++ b/dot-config/yambar/scripts/pacman-notify
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+# Get package count
+count=$(wc -l < ~/.cache/updates)
+
+# Generate message
+if [ "$count" = 0 ]; then
+ msg="No updates available"
+else
+ msg="$count Available Update"
+ (("$count" > 1 )) && msg+="s"
+fi
+
+# Notify
+notify-send \
+ -i package-x-generic \
+ -h string:x-canonical-private-synchronous:updates \
+ "$msg" "$(cut -f1 -d' ' ~/.cache/updates)"