Hyprland-dotfiles/hypr/scripts/hypridle.sh

26 lines
723 B
Bash
Raw Normal View History

2024-05-29 14:13:30 -04:00
#!/bin/bash
2024-05-30 08:05:19 -04:00
# _ _ _ _ _
# | | | |_ _ _ __ _ __(_) __| | | ___
# | |_| | | | | '_ \| '__| |/ _` | |/ _ \
# | _ | |_| | |_) | | | | (_| | | __/
# |_| |_|\__, | .__/|_| |_|\__,_|_|\___|
# |___/|_|
#
2024-05-29 14:13:30 -04:00
SERVICE="hypridle"
if [[ "$1" == "status" ]]; then
2024-05-30 08:05:19 -04:00
sleep 1
2024-05-29 14:13:30 -04:00
if pgrep -x "$SERVICE" >/dev/null ;then
2024-05-30 08:05:19 -04:00
echo '{"text": "RUNNING", "class": "active", "tooltip": "Screen locking active"}'
2024-05-29 14:13:30 -04:00
else
2024-05-30 08:05:19 -04:00
echo '{"text": "NOT RUNNING", "class": "notactive", "tooltip": "Screen locking deactivated"}'
fi
fi
if [[ "$1" == "toggle" ]]; then
if pgrep -x "$SERVICE" >/dev/null ;then
killall hypridle
else
2024-05-30 08:26:06 -04:00
hypridle
2024-05-29 14:13:30 -04:00
fi
fi