summaryrefslogtreecommitdiff
path: root/.scripts/checkupdates
diff options
context:
space:
mode:
author0scar <qgt268@alumni.ku.dk>2020-10-21 15:51:56 +0000
committer0scar <qgt268@alumni.ku.dk>2020-10-22 13:27:30 +0000
commitc4be0fe3c58fe07e235f624974b4f8102a17ecca (patch)
tree83a7576319658278b73f579313f0a4f990e48f00 /.scripts/checkupdates
parent47bb601a722b294ac07c3f34b25ade8b1a06ecc3 (diff)
Add some neat scripts
Diffstat (limited to '.scripts/checkupdates')
-rwxr-xr-x.scripts/checkupdates15
1 files changed, 15 insertions, 0 deletions
diff --git a/.scripts/checkupdates b/.scripts/checkupdates
new file mode 100755
index 0000000..380afd3
--- /dev/null
+++ b/.scripts/checkupdates
@@ -0,0 +1,15 @@
+#!/usr/bin/env bash
+set -e
+
+updates=$(pacman -Qu | sed '/\[ignored\]$/d')
+
+case $BLOCK_BUTTON in
+ 1) ;& # fallthrough
+ 3) if [ -n "${updates}" ]; then
+ notify-send "Available updates" "$updates"
+ else
+ notify-send "Available updates" "No available updates"
+ fi;;
+esac
+
+[ -n "$updates" ] && echo $(echo "${updates}" | wc -l) || exit 0