moonarch/defaults/bin/moonarch-cpugov
nevaforget c3213cc0ce Rofi/Waybar aufräumen: tote Scripts entfernen, Themes konsolidieren
- GTK-Style-Script und Template-System entfernt (Catppuccin fest)
- 15 tote/inkompatible Scripts gelöscht (Hyprland, X11, Duplikate)
- Rasi-Themes von Einzelordnern in themes/ konsolidiert
- Waybar: Timezone fix, BAT0, JSON-Struktur, Icons restored
- Waybar: GTK-Menu durch wlogout on-click ersetzt
- Alle Script-Pfade auf /etc/xdg/rofi/themes/ aktualisiert
- moonarch-session als Rofi-basierte Übergangslösung hinzugefügt
- moonarch-dnd: broken pipe bei Waybar-Restart behoben
- Style.css vom System übernommen
2026-03-27 13:19:48 +01:00

73 lines
1.6 KiB
Bash
Executable File

#!/usr/bin/env bash
# ABOUTME: Rofi-based CPU governor switcher using auto-cpufreq.
# ABOUTME: Allows switching between performance, powersave, and reset modes.
declare -A LABELS
declare -A COMMANDS
###
# List of defined 'bangs'
COMMANDS["󰓅"]="pkexec auto-cpufreq --force=performance"
LABELS["󰓅"]="Performance"
COMMANDS["󰌪"]='pkexec auto-cpufreq --force=powersave'
LABELS["󰌪"]="Powersave"
COMMANDS[""]='pkexec auto-cpufreq --force=reset'
LABELS[""]="Reset"
################################################################################
# do not edit below
################################################################################
##
# Generate menu
##
function print_menu()
{
for key in ${!LABELS[@]}
do
# echo "$key ${LABELS}"
echo "$key ${LABELS[$key]}"
# my top version just shows the first field in labels row, not two words side by side
done
}
##
# Show rofi.
##
function start()
{
# print_menu | rofi -dmenu -p "?=>"
print_menu | sort | rofi -theme /etc/xdg/rofi/themes/cpugov.rasi -show "CPU Modes" -dmenu -mesg "󰓅 CPU Modes" -i -p "rofi-bangs: "
}
# Run it
value="$(start)"
# Split input.
# grab upto first space.
choice=${value%%\ *}
# graph remainder, minus space.
input=${value:$((${#choice}+1))}
##
# Cancelled? bail out
##
if test -z ${choice}
then
exit
fi
# check if choice exists
if test ${COMMANDS[$choice]+isset}
then
# Execute the choice
${COMMANDS[$choice]}
dunstify --replace 553 -i "/usr/share/icons/zafiro-dark/devices/48/cpu.svg" "CPU Mode" "Set to $choice ${LABELS[$choice]}"
else
echo "Unknown command: ${choice}" | rofi -dmenu -p "error"
fi