OS: Ubuntu 16.04 LTS
Kernel: 4.6.2-040602-generic #201606100516, x86_64
Browser: Firefox 48 64-bit (Build ID 20160728203720)
Flash Plugin: Shockwave Flash 11.2 r202
So I have my Brightness & Lock options set to turn the screen off after 3 minutes to save battery. But every time I play a flash video in either Firefox or Chrome (in full screen), the screen turns off after three minutes, and the laptop locks itself.
Apparently, this is a common issue with Flash on Ubuntu, no matter which version of Ubuntu you're running. There are some solutions to this issue, which I've tried. I've tried running this script (sudo and non-sudo) from ~/bin:
#!/bin/bash
# Cleanup any bad state we left behind if the user exited while flash was
# running
gconftool-2 -s /apps/gnome-screensaver/idle_activation_enabled --type bool true
we_turned_it_off=0
while true; do
sleep 60
flash_on=0
for pid in `pgrep firefox` ; do
if grep libflashplayer /proc/$pid/maps > /dev/null ; then
flash_on=1
fi
ss_on=`gconftool-2 -g /apps/gnome-screensaver/idle_activation_enabled`
if [ "$flash_on" = "1" ] && [ "$ss_on" = "true" ]; then
gconftool-2 -s /apps/gnome-screensaver/idle_activation_enabled \
--type bool false
we_turned_it_off=1
elif [ "$flash_on" = "0" ] && [ "$ss_on" = "false" ] \
&& [ "$we_turned_it_off" = "1" ]; then
gconftool-2 -s /apps/gnome-screensaver/idle_activation_enabled \
--type bool true
we_turned_it_off=0
fi
done
done
But it doesn't seem to have an effect on Ubuntu 16.04. It does nothing.
The other solution proposed is Caffeine for Ubuntu. Caffeine works in 16.04, but it completely removes the screen off functionality. And on top of that, there's no 'Preferences' menu in version 2.8.3-3build1, which I have installed--so I can't set it to only work with a specific program, like Firefox.
Essentially, there's no way to automatically force the screen to continue running when a flash video is running in full screen, and to retain screen off functionality at the same time. I have to do it manually each time, by turning Caffeine on and off, or by disabling the screen off functionality from Brightness & Lock before I play the flash video, and to re-enable it when I'm finished.
I've got to wonder--why is this still a thing? This has been an issue on Ubuntu since 2012. It seems like a very obvious issue to solve but it's still unresolved. I find it strange.
Any other possible fixes for this on 16.04? Is there no way to get screen off functionality to recognize flash videos, or vice versa? Thanks.