Just annotations of little "how to's", so I know I can find how to do something I've already done when I need to do it again, in case I don't remember anymore, which is not unlikely. Hopefully they can be useful to others, but I can't guarantee that it will work, or that it won't even make things worse.
Idea for a script to prevent xscreensaver while watching videos on a browser
Tags browser, video, xscreensaver
The core concept is just:
Perhaps it would be more elegant to have something that somehow works more accordingly to xscreensaver's time rather than this thing that has smaller cycles just to play it safe.
Won't work for embedded videos, though, as "youtube" is less likely to be shown in the window title. No idea for that yet, except perhaps something that assumes that a certain level of CPU activity (or CPU use by web browserers) that may be associated with videos in general means is actually a video being played, even if it isn't. Other than that it would be required to "spy" on the browser's current sites I guess, somehow. Or perhaps some "xorg" stuff may be "greped" as an indication of a video being played, I don't know.
I'VE JUST FOUND OUT!
That just assumes that if there's audio, there's video, which is probably a reasonable assumption for the intended purpose, even though there would be "false positives". And negatives, in cases of slideshow videos without any sound...
Code:
while true ; do wmctrl -l | grep -i "youtube\|vimeo" && xscreensaver-command -deactivate sleep 5m done
Won't work for embedded videos, though, as "youtube" is less likely to be shown in the window title. No idea for that yet, except perhaps something that assumes that a certain level of CPU activity (or CPU use by web browserers) that may be associated with videos in general means is actually a video being played, even if it isn't. Other than that it would be required to "spy" on the browser's current sites I guess, somehow. Or perhaps some "xorg" stuff may be "greped" as an indication of a video being played, I don't know.
I'VE JUST FOUND OUT!
Code:
grep RUNNING /proc/asound/card*/pcm*/sub*/status
Total Comments 0