scripts/waybar/waybar-idle.sh

31 lines
612 B
Bash
Raw Normal View History

#!/bin/bash
FILE="$HOME/.local/state/idle_mode"
if [[ -e $FILE ]]; then
MODE=$(cat $FILE)
else
MODE="fade"
fi
if [[ $MODE == "none" ]]; then
ICON=""
elif [[ $MODE == "fade" ]]; then
ICON=""
elif [[ $MODE == "dim" ]]; then
ICON=""
elif [[ $MODE == "lock" ]]; then
ICON=""
elif [[ $MODE == "sleep" ]]; then
ICON=" "
elif [[ $MODE == "hibernate" ]]; then
ICON=" "
fi
MSG="Change sleep mode ($MODE)"
if [[ -z $ICON ]]; then
ICON="🯄 "
MSG="Error: Invalid mode ($MODE)"
fi
echo '{"text":"'$ICON'","icon":"'$ICON'","tooltip":"'$MSG'","class":"'$MODE'"}'