Add power profile and fan strategy waybar modules - scripts/power-profile.sh: waybar module + wofi menu for powerprofilesctl - scripts/fan-profile.sh: waybar module + wofi menu for fw-fanctrl - waybar/config.jsonc: add custom/power-profile and custom/fan-profile modules - waybar/style.css: add padding and class colors for new modules - packages.txt: add power-profiles-daemon and fw-fanctrl - install.sh: symlink new scripts to ~/.local/bin
This commit is contained in:
Executable
+33
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ "$1" = "--menu" ]; then
|
||||
CHOICE=$(fw-fanctrl print list 2>/dev/null \
|
||||
| grep "^-" \
|
||||
| sed 's/^- //' \
|
||||
| wofi --dmenu \
|
||||
--prompt "Fan Strategy:" \
|
||||
--width 260 \
|
||||
--height 300 \
|
||||
--hide-scroll \
|
||||
--no-actions \
|
||||
--insensitive)
|
||||
[ -n "$CHOICE" ] && fw-fanctrl use "$CHOICE" && pkill -RTMIN+9 waybar
|
||||
exit
|
||||
fi
|
||||
|
||||
OUTPUT=$(fw-fanctrl print 2>/dev/null)
|
||||
CURRENT=$(echo "$OUTPUT" | awk -F"'" '/^Strategy:/{print $2}')
|
||||
SPEED=$(echo "$OUTPUT" | awk '/^Speed:/{print $2}')
|
||||
|
||||
case "$CURRENT" in
|
||||
laziest|deaf) ICON=""; LEVEL="silent" ;;
|
||||
lazy) ICON=""; LEVEL="quiet" ;;
|
||||
medium) ICON=""; LEVEL="medium" ;;
|
||||
agile) ICON=""; LEVEL="agile" ;;
|
||||
very-agile) ICON=""; LEVEL="fast" ;;
|
||||
aeolus) ICON=""; LEVEL="max" ;;
|
||||
*) ICON=""; LEVEL="$CURRENT" ;;
|
||||
esac
|
||||
|
||||
printf '{"text": "%s %s", "tooltip": "Fan strategy: %s\\nSpeed: %s\\nClick to change", "class": "%s"}\n' \
|
||||
"$ICON" "$CURRENT" "$CURRENT" "$SPEED" "$LEVEL"
|
||||
Executable
+26
@@ -0,0 +1,26 @@
|
||||
#!/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
|
||||
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"
|
||||
Reference in New Issue
Block a user