Shutdown reboot hibernate or sleep Ubuntu with a single click

By creating desktop shortcuts to the terminal commands mentioned in Tip 206, on page 241, you can create one-click shutdown, reboot, hibernate, or sleep commands (although you'll need to enter your root password each time). You can do this by creating a launcher on the panels.

To create a panel launcher, right-click a blank spot on a panel and select Add to panel. Then select Custom Application Launcher and click the Add button. This will open the Create Launcher dialog box. It doesn't really matter what you type in the Name field of this dialog box—something like Hibernate will do fine, assuming you're creating a hibernate shortcut, of course. In the Command field, type any of the following, depending on what you'd like the shortcut to do (the function of each command is mentioned in parenthesis after each command—there's no need to type that part):

gksu telinit 0 (shutdown) gksu telinit 6 (reboot) gksu /etc/acpi/hibernate.sh (hibernate) gksu /etc/acpi/sleepbtn.sh (sleep)

Select an appropriate icon by clicking the icon preview button and then click OK.

Note that, aside from the password prompt, there is no confirmation of any of these actions (and remember that the password prompt might not appear if you're in the sudo/gksu grace period—see Tip 47, on page 110 for details on how to change this). Before clicking any buttons that you create, before sure to save your work and also close open applications.

Was this article helpful?

0 0

Post a comment