dotfiles/scripts/youtubeBlocker.sh

24 lines
662 B
Bash
Raw Normal View History

2026-03-13 01:11:46 +05:00
#!/usr/bin/bash
is_valid_youtube_time() {
now=$(date +%H%M)
start=1000
end=1800
(( 10#$now >= start && 10#$now <= end ))
}
handle() {
case $1 in
activewindow*)
echo $1
2026-04-10 21:23:42 +05:00
if [[ $1 == *YouTube* || $1 == *Instagram* ]]; then
2026-03-13 01:11:46 +05:00
hyprctl dispatch killactive
2026-04-10 21:23:42 +05:00
notify-send "ENOUGH, LOCK IN" "GET BACK TO WORK" -u critical -i $HOME/dotfiles/scripts/discipline.png
mpv $HOME/dotfiles/scripts/getbacktowork.mp3
2026-03-13 01:11:46 +05:00
fi
esac
}
socat -U - UNIX-CONNECT:$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock | while read -r line; do handle "$line"; done