Page 5 of 5 FirstFirst ... 345
Results 41 to 46 of 46

Thread: HOWTO: Disable screen saver while Flash is running

  1. #41
    Join Date
    Apr 2008
    Beans
    11
    Distro
    Ubuntu 11.04 Natty Narwhal

    Re: HOWTO: Disable screen saver while Flash is running

    Hi Stray Wolf, No is the answer to your question. The screensaver will turn off when a fullscreen window is in focus and turn back on when there is not a fullscreen window in focus.

  2. #42
    Join Date
    Nov 2004
    Location
    Quebec
    Beans
    741
    Distro
    Kubuntu 12.04 Precise Pangolin

    Re: HOWTO: Disable screen saver while Flash is running

    I think this might be a problem for the developers to figure out because using kde in lucid i have disabled the screensaver and disabled dimming in the power management performance scheme and still my screen blanks.. is anybody out there able to completely stop the screen from blanking? and if so how?
    ~
    Desktop:ASRock P4i65GV/P4 2.8ghz 2gbram
    Laptop:Toshiba L350-PSLD8C Centrino64 dualcore 2ghz 4gbram

  3. #43
    Join Date
    Mar 2009
    Location
    Henderson, Nevada
    Beans
    53
    Distro
    Ubuntu 11.04 Natty Narwhal

    Re: HOWTO: Disable screen saver while Flash is running

    Very useful! This will keep my screen from turning off when Im watching videos. Thanks!
    A young man once challenged me to hack his computer, i told him to stand by and promptly returned with an axe.

  4. #44
    Join Date
    Oct 2011
    Beans
    1

    Thumbs down Re: HOWTO: Disable screen saver while Flash is running

    Here is the solution.

    This tiny script checks every ... seconds if the screen has changed enough to be a movie or something similar...
    Have fun it works great.
    Please excuse my bad speaking english, but i'm very tired (6:31 am in germany ...)

    Code:
    #!/bin/bash
    # © by Maximilian Baude - max.baude@freenet.de
    #
    #Installation on Ubuntu (testet with 11.04)
    #    sudo apt-get install imagemagick
    #    chmod 755 <name and location of this script>
    #    sh <name and location of this script> #or insert this line to "System -> Einstellungen -> Startprogramme" (autostart)
    
    
    
    #time between checks in seconds
    SLEEPTIME=10
    #percentage of screen that have to be changed to poke the screensaver
    #note that the clock and instant messengers notes could change often, so at least 5% should be used
    PERCENTAGETOPOKE=25
    
    
    
    #take first screenshot
    import -window root stopscreensaver1.jpg
    # infinite loop
    while [ 1 -eq 1 ]
    do
        #count of pixels
        WIDTH=$(identify -format "%w" stopscreensaver1.jpg)
        HEIGHT=$(identify -format "%h" stopscreensaver1.jpg)
        let PIXEL=$WIDTH*$HEIGHT
    
        #check every ... seconds
        sleep $SLEEPTIME
    
        #take compare-image
        import -window root stopscreensaver2.jpg
    
        #count of different pixels and the percentage
        DIFFERENCE=$(compare -dissimilarity-threshold 1 -metric AE stopscreensaver1.jpg stopscreensaver2.jpg stopscreensaverdifference.jpg 2>&1)
        let PERCENTAGE=$DIFFERENCE*100/$PIXEL
    
        #check if enough screen-area has changed
        if [ $PERCENTAGE -ge $PERCENTAGETOPOKE ]; then
                gnome-screensaver-command --poke
                echo "Scrennsaver poked at $PERCENTAGE of $PERCENTAGETOPOKE"
            else
                echo "Screensaver not poked at $PERCENTAGE of $PERCENTAGETOPOKE"
        fi
    
        #new compare image 
        rm -f stopscreensaver1.jpg
        mv -f stopscreensaver2.jpg stopscreensaver1.jpg
    done
    Last edited by maxbaude; October 16th, 2011 at 05:32 AM.

  5. #45
    Join Date
    Aug 2010
    Beans
    3

    Re: HOWTO: Disable screen saver while Flash is running

    I inserted a parameter to your nice little script so that one can change the application it is looking for. That's useful for me, because I'm using prism instead of firefox for watching TV.

    Code:
    #!/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
    
        # CHANGED THIS LINE:
        for pid in `pgrep $1` ; 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

  6. #46
    Join Date
    Nov 2007
    Location
    Greece
    Beans
    3
    Distro
    Ubuntu 7.10 Gutsy Gibbon

    Re: HOWTO: Disable screen saver while Flash is running

    This wasn't even an issue in Ubuntu 10.10 and previous. Now it needs caffeine (which is not optimal as it is not an automated solution) or scripts like this. Maybe there should be a bug filed about this?

Page 5 of 5 FirstFirst ... 345

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •