How to run a script when no keyboard or mouse activity
am 28.01.2008 07:46:15 von NightHawk
Hi all,
Need some help. I want to run a script when there is no keyboard or mouse
activity for X amount of minutes.
Like a screensaver does, but to run a script instead. Anyone know how to
do this?
Been wondering how to attempt this for quite some time, Any help is
appreciated!
Regards,
Kevin
mojo7777 at gmail dot com
Re: How to run a script when no keyboard or mouse activity
am 28.01.2008 11:17:55 von Stephane CHAZELAS
On 28 Jan 2008 06:46:15 GMT, NightHawk wrote:
[...]
> Need some help. I want to run a script when there is no keyboard or mouse
> activity for X amount of minutes.
> Like a screensaver does, but to run a script instead. Anyone know how to
> do this?
>
> Been wondering how to attempt this for quite some time, Any help is
> appreciated!
[...]
On X11, you may use XScreenSaverQueryInfo() to query the idle
time.
That means writing a few lines of C code.
There exists a non-standard X utility that you may download off
the web, called xprintidle that does that:
$ ltrace xprintidle
__libc_start_main(0x8048630, 1, 0xbfd8f154, 0x8048790, 0x8048800
XOpenDisplay(NULL) = 0x804a008
XScreenSaverQueryExtension(0x804a008, 0xbfd8f0ac, 0xbfd8f0a8, 0x804857e, 0xbfd8f154) = 1
XScreenSaverQueryInfo(0x804a008, 106, 0xbfd8f090, 0x804857e, 0xbfd8f154) = 1
printf("%lu\n", 2121
) = 3
XCloseDisplay(0x804a008) =
http://www.dtek.chalmers.se/~henoch/text/xprintidle.html
If you feel brave, on Linux, you could watch /proc/interrupts
and parse information in /proc/irq or elsewhere to see what
corresponds to your mice and keyboards.
You may also use xscreensaver or xlockmore that are able to run
arbitrary commands upon reaching a given idle time. May not be
easy to do automatically (in a script) or reliably (without
interferring with the user's screen saver for instance).
--
Stephane
Re: How to run a script when no keyboard or mouse activity
am 30.01.2008 02:10:05 von gerg
NightHawk writes:
>
>Need some help. I want to run a script when there is no keyboard or mouse
>activity for X amount of minutes.
>Like a screensaver does, but to run a script instead. Anyone know how to
>do this?
>
Configure the X server to think your script is a screensaver and run it.
-Greg
--
::::::::::::: Greg Andrews ::::: gerg@panix.com :::::::::::::
I have a map of the United States that's actual size.
-- Steven Wright
Re: How to run a script when no keyboard or mouse activity
am 30.01.2008 06:24:07 von NightHawk
On Wed, 30 Jan 2008 01:10:05 +0000, Greg Andrews wrote:
> NightHawk writes:
>>
>>Need some help. I want to run a script when there is no keyboard or
>>mouse activity for X amount of minutes.
>>Like a screensaver does, but to run a script instead. Anyone know how
>>to do this?
>>
>>
> Configure the X server to think your script is a screensaver and run it.
>
> -Greg
Do you know how to do this?
--Kevin
Re: How to run a script when no keyboard or mouse activity
am 30.01.2008 09:26:01 von gerg
NightHawk writes:
>On Wed, 30 Jan 2008 01:10:05 +0000, Greg Andrews wrote:
>
>> NightHawk writes:
>>>
>>>Need some help. I want to run a script when there is no keyboard or
>>>mouse activity for X amount of minutes.
>>>Like a screensaver does, but to run a script instead. Anyone know how
>>>to do this?
>>>
>>>
>> Configure the X server to think your script is a screensaver and run it.
>>
>
>Do you know how to do this?
>
It has been several years since I compiled a few new screensavers and
configured my X server to run them. I don't remember the details at
the moment.
Does your desktop have any menus labeled "Screensaver"? What do you
use, Gnome, KDE, CDE, something else?
-Greg
--
::::::::::::: Greg Andrews ::::: gerg@panix.com :::::::::::::
I have a map of the United States that's actual size.
-- Steven Wright