- Point dunst to /etc/xdg/dunst/dunstrc via -conf flag (dunst with SYSCONFDIR=/etc does not search XDG_CONFIG_DIRS) - Update dunstrc: fix legacy offset syntax, replace missing Tela-purple-dark icon theme with Colloid-Grey-Catppuccin-Dark - Replace dunstify with notify-send in moonarch-cpugov for daemon-agnostic notifications, fix broken icon path - Replace dbus-monitor based moonarch-dnd script with inline waybar polling (interval 2s), fixing process accumulation bug - Add #custom-dnd to waybar CSS padding rule
71 lines
1.6 KiB
Bash
Executable File
71 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%%\ *}
|
|
|
|
##
|
|
# 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]}
|
|
|
|
notify-send -h string:x-canonical-private-synchronous:cpugov -i cpu "CPU Mode" "Set to $choice ${LABELS[$choice]}"
|
|
else
|
|
echo "Unknown command: ${choice}" | rofi -dmenu -p "error"
|
|
fi
|