Saturday, May 18, 2019

Xubuntu hotkey for immediate shutdown




I would like to create a two hotkeys. First for terminating all procesess and shutdown the system and turn computer off.



I have tried something but it only logged me off and then I had to confirm I want to log off and then turn off computer manually.



The second one for simple log off.



What is the command I should type in keyboard/hotkey settings? Or should I make .sh file and run it? What command for running the file should I use then?



Thank you very much!




gksudo shutdown -h now would come to mind, but this command requires root privileges. To execute it you would have to enter you password.



Here's a command that should work without root and shut down your PC immediately (compatible with all official Ubuntu flavors):



dbus-send --system --print-reply --dest=org.freedesktop.ConsoleKit /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Stop


These are Xubuntu-specific:





  • shutdown: xfce4-session-logout --halt

  • restart: xfce4-session-logout --reboot

  • log out: xfce4-session-logout --logout

  • suspend: xfce4-session-logout --suspend

  • hibernate: xfce4-session-logout --hibernate



Sources:



http://bbs.archbang.org/viewtopic.php?pid=9078#p9078




http://linux.die.net/man/1/xfce4-session-logout


No comments:

Post a Comment

11.10 - Can't boot from USB after installing Ubuntu

I bought a Samsung series 5 notebook and a very strange thing happened: I installed Ubuntu 11.10 from a usb pen drive but when I restarted (...