#!/bin/bash if [ "$1" = "--menu" ]; then CHOICE=$(printf "󰓅 performance\n󰕲 balanced\n󰌪 power-saver" \ | wofi --dmenu \ --prompt "Power Profile:" \ --width 260 \ --height 160 \ --hide-scroll \ --no-actions \ --insensitive \ | awk '{print $NF}') [ -n "$CHOICE" ] && powerprofilesctl set "$CHOICE" && pkill -RTMIN+8 waybar && pkill -RTMIN+9 waybar exit fi CURRENT=$(powerprofilesctl get) case "$CURRENT" in performance) ICON="󰓅" ;; balanced) ICON="󰕲" ;; power-saver) ICON="󰌪" ;; *) ICON="" ;; esac printf '{"text": "%s %s", "tooltip": "Power profile: %s\\nClick to change", "class": "%s"}\n' \ "$ICON" "$CURRENT" "$CURRENT" "$CURRENT"