You are not logged in.

#1 2010-08-02 08:22:11

cleanrock
Member
Registered: 2008-11-17
Posts: 109

script to disable screen saver when playing flash

I thought i should share this shell script i wrote to disable the screen saver when looking at longer flash videos:

#!/bin/sh
while true; do
    PIDS=`pgrep -f libflashplayer`
    for pid in $PIDS ;
    do
        cpu=`top -p $pid -n1 -b | grep -w $pid | awk '{print $9}'`
        if [ -n $cpu -a $cpu -gt 5 ] ; then
            xset s reset
        fi
    done
    sleep 60;
done

It will reset the screen saver counter if a process containing libflashplayer on its command line uses more than 5% CPU (works with firefox at least).
I have the script started by xfce (Application Autostart).
Feedback is welcome.

Offline

#2 2010-08-26 19:29:20

zenix
Member
From: Earth - Save it!
Registered: 2007-08-05
Posts: 104
Website

Re: script to disable screen saver when playing flash

How can you detect long running flash processes?

I notice that, even after all flash-using websites are closed, flash is still running, a child process of firefox. I don't know if chrome suffers from this, with it's independent process model, but it does seem weird.


I made an AUR helper once.
I also go by evaryont and nogweii elsewhere on the internet.
Check out my projects and packages.

Offline

#3 2010-08-26 21:18:30

serprex
Member
Registered: 2010-08-04
Posts: 10
Website

Re: script to disable screen saver when playing flash

Zenix, if flash still used over 5% of my CPU while idling, something isn't right

Last edited by serprex (2010-08-26 21:18:41)

Offline

Board footer

Powered by FluxBB