#!/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"