aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.config/awesome/rc.lua9
-rwxr-xr-x.local/bin/awesome-widgets/widget-RAM3
-rwxr-xr-x.local/bin/awesome-widgets/widget-cpu_usage31
-rwxr-xr-x.local/bin/awesome-widgets/widget-disks13
-rwxr-xr-x.local/bin/awesome-widgets/widget-newsboat5
-rwxr-xr-x.local/bin/awesome-widgets/widget-pacman_updates9
-rwxr-xr-x.local/bin/awesome-widgets/widget-sensors3
-rwxr-xr-x.local/bin/awesome-widgets/widget-weather3
8 files changed, 76 insertions, 0 deletions
diff --git a/.config/awesome/rc.lua b/.config/awesome/rc.lua
index f7c8bbf..f68e964 100644
--- a/.config/awesome/rc.lua
+++ b/.config/awesome/rc.lua
@@ -255,6 +255,15 @@ awful.screen.connect_for_each_screen(function(s)
s.mytasklist, -- Middle widget
{ -- Right widgets
layout = wibox.layout.fixed.horizontal,
+ awful.widget.watch('sh -c "~/.local/bin/awesome-widgets/widget-cpu_usage"', 5),
+ awful.widget.watch('sh -c "~/.local/bin/awesome-widgets/widget-sensors"', 60),
+ awful.widget.watch('sh -c "~/.local/bin/awesome-widgets/widget-RAM"', 30),
+ awful.widget.watch('sh -c "~/.local/bin/awesome-widgets/widget-disks /home"', 300),
+ awful.widget.watch('sh -c "~/.local/bin/awesome-widgets/widget-newsboat"', 600),
+ awful.widget.watch('sh -c "~/.local/bin/awesome-widgets/widget-pacman_updates"', 60),
+ wibox.widget.textbox(" "),
+ awful.widget.watch('sh -c ~/.local/bin/awesome-widgets/widget-weather', 3600),
+ wibox.widget.textbox(" 🌐"),
mykeyboardlayout,
wibox.widget.systray(),
mytextclock,
diff --git a/.local/bin/awesome-widgets/widget-RAM b/.local/bin/awesome-widgets/widget-RAM
new file mode 100755
index 0000000..a6b451c
--- /dev/null
+++ b/.local/bin/awesome-widgets/widget-RAM
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+free --mebi | sed -n '2{p;q}' | awk '{printf (" 🧠 %2.1fGiB/%2.0fGiB\n", ( $3 / 1024), ($2 / 1024))}'
diff --git a/.local/bin/awesome-widgets/widget-cpu_usage b/.local/bin/awesome-widgets/widget-cpu_usage
new file mode 100755
index 0000000..14997fd
--- /dev/null
+++ b/.local/bin/awesome-widgets/widget-cpu_usage
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+# Cache in tmpfs to improve speed and reduce SSD load
+cache=/tmp/cpubarscache
+
+stats=$(awk '/cpu[0-9]+/ {printf "%d %d %d\n", substr($1,4), ($2 + $3 + $4 + $5), $5 }' /proc/stat)
+[ ! -f $cache ] && echo "$stats" > "$cache"
+old=$(cat "$cache")
+printf " 📊 "
+echo "$stats" | while read -r row; do
+ id=${row%% *}
+ rest=${row#* }
+ total=${rest%% *}
+ idle=${rest##* }
+
+ case "$(echo "$old" | awk '{if ($1 == id)
+ printf "%d\n", (1 - (idle - $3) / (total - $2))*100 /12.5}' \
+ id="$id" total="$total" idle="$idle")" in
+
+ "0") printf "▁";;
+ "1") printf "▂";;
+ "2") printf "▃";;
+ "3") printf "▄";;
+ "4") printf "▅";;
+ "5") printf "▆";;
+ "6") printf "▇";;
+ "7") printf "█";;
+ "8") printf "█";;
+ esac
+done; printf "\\n"
+echo "$stats" > "$cache"
diff --git a/.local/bin/awesome-widgets/widget-disks b/.local/bin/awesome-widgets/widget-disks
new file mode 100755
index 0000000..49a5e9c
--- /dev/null
+++ b/.local/bin/awesome-widgets/widget-disks
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+location=${1:-/}
+
+[ -d "$location" ] || exit
+
+case "$location" in
+ "/home"* ) icon="🏠" ;;
+ "/mnt"* ) icon="💾" ;;
+ *) icon="🖥";;
+esac
+
+printf "%s%s" " $icon " "$(df -h "$location" | awk ' /[0-9]/ {print $3 "/" $2 " "} ')"
diff --git a/.local/bin/awesome-widgets/widget-newsboat b/.local/bin/awesome-widgets/widget-newsboat
new file mode 100755
index 0000000..a3eadf7
--- /dev/null
+++ b/.local/bin/awesome-widgets/widget-newsboat
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+newsboat -x reload
+
+cat /tmp/newsupdate 2>/dev/null || echo "$(newsboat -x print-unread | awk '{ if($1>0) print " 📰 " $1 " "}')$(cat "${XDG_CONFIG_HOME:-$HOME/.config}"/newsboat/.update 2>/dev/null)"
diff --git a/.local/bin/awesome-widgets/widget-pacman_updates b/.local/bin/awesome-widgets/widget-pacman_updates
new file mode 100755
index 0000000..dfd21e4
--- /dev/null
+++ b/.local/bin/awesome-widgets/widget-pacman_updates
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+if ! command -v yay >/dev/null 2>&1; then
+ notify-send "awesomewm widget error" "the 'yay' package is required for the widget to work."
+else
+ yay -Sy >/dev/null
+ count=$(yay -Qu | wc -l)
+ echo " 📤 $count"
+fi
diff --git a/.local/bin/awesome-widgets/widget-sensors b/.local/bin/awesome-widgets/widget-sensors
new file mode 100755
index 0000000..248acc0
--- /dev/null
+++ b/.local/bin/awesome-widgets/widget-sensors
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+sensors -f | awk '/Core 0/ {print " 🌡" $3}'
diff --git a/.local/bin/awesome-widgets/widget-weather b/.local/bin/awesome-widgets/widget-weather
new file mode 100755
index 0000000..d48599e
--- /dev/null
+++ b/.local/bin/awesome-widgets/widget-weather
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+curl -s wttr.in/?format=%c%t