vitorpy's Dotfiles

Add reboot-required indicator to waybar

Shows icon on left side when kernel update requires reboot.
Detects when running kernel's modules are missing (kernel updated
but system not rebooted).

Only shows icon when reboot is needed, otherwise hidden.

+23 -1
+7 -1
private_dot_config/waybar/config
··· 3 3 "spacing": 0, 4 4 "modules-left": [ 5 5 "battery#charging", 6 - "custom/dnf-updates" 6 + "custom/dnf-updates", 7 + "custom/reboot-required" 7 8 ], 8 9 "modules-center": [ 9 10 "custom/clock" ··· 107 108 "on-click": "/usr/bin/makoctl dismiss -a", 108 109 "on-click-right": "/usr/bin/makoctl reload", 109 110 "signal": 0 111 + }, 112 + "custom/reboot-required": { 113 + "exec": "~/.config/waybar/scripts/reboot-required.sh", 114 + "interval": 300, 115 + "return-type": "json" 110 116 } 111 117 }
+16
private_dot_config/waybar/scripts/executable_reboot-required.sh
··· 1 + #!/bin/bash 2 + 3 + # Check if system reboot is required 4 + # Detects kernel version mismatch (running vs installed) 5 + 6 + running_kernel=$(uname -r) 7 + 8 + # Check if the running kernel's modules directory exists 9 + if [ ! -d "/lib/modules/$running_kernel" ]; then 10 + # Running kernel modules missing - reboot required 11 + installed_kernels=$(ls -1 /lib/modules/ | sort -V | tail -1) 12 + echo "{\"text\":\"\", \"tooltip\":\"Reboot required: kernel $running_kernel → $installed_kernels\", \"class\":\"reboot-required\"}" 13 + else 14 + # System OK, no reboot needed - show nothing 15 + echo "" 16 + fi