Saturday, May 4, 2024
54
rated 0 times [  54] [ 0]  / answers: 1 / hits: 110551  / 2 Years ago, sun, january 2, 2022, 4:12:48

My screen brightness used to dim after a few seconds to preserve battery. This is default in Ubuntu 12.04. However when watching video it should not dim.



This works correctly when I watch videos using native applications like VLC. With in-browser video, however, the screen is not prevented from dimming.
This is very annoying as you have to move your cursor every 10 seconds or so.



I used to use Mac OSX where I had the same dimming settings and Flash videos were taken into account correctly.



Anyone an idea how you can make YouTube prevent your screen from dimming?


More From » power-management

 Answers
7

HOWTO: Disable screen saver while Flash is running


Create a bash text file containing


#!/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

Make the script executable by running:


chmod +x ~/path/to/script/flash_saver.sh

Run the script:


~/path/to/script/flash_saver.sh

If you prefer, you can set this script to run at logon by doing the following:



  1. Run the program "Startup Applications"

  2. Click "Add"

  3. Under name type "FlashMonitor" or something you will recognise

  4. Under command type the path to the script

  5. Under comment (if you want) type a brief description. E.g. "Stops screen turning off when Flash is running"


Source: HOWTO: Disable screen saver while Flash is running - ubuntuforums


[#36427] Monday, January 3, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
bleger

Total Points: 468
Total Questions: 108
Total Answers: 100

Location: Belarus
Member since Wed, Dec 7, 2022
1 Year ago
;