LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   seeking HOWTO inhibit screen saver from command-line (http://www.linuxquestions.org/questions/programming-9/seeking-howto-inhibit-screen-saver-from-command-line-771761/)

SaintDanBert 11-26-2009 02:37 PM

seeking HOWTO inhibit screen saver from command-line
 
I'd like to know (1) some command, or (2) some programming that will let me disable-enable the screen saver from a command line. More specifically, I'd like something that I can add to shell scripts.

While running a Gnome desktop, I open a console window and run a command. The command runs a spews to stdout because I want to watch things run. In spite of all of this "running" the screen-saver kicks thinking things are idle without key droppings or mouse droppings.

While I'm asking for help...
How can a script discover if it is running in a kernel console, or xterm-konsole, or backgrounded?

Thanks,
~~~ 0;-Dan

lwasserm 11-26-2009 04:30 PM

I'm assuming your system is using gnome-screensaver? If you can't find any documentation for cli control of the screensaver program itself (and I couldn't find any on my system) then you should be able to bludgeon it into submission with

Code:

killall -STOP gnome-screensaver
and to restart it afterwards, replace "STOP" with "CONT"

For your 2nd question, I'm not sure of a definitive answer, but the command "tty" will return something like "/dev/tty2" when running in a vt, and "/dev/pts/1" if running in a gui terminal or other non-vt environment.

rdnelson 12-01-2009 07:52 AM

Gnome screensaver doesn't work
 
I have searched for a solution to this problem but no luck. I am running FC 11 and out of the box gnome. At first the screensaver worked normally, shutting off the screen after 5 mins. Now it does not work. I found the following command line suggestion in the forums, and it looks like that may point to a problem -- the screensaver is inactive, but how to make it active? I am happy with command line, but have no idea what the command to use would be. I may be misunderstanding the term inactive, of course. Logically, the screensaver would have to be inactive if I am typing a command -- but the forum post where I saw this command showed "The screensaver is active" ??

home/rdn/Music% gnome-screensaver-command --query
The screensaver is inactive
The screensaver is not inhibited

I tried this command (from another post):

home/rdn/Music% killall -CONT gnome-screensaver

But the query returns the same thing as before.

The only thing I can think of that might be an issue is that using the "appearances" background facility I added a couple dozen pictures that I thought I might use as screen background. Not long after that I discovered that my screen did not go black after 5 mins as expected. Not sure this correlation has any causal meaning, however. I then tried various things, finally returning to the plain (blue) default. That seemed to fix it for a short while, then after a couple of days, the bad or non-behavior returned -- the screensaver does not work.

Any help will be appreciated. My system runs all the time, but I don't want the screen to be on all the time.

Roger

gnashley 12-01-2009 12:10 PM

search 'screensaver inhibit' Among the hits:
https://wiki.ubuntu.com/InhibitingGnomeScreensaver

GrapefruiTgirl 12-01-2009 12:28 PM

Much of the replies so far assume you're using gnome-screensaver (and maybe you are..) but just incase you're interested, and are using xscreensaver, try below:

To disable xscreensaver from commandline or script, do (sometimes you need to do this twice):

shell$ xscreensaver-command -exit

and to re-activate the screensaver and background it, do (assuming the default display of :0.0):

shell$ xscreensaver -display :0.0 -nosplash &

Sasha

fbobraga 01-16-2013 03:46 AM

Quote:

Originally Posted by gnashley (Post 3775849)
search 'screensaver inhibit' Among the hits:
https://wiki.ubuntu.com/InhibitingGnomeScreensaver

The same applies for gnome-shell? (it's annoying when listening to music through HDMI and the PM turns-off the screen, turning of TV sound - and there is no way I know to disable it via GUI)

fbobraga 01-16-2013 06:09 AM

Quote:

Originally Posted by fbobraga (Post 4871141)
The same applies for gnome-shell? (it's annoying when listening to music through HDMI and the PM turns-off the screen, turning of TV sound - and there is no way I know to disable it via GUI)

Found a simple extension that may do the trick: https://extensions.gnome.org/extensi...nhibit-applet/


All times are GMT -5. The time now is 01:59 AM.