Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #201393

Re: Disable and Enable Screensaver via Bash Script

From "tomas@tuxteam.de" <tomas@tuxteam.de>
Newsgroups linux.debian.user
Subject Re: Disable and Enable Screensaver via Bash Script
Date 2018-10-17 22:00 +0200
Message-ID <wK093-4U4-1@gated-at.bofh.it> (permalink)
References <wJkWd-5nC-1@gated-at.bofh.it> <wJrO1-1dS-1@gated-at.bofh.it> <wJZ3j-4hf-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On Wed, Oct 17, 2018 at 06:43:38PM +0000, Matthew Crews wrote:

[...]

> Makes sense to me. So I would probably need to use a FOR or WHILE loop of some kind to periodically check if my application is running. Would need to play around with it.
> 
> Something else it looks like I could do is:
> 
> #!/bin/bash
> xscreensaver-command -exit   # causes the xscreensaver process to close
> /usr/bin/foo                 # runs my desired application
> xscreensaver                 # restarts xscreensaver process
> 
> While I think my above script will work, its a more brute-force method, and if something breaks then Xscreensaver might not turn back on gracefully. The FOR or WHILE loop would probably be more elegant.
> 
> In any case, this is exactly what I was looking for. Thank you!

This might be a starting point:

  sleep 10 &
  PROC=$!
  
  while true ; do
    echo beep
    kill -0 $! || exit
    sleep 1
  done

Many enhancements possible :-)

Cheers
-- t

Back to linux.debian.user | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Disable and Enable Screensaver via Bash Script Matthew Crews <mailinglists@mattcrews.com> - 2018-10-16 02:00 +0200
  Re: Disable and Enable Screensaver via Bash Script <tomas@tuxteam.de> - 2018-10-16 09:20 +0200
    Re: Disable and Enable Screensaver via Bash Script Cindy-Sue Causey <butterflybytes@gmail.com> - 2018-10-16 13:20 +0200
      Re: Disable and Enable Screensaver via Bash Script Étienne Mollier <etienne.mollier@mailoo.org> - 2018-10-16 23:00 +0200
    Re: Disable and Enable Screensaver via Bash Script Matthew Crews <mailinglists@mattcrews.com> - 2018-10-17 20:50 +0200
      Re: Disable and Enable Screensaver via Bash Script "tomas@tuxteam.de" <tomas@tuxteam.de> - 2018-10-17 22:00 +0200

csiph-web