summaryrefslogtreecommitdiffstats
path: root/eww/scripts/system
diff options
context:
space:
mode:
Diffstat (limited to 'eww/scripts/system')
-rwxr-xr-xeww/scripts/system44
1 files changed, 44 insertions, 0 deletions
diff --git a/eww/scripts/system b/eww/scripts/system
new file mode 100755
index 0000000..d1cba41
--- /dev/null
+++ b/eww/scripts/system
@@ -0,0 +1,44 @@
+#!/bin/sh
+
+pkgCount() {
+ xbps-query -l | wc -l
+}
+
+pkgUpdates() {
+ updates=$(xbps-install -S -un | cut -d' ' -f2 | sort | uniq -c | xargs)
+
+ if [ -z "$updates" ]; then
+ echo "Fully Updated"
+ else
+ echo " $updates""s"
+ fi
+}
+
+battery() {
+ cat /sys/class/power_supply/BAT1/capacity
+}
+
+cpu() {
+ grep -o "^[^ ]*" /proc/loadavg
+}
+
+disk() {
+ df -hl | awk '/^\/dev\/sd[ab]/ { sum+=$5 } END { print sum }'
+}
+
+ram() {
+ printf "%.0f\n" $(free -m | grep Mem | awk '{print ($3/$2)*100}')
+}
+
+backlight() {
+ printf "%.0f\n" $(xbacklight -get)
+}
+
+wifi() {
+ case "$(cat /sys/class/net/wl*/operstate 2>/dev/null)" in
+ up) printf "󰤨" ;;
+ down) printf "󰤭" ;;
+ esac
+}
+
+"$@"