Re: Disable and Enable Screensaver via Bash Script
- Date: Tue, 16 Oct 2018 22:56:40 +0200
- From: Étienne Mollier <etienne.mollier@xxxxxxxxxx>
- Subject: Re: Disable and Enable Screensaver via Bash Script
On 10/16/18 1:10 PM, Cindy-Sue Causey wrote:
> On 10/16/18, tomas@xxxxxxxxxx <tomas@xxxxxxxxxx> wrote:
>> On Mon, Oct 15, 2018 at 11:51:48PM +0000, Matthew Crews
>>> Hi all,
>>> Currently I am running Stretch with XFCE (window manager is
>>> XFWM4). I presently use Xscreensaver for my screen saver.
>>> Caffeine indicator doesn't work with XFCE as far as I've
>>> been able to tell, so if I want to temporarily disable the
>>> screensaver I need to do so manually, and re-enable it
>>> I'm wondering, is there a way to perform this feature with a
>>> bash script? What I'm looking for is a bash script that does
>>> the following, in sequence:
>>> 1. Disable Xscreensaver
>>> 2. Run a given application
>>> 3. When the application closes, re-enable Xscreensaver
>> "One" way to do it would be to issue periodically
>> "xscreensaver-command -deactivate"
>> while your application is running .
>> Here  is a practical example, for video players.
>>  https://www.jwz.org/xscreensaver/man3.html
>>  https://www.jwz.org/xscreensaver/faq.html#dvd
> SMPlayer has a preexisting preference option where you can
> toggle this very feature on and off. It's found under:
> Options > Preferences > General > Video
> Down at the bottom of that tab, it says, "Disable
> Screensaver". The tooltip says the screensaver will become
> enabled again when the video stops playing.
> A quick test drive shows that toggling that line on and off
> changes the "disable_screensaver=true" line in
> ~/.config/smplayer/smplayer.ini. Not sure what that touches
> next, though, and I need to keep moving onto something else
> this morning. In the meantime, I'm imagining it touching
> something close to what tomas has shared. :)
> Just mentioning it out loud because of tomas offering this up
> now. Maybe it's a wishlist item that can be suggested to
> other packages that don't offer the same. Between tomas'
> offering above and SMPlayer already having similar
> implemented, it won't be as hard for other packages to try to
> add this same *user friendly* feature if they know it exists.
> Glass definitely not half full, I can't help but smell a
> really stinky can of worms with this because of bugs it would
> surely trigger in the early stages.... * sorry 'bout that!* :D
> Cindy :)
Just to add a complement of information, perhaps not necessary
in that precise case, but that can lurk in the dark. Even if
XScreenSaver is disabled, DPMS settings can, sometimes, still
turn off your screen while you are comfortably watching your
favorite conference record. You have to hunt for your mouse
while the presentation continues to slide (fortunately, no
password to provide, but still annoying ;-).
On well chosen aliases/functions/scripts, I happen to disable
And after the show, bring back the energy economy mode with:
The command is part of x11-xserver-utils, so should be pretty
much available everywhere, except maybe on some pizza boxes...
DPMS may be handled well by most video player, maybe not;
I haven't actually tested them all. But this is definitely
something to be aware of, especially on custom tailored systems
where any screen saver is thought to have been removed.
Étienne Mollier <etienne.mollier@xxxxxxxxxx>