Dr. Noah Bodie
2024-10-06 22:40:52 UTC
I did not want to install Caffeine so I prompted ChatGPT to write a
script that keeps the screensaver from activating when you don't want it
to activate. IE, while watching videos.
NoDoze checks once every 50 seconds (feel free to increase this numeral)
to see if you are watching a video on SMPlayer or on YouTube. If you are
using either one, then the screensaver won't activate. Works great!
---
#!/bin/bash
# Check if smplayer is running.
is_smplayer_running() {
pgrep smplayer > /dev/null
}
# Check if the browser's active tab title contains "YouTube" and "-".
is_youtube_open() {
active_window=$(xdotool getactivewindow getwindowname)
echo "$active_window" | grep -iq "YouTube" && echo "$active_window" |
grep -iq "Mozilla"
}
while true;
do if is_smplayer_running || is_youtube_open;
then xdotool key Shift
fi
# Wait for 50 seconds before checking again. Increase this delay if needed.
sleep 50
done
script that keeps the screensaver from activating when you don't want it
to activate. IE, while watching videos.
NoDoze checks once every 50 seconds (feel free to increase this numeral)
to see if you are watching a video on SMPlayer or on YouTube. If you are
using either one, then the screensaver won't activate. Works great!
---
#!/bin/bash
# Check if smplayer is running.
is_smplayer_running() {
pgrep smplayer > /dev/null
}
# Check if the browser's active tab title contains "YouTube" and "-".
is_youtube_open() {
active_window=$(xdotool getactivewindow getwindowname)
echo "$active_window" | grep -iq "YouTube" && echo "$active_window" |
grep -iq "Mozilla"
}
while true;
do if is_smplayer_running || is_youtube_open;
then xdotool key Shift
fi
# Wait for 50 seconds before checking again. Increase this delay if needed.
sleep 50
done