User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.4) Ubuntu/edgy Firefox/1.5.0.4 Build Identifier: This is an alternate shutdown helper that uses HAL. It should work on most new linux distros and allow shutdown/reboot as normal user w/o requiring a password. It is the non-intrusive part of the patch found xubuntu xfce4-session which additionally allows suspend/hibernate but touches other files as well. Reproducible: Always
Created attachment 666 patch
Created attachment 667 the new file
Created attachment 725 Automatically use HAL if available Well, here's another one that uses HAL if available (determined via Ping()). But HAL has one major drawback: It's impossible to tell whether the user is allowed to Shutdown/Reboot, which is a no-go for upstream xfce4-session for now. Do you know any way to fix/work-around that?
The way it is set up in ubuntu, and I assume debian, fedora and others have something similar, is by policy settings in /etc/dbus-1/system.d/hal.conf So root and users determined to be at the foreground console (using pam_foregorund.so) are allowed to send messages to the PowerManagement service which has the reboot/shutdown/suspend/hibernate methods. (libhal provides can_suspend() and can_hibernate() but those determine whether the system supports the operations not whether the user is allowed to invoke them) I don't know if/how HAL can detect what it is allowed to do on behalf of the current user besides actually trying the method call, but because of most distros integrate the desktop with the base system it is supposed to just work in the normal case. So it is not an upstream xfce4-session issue to figure this out, it's enough IMHO if it allows distros to conditionally build and take care of the system details themselves, just like with the old redhat-specific shutdown helper : it's in upstream xfce4-session but it is no guarrantee that it will work on all systems.
Committed with revision 22759. 2006-08-14 Benedikt Meurer <benny@xfce.org> * xfce4-session/xfsm-shutdown-helper-hal.c, AUTHORS, NEWS, README, configure.in.in, xfce4-session/Makefile.am: Add support for HAL to shutdown/reboot the computer, based on the Xubuntu patch by Jani Monoses <jani@ubuntu.com>. Bug #2046.