You are not logged in.
This simple script is executed by motion when it detects movement. The issue is that it does it constantly while there is any movement. How can I modify it to just reset the timeout and not to invoke another instance?
P.S. Sorry if I wasn't very clear.
#!/bin/sh
export DISPLAY=:0
timeout=20
wmctrl -a vlc
sleep $timeout
wmctrl -a chromium
Offline
What sort of movement are you talking about? Mouse movement? I cannot see anything in the code which acts on movement.
Can you elaborate what exactly are you trying to achieve?
Offline
I'm guessing that the script is executed by the application motion.
It might depend on how motion executes it, but you could look into the Bash command "read".
See http://mywiki.wooledge.org/BashGuide/InputAndOutput
Last edited by skanky (2014-10-21 09:39:39)
"...one cannot be angry when one looks at a penguin." - John Ruskin
"Life in general is a bit shit, and so too is the internet. And that's all there is." - scepticisle
Offline
x33a,
I'm talking about this program. It has `on_motion_detected` command that executes external program or a script.
I want to display a nagios statusmap on the screen, and to focus vlc player, when motion detects movement on one of the two ip cameras, then switch back to chromium.
What I did so far is this: motion executes this script on `on_motion_detected` and another one decides to which window give focus based on the last motion time. Is this solution any good?
Last edited by mah0 (2014-10-21 09:44:16)
Offline