moonarch/defaults/bin/moonarch-waybar-cpugov
nevaforget 5d2ce00455 Initial commit: Moonarch reproduzierbares Arch-Linux-Setup
Niri-basierter Wayland-Desktop mit greetd/regreet, Catppuccin Mocha
Theming, Rofi-Menus, Waybar und vollstaendiger Post-Install-Automatisierung.

Archinstall-Config klont das Repo automatisch via custom-commands,
danach genuegt ein einzelner Befehl fuer die komplette Einrichtung.
2026-03-23 17:42:26 +01:00

49 lines
982 B
Bash
Executable File

#!/usr/bin/bash
# ABOUTME: Waybar-Modul das den CPU-Governor als JSON ausgibt.
# ABOUTME: Wird von der Waybar custom/cpugov Config referenziert.
while :
do
CPU_GOV=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor)
case $CPU_GOV in
performance)
CPU_GOV_SHORT=󰓅
;;
balanced)
CPU_GOV_SHORT=󰾅
;;
powersave)
CPU_GOV_SHORT=󰌪
;;
userspace)
CPU_GOV_SHORT=uspace
;;
ondemand)
CPU_GOV_SHORT=ondmnd
;;
conservative)
CPU_GOV_SHORT=cons
;;
schedutil)
CPU_GOV_SHORT=sutil
;;
*)
CPU_GOV_SHORT="?"
;;
esac
CPU_GOV_FULL="${CPU_GOV^}"
s="text|alt|tooltip|class
$CPU_GOV_SHORT|$CPU_GOV_FULL|CPU Mode: $CPU_GOV_FULL|cpugov"
jq --unbuffered --compact-output -Rn '
( input | split("|") ) as $keys |
( inputs | split("|") ) as $vals |
[[$keys, $vals] | transpose[] | {key:.[0],value:.[1]}] | from_entries
' <<<"$s"
sleep 5
done