2023-07-21 02:07:23 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2024-03-08 19:11:04 +00:00
|
|
|
FILE="$HOME/.local/state/idle_mode"
|
2024-08-16 17:09:00 +00:00
|
|
|
if [[ -e $FILE ]]; then
|
|
|
|
MODE=$(cat $FILE)
|
2023-07-21 02:07:23 +00:00
|
|
|
else
|
2024-08-16 17:09:00 +00:00
|
|
|
MODE="fade"
|
2023-07-21 02:07:23 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ $MODE == "none" ]]; then
|
2024-08-18 19:07:53 +00:00
|
|
|
ICON=""
|
2023-07-21 02:07:23 +00:00
|
|
|
elif [[ $MODE == "fade" ]]; then
|
2024-08-18 19:07:53 +00:00
|
|
|
ICON=""
|
2023-07-21 02:07:23 +00:00
|
|
|
elif [[ $MODE == "dim" ]]; then
|
2024-08-18 19:07:53 +00:00
|
|
|
ICON=""
|
2023-07-21 02:07:23 +00:00
|
|
|
elif [[ $MODE == "lock" ]]; then
|
2024-08-18 19:07:53 +00:00
|
|
|
ICON=""
|
2023-07-21 02:07:23 +00:00
|
|
|
elif [[ $MODE == "sleep" ]]; then
|
2024-08-18 19:07:53 +00:00
|
|
|
ICON=" "
|
2023-07-21 02:07:23 +00:00
|
|
|
elif [[ $MODE == "hibernate" ]]; then
|
2024-08-18 19:07:53 +00:00
|
|
|
ICON=" "
|
|
|
|
fi
|
|
|
|
|
|
|
|
MSG="Change sleep mode ($MODE)"
|
|
|
|
if [[ -z $ICON ]]; then
|
|
|
|
ICON="🯄 "
|
|
|
|
MSG="Error: Invalid mode ($MODE)"
|
2023-07-21 02:07:23 +00:00
|
|
|
fi
|
|
|
|
|
2024-08-18 19:07:53 +00:00
|
|
|
echo '{"text":"'$ICON'","icon":"'$ICON'","tooltip":"'$MSG'","class":"'$MODE'"}'
|