summaryrefslogtreecommitdiff
path: root/polybar/scripts/updates-status.sh
diff options
context:
space:
mode:
Diffstat (limited to 'polybar/scripts/updates-status.sh')
-rwxr-xr-xpolybar/scripts/updates-status.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/polybar/scripts/updates-status.sh b/polybar/scripts/updates-status.sh
new file mode 100755
index 0000000..75568ad
--- /dev/null
+++ b/polybar/scripts/updates-status.sh
@@ -0,0 +1,17 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+if command -v checkupdates >/dev/null 2>&1; then
+ count="$( (checkupdates 2>/dev/null || true) | wc -l)"
+elif command -v pacman >/dev/null 2>&1; then
+ count="$( (pacman -Qu 2>/dev/null || true) | wc -l)"
+else
+ echo "n/a"
+ exit 0
+fi
+
+if [ "$count" -gt 0 ]; then
+ echo "%{F#d79921}$count%{F-}"
+else
+ echo "0"
+fi