From 5af75cdeebd61dd37849b602681e47c345cd7535 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Violet=20Truchse=C3=9F?= Date: Sat, 26 Oct 2024 15:13:49 +0200 Subject: [PATCH] waybar reboot indicator --- waybar/.config/waybar/config | 7 ++++++- waybar/.config/waybar/reboot_indicator.sh | 17 +++++++++++++++++ waybar/.config/waybar/style.css | 1 + 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100755 waybar/.config/waybar/reboot_indicator.sh diff --git a/waybar/.config/waybar/config b/waybar/.config/waybar/config index 0c7b218..f76594b 100644 --- a/waybar/.config/waybar/config +++ b/waybar/.config/waybar/config @@ -8,7 +8,7 @@ // Choose the order of the modules "modules-left": ["sway/workspaces", "sway/window", "sway/mode"], "modules-center": [ ], - "modules-right": ["idle_inhibitor", "pulseaudio", "custom/backup", "battery", "network", "clock", "tray"], + "modules-right": ["idle_inhibitor", "custom/reboot", "pulseaudio", "custom/backup", "battery", "network", "clock", "tray"], // Modules configuration // "sway/workspaces": { // "disable-scroll": true, @@ -168,6 +168,11 @@ "format": "{} d", "exec": "$HOME/.borg/bakage.sh", "interval": 30 + }, + "custom/reboot": { + "exec": "$HOME/.config/waybar/reboot_indicator.sh", + "format": "{}", + "interval": 30 } } // vim: ft=json diff --git a/waybar/.config/waybar/reboot_indicator.sh b/waybar/.config/waybar/reboot_indicator.sh new file mode 100755 index 0000000..e407969 --- /dev/null +++ b/waybar/.config/waybar/reboot_indicator.sh @@ -0,0 +1,17 @@ +#!/bin/bash + + +RUNNING_VERSION="$(uname -r | grep -o '[0-9]*\.[0-9]*\.[0-9]*-[0-9]*')" +INSTALLED_VERSION="$(find /boot -name 'vmlinuz*' | grep -o '[0-9]*\.[0-9]*\.[0-9]*-[0-9]*' | sort -r | head -1)" + +#echo $RUNNING_VERSION +#echo $INSTALLED_VERSION + +if [[ "$RUNNING_VERSION" == "$INSTALLED_VERSION" ]] +then + echo "OK" + exit 1 +else + echo "reboot required" + exit 0 +fi diff --git a/waybar/.config/waybar/style.css b/waybar/.config/waybar/style.css index ad00f0f..f2755e9 100644 --- a/waybar/.config/waybar/style.css +++ b/waybar/.config/waybar/style.css @@ -88,6 +88,7 @@ button:hover { #idle_inhibitor, #scratchpad, #custom-backup, +#custom-reboot, #mpd { padding: 0 10px; color: #333333;