You are not logged in.

#1 2012-02-02 02:04:47

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,362

Running xscreensaver in the background after resume from hibernate

I'm using hibernate-script with my tuxonice kernel. One of the things that annoys me about xscreensaver is how when I resume its always running (because the requisite time has passed), so I have to type my password again, having just typed it at BIOS level.

So I killall xscreensaver in an OnSuspend in /etc/hibernate/common.conf. However, restarting xscreensaver doesn't go to the background. What I'm using is this:-

OnResume 20 sudo -b -u MYUSERNAME /usr/bin/xscreensaver

However the terminal that I typed sudo hibernate from never returns, I have to killall xscreensaver from another terminal to get it to release. The problem does not occur when I login to a vt as root and run the same command.

Any suggestions?


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#2 2012-02-02 02:52:59

Cows
Member
From: Brooklyn, NY
Registered: 2007-05-20
Posts: 101

Re: Running xscreensaver in the background after resume from hibernate

Are you in the 'power' group?

Also if you feel comfortable, you could use pm-utils and maybe change the permissions so that people in the 'users' group can run it from terminal.

Offline

#3 2012-02-02 04:58:21

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,362

Re: Running xscreensaver in the background after resume from hibernate

Cows wrote:

Are you in the 'power' group?

Also if you feel comfortable, you could use pm-utils and maybe change the permissions so that people in the 'users' group can run it from terminal.

Thanks, I probably worded the question wrongly. I'm not looking for ways to hibernate as user, but for a way to have xscreensaver run on resume without blocking the terminal. Or, rather, a way to fork it to the background.


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#4 2012-02-02 05:20:42

Cows
Member
From: Brooklyn, NY
Registered: 2007-05-20
Posts: 101

Re: Running xscreensaver in the background after resume from hibernate

Hmm, alright. I was thinking that with pm-utils you could add xscreensaver to this hook script and run it on resume.

#!/bin/bash
case $1 in
    hibernate)
        echo "Hey guy, we are going to suspend to disk!"
        ;;
    suspend)
        echo "Oh, this time we are doing a suspend to RAM. Cool!"
        ;;
    thaw)
        echo "Oh, suspend to disk is over, we are resuming..."
        ;;
    resume)
        echo "Hey, the suspend to RAM seems to be over..."
        xscreensaver & 
        ;;
    *)  echo "Somebody is calling me totally wrong."
        ;;
esac

https://wiki.archlinux.org/index.php/Pm … _own_hooks

Last edited by Cows (2012-02-02 05:20:59)

Offline

#5 2012-02-02 06:44:16

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,362

Re: Running xscreensaver in the background after resume from hibernate

Except I use hibernate-script (as I mention right at the start)....


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#6 2012-05-04 18:00:02

burmashave
Member
Registered: 2012-05-04
Posts: 1

Re: Running xscreensaver in the background after resume from hibernate

I just registered for the forum so I could toss in my solution, so I hope this is what you're looking for. I fork the process and use the 'disown' command. I also use Dan Bernstein's 'setuidgid' utility because I couldn't get it to work with su (I didn't try very hard):

OnResume 70 setuidgid USERNAME xscreensaver > /dev/null 2>&1 & disown

This works for me even if I execute hibernate and resume from a terminal, despite the fact that II get a "can't find display" error from the terminal.

Of course, the stdout and stderr redirect to /dev/null is not necessary. The 'disown' command removes the subprocess from the process table, so that the subprocess is no longer a child of the parent. It is cast off, essentially. I also use a similar command for restarting gkrellm because gkrellm sometimes fails to recognize my second battery after resume.

One quirk I have found is that hibernate will halt if a kill or killall fails. I thought this was happening because the kill command had returned a non-zero exit status. But I just discovered that forking a kill command prevents hibernate from halting when a kill fails, as in:

OnSuspend 20 killall xscreensaver > /dev/null 2>&1 &

Offline

Board footer

Powered by FluxBB