in some sites when I watch a movie in a browser and I don't touch the computer the screen turns off. In other sites like Youtube I don't have that problem.
I tried using caffeine but I don't like the idea of having to manually enable and disable it every time I watch a video. I also tried other methods that I found on the internet but nothing worked.
any suggestions?
I'm using chrome and running ubuntu 16.04.
Ubuntu – When I watch a video online the screen turns off after a few minutes
google-chromelock-screenvideo
Best Answer
UPDATE 2017/08/23: Changed script to one that doesn't send keystrokes but disables
dpms
and the screensaver temporarily while a video is playing full screen.This only works with applications running full screen, not maximized.
First install
xdotool
:then I created a
scripts
folder in my home folder that I could drop any scripts into that I wanted to keep:then I created a file called
check_full.bsh
in my~/scripts
folder and added the following content to it:Since my screensaver is set for 20 minutes, I set the sleep timer in the script to 10 minutes (600 seconds). You can change this based on your screensaver settings.
make the script executable:
For some reason, a cron job would not run this correctly. So I added an entry to my startup to call this script. In the
~/.config/autostart/
folder, I created a file calledCheck_full.desktop
with the following content:I like to have delays added to startup as they usually load better.
change above Exec line to match your home folder.
Set proper permissions to the file:
After logging out and back in,
check_full.bsh
is now running and checking every 10 minutes if active application is full screen. If not, screensaver / lock screen launch at normal times.Hope this helps!