summaryrefslogtreecommitdiff
path: root/.local/bin/statusbar/checkupdates
diff options
context:
space:
mode:
author0scar <qgt268@alumni.ku.dk>2021-06-03 21:33:31 +0000
committer0scar <qgt268@alumni.ku.dk>2021-06-03 21:33:31 +0000
commit6e4a15d79352ca2707a3b0d81d158228a7d14704 (patch)
treea526da4169c76175f1e528534d67772bc13dfabb /.local/bin/statusbar/checkupdates
parenta38dc1a774d012b2da71716365d1d254b650dd48 (diff)
Add/move statusbar scripts
Diffstat (limited to '.local/bin/statusbar/checkupdates')
-rwxr-xr-x.local/bin/statusbar/checkupdates15
1 files changed, 15 insertions, 0 deletions
diff --git a/.local/bin/statusbar/checkupdates b/.local/bin/statusbar/checkupdates
new file mode 100755
index 0000000..5a95974
--- /dev/null
+++ b/.local/bin/statusbar/checkupdates
@@ -0,0 +1,15 @@
+#!/usr/bin/env sh
+set -e
+
+updates=$(pacman -Qu | sed '/\[ignored\]$/d')
+
+case $BLOCK_BUTTON in
+ 1) ;& # fallthrough
+ 3) if [ -n "${updates}" ]; then
+ notify-send -t $((1000 * 20)) "Available updates" "$updates"
+ else
+ notify-send "Available updates" "No available updates"
+ fi;;
+esac
+
+[ -n "$updates" ] && echo $(echo "${updates}" | wc -l) || exit 0