Running Xephyr, and that program sets its window title differently according to whether the mouse/keyboard is locked into the window or not (ctrl-shift key toggles that).
Presently using a script that uses wmctrl to monitor the windows title, along with a sleep 1 within the loop. However that eats cpu. Any suggestions as to a more efficient less cpu intensive way?
Code: Select all
while :; do
C=`wmctrl -l | grep Xephyr | grep releases | wc -l`
...
sleep 1
done
Even at sleep 1 the action when the change occurs does feel/look laggy, but if the sleep is reduced to 0.2 then the cpu usage spikes even higher.
Perhaps a alternative to the wmctrl to detect the window title change ??