Page 1 of 1
Idle time detection and action triggering
Posted: Sat Apr 23, 2022 10:12 am
by greengeek
Amethysts thread here got me thinking that it would be nice to have my laptop switch to Desktop2 and display a video (in browser, mpv or mplayer, whatever i happen to have running on desktop2) when i have been idle (no keyboard action) for a specific time - and then switch back to desktop 1 as soon as I click a button or move the mouse.
Any thoughts how this may be achieved?
I guess it is similar to how the system switches off screenblanking when keyboard action is detected.
I have been playing with how to switch desktops and am testing with this script:
Code: Select all
#! /bin/bash
while true
do
xdotool key alt+1
sleep 10
xdotool key alt+2
sleep 20
done
Thanks for any thoughts.
EDIT : Currently looking at the following (neither of which exists on my system unfortunately):
xprintidle https://oldforum.puppylinux.com/viewtop ... 44#p678444
xidle
and also looking at http://www.xfree86.org/current/Xss.3.html
Re: Idle time detection and action triggering
Posted: Sat Apr 23, 2022 1:18 pm
by amethyst
@greengeek
Does not really make sense to me to switch desktops because you will generally always be either looking at the video or you are working on the machine and there's no need to watch the video... Anyways - My existing PowerTimeout utility makes provision for switching between "power states" after a period of inactivity. Shouldn't be too difficult to bring in another option to run a video instead. Another time period can also be brought in (the shortest option is 15 minutes currently). It will be easier to use this adapted utility because you can easily and quickly reset to other options. For instance, you may want to set this video option sometimes but rather have an option like suspend at other times. So illustration how this will work: set the video option (and the timeout) for the video to be played with the utility. When you want to resume working, use the exit shortcut for your player (for mpv it's ctrl+c). Of course, once you set this option with the utility it stays set till you want to toggle the options again.
Also, a bit odd to run the video automatically after a period of inactivity unless you want to impress passersby to behold the lovely video or if you are always in the vicinity and take a peek at the video or you just like your machine playing a relaxing video even if nobody is watching (I suppose in this case it will be like a screensaver running anyway so maybe not so odd afterall...). Nevertheless, the options as mentioned above are open for exploration if you are interested.
Re: Idle time detection and action triggering
Posted: Mon Apr 25, 2022 2:46 pm
by amethyst
I've officially incorporated this video running feature into the nicOS-PowerTimeout utility. I think it's a cool idea. The new nicOS-PowerTimeout.pet can be downloaded here: viewtopic.php?p=17579#p17579
Re: Idle time detection and action triggering
Posted: Mon Apr 25, 2022 6:33 pm
by greengeek
Thanks Nic - i am giving this a try. Couldnt initially see how to get the video running but will keep trying over the next few days.
Cheers!
Re: Idle time detection and action triggering
Posted: Mon May 02, 2022 1:33 am
by greengeek
Had a look at Amethysts power timeout utility and based on his RunVideo script i think the following modification will allow me to use vlc (or rather the minimal version of it - cvlc) to run my chosen video on desktop 2:
Code: Select all
#!/bin/sh
xdotool key alt+2
exec /usr/bin/cvlc --fullscreen --volume=50 /root/testvideo.mp4
Still having trouble handling the mouse/keyboard activity timeout functionality working.
I think the screensaver and dpms functions on my laptop are being reset somehow.
Re: Idle time detection and action triggering
Posted: Mon May 02, 2022 7:29 am
by amethyst
greengeek wrote: ↑Mon May 02, 2022 1:33 am
Had a look at Amethysts power timeout utility and based on his RunVideo script i think the following modification will allow me to use vlc (or rather the minimal version of it - cvlc) to run my chosen video on desktop 2:
Code: Select all
#!/bin/sh
xdotool key alt+2
exec /usr/bin/cvlc --fullscreen --volume=50 /root/testvideo.mp4
Still having trouble handling the mouse/keyboard activity timeout functionality working.
I think the screensaver and dpms functions on my laptop are being reset somehow.
viewtopic.php?p=56519#p56519