ShutdownDialog
From awesome
If you miss the GNOME/KDE/XFCE/LXDE/whatever close dialog, there is a very simple workaround.
The shell script below will show a simple dialog like this (the script's dialog is shown on the right). Be warned that if you want to use this script, you will need:
- zenity (used to generate the dialog)
- gksudo (frequently called gksu, used to do a graphical permissions check)
- pm-utils (available from freedesktop, used for suspend, commented out in the code in favour of dbus)
- dbus (used for suspend)
- hal (hardware management)
- slock (screen locking)
However, for most distros, all of these features will be readily available from the package manager. If you prefer to use some other tools, feel free to edit the script to use them. Hopefully you know what you're doing, but we're available in IRC to help.
#!/bin/sh
ACTION=`zenity --width=90 --height=200 --list --radiolist --text="Select logout action" --title="Logout" --column "Choice" --column "Action" TRUE Shutdown FALSE Reboot FALSE LockScreen FALSE Suspend`
if [ -n "${ACTION}" ];then
case $ACTION in
Shutdown)
zenity --question --text "Are you sure you want to halt?" && gksudo halt
## or via ConsoleKit
# dbus-send --system --dest=org.freedesktop.ConsoleKit.Manager \
# /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Stop
;;
Reboot)
zenity --question --text "Are you sure you want to reboot?" && gksudo reboot
## Or via ConsoleKit
# dbus-send --system --dest=org.freedesktop.ConsoleKit.Manager \
# /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Restart
;;
Suspend)
#gksudo pm-suspend
dbus-send --system --print-reply --dest=org.freedesktop.Hal \
/org/freedesktop/Hal/devices/computer \
org.freedesktop.Hal.Device.SystemPowerManagement.Suspend int32:0
# HAL is deprecated in newer systems in favor of UPower etc.
# dbus-send --system --dest=org.freedesktop.UPower /org/freedesktop/UPower org.freedesktop.UPower.Suspend
;;
LockScreen)
slock
# Or gnome-screensaver-command -l
;;
esac
fi
Features
- Simple
- Suspend doesn't require password
Add this to your menu table:
{"Log out", '/home/davide/bin/shutdown_dialog.sh'},
so that it looks something like this:
mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon },
{"Firefox", "firefox"},
{"Thunderbird", "thunderbird"},
{"Pidgin", "pidgin"},
{"Log out", '/your/path/to/shutdown_dialog.sh'},
{ "open terminal", terminal }
}
})