Re: Activating gnome-screensaver from /etc/acpi/sleepbtn.sh
Andrew Sackville-West wrote:
> it is possible... I just did it!!
>
> I wanted to see if I could figure this out as a way to help learn
> about environments. The key here is that you've got no
> DBUS_SESSION_BUS_ADDRESS defined. And you've got to get the right
> one. Here's how I hacked it.
>
> from my X session, in a terminal, run
>
> set | grep DBUS > tempenv
>
> then from a vt as root I ran
>
> source tempenv
>
> which gets that environment variable set in the current login
> session. then you have to export that variable before you can access
> the dbus session.
>
> export DBUS_SESSION_BUS_ADDRESS; su $user -c \
> "gnome-screensaver-command --lock"
>
> and lo and behold it works. It does spit out an error, but its the
> same error that is spit out if you run the command within the x
> session and it doesn't prevent it from locking.
>
> So you have to somehow get that variable out of your X session, maybe
> by putting that set | grep command at the end of your .xinitrc or
> whatever you use to launch X. and then you've got to somehow export
> that variable so that the gnome-screensaver-command can access it.
>
> hth.
>
> A
Thank you, that looks interesting.
I was looking in this direction, but didn't manage to get it working
properly. Adding some lines .xsession would probably do it. I'll se what
I come up with. :)
--
Regards / Med vänlig hälsning:
Marcus Libäck <marcus at terminal dot se>
http://terminal.se/
Reply to: