shutdown (physical) button

Brian J. Tarricone bjt23 at cornell.edu
Mon Jun 16 20:19:40 CEST 2008


Tino Keitel wrote:
> On Sun, Jun 15, 2008 at 18:43:47 -0700, Brian J. Tarricone wrote:
> 
> [...]
> 
>> That's not gonna work... for starters, you need DISPLAY set, which is
>> easy, but you also need SESSION_MANAGER set, but that value changes
>> with every new session.  You'd have to do something like run a script
>> on startup that saves that env var to a file somewhere, and then your
>> shutdown script would have to read that file and set the var.  An
>> exercise left to the reader ^_^.
> 
> Is this also possible using dbus? This would be much less complex IMHO.

Not really.  You essentially have the same problem.  The dbus session 
bus relies on env vars to tell applications how to contact it.

Another solution to this problem might be to stop handling power button 
presses using acpid (I thought acpid was deprecated, anyway, and events 
like that should go through a /dev/input/event# device in the future). 
Then you could catch the power key via some kind of power management 
daemon that runs as a part of your X session, and do something 
appropriate there.  But that's quite a bit of work...

	-b



More information about the Xfce mailing list