How to Add a Shutdown (Power Off) Button to Your Desktop

gloriousigor
  8 years ago
  11

This tutorial describes how to add a Shutdown button to the desktop in Linux Mint 17 (and possibly earlier/later versions), eliminating the necessity of clicking on the Menu button followed by Quit followed by Shutdown, thus replacing three clicks with one.

This trivial innovation caters to the lazybones in the Linux user, or perhaps that perfectionism that seeks maximum efficiency and ease of use in every element of a desktop. My personal ideal would be for the computer to become as easy to use as an appliance, albeit an intelligent appliance. Every appliance has an On/Off button, and there's no reason Linux Mint can't either, because Linux Mint is smart.

The developers have included with characteristic generosity a wonderful little utility named shutdown which is located in the /sbin directory. Setting up a Shutdown shortcut on your desktop is easy, but first you must change the security of the executable, because in a fresh install, it requires the root password to be used. Open a Terminal and enter the following command:

sudo chmod u+s /sbin/shutdown

You will be prompted for your root password. After that, you're done and can type "exit" to exit out of the Terminal.

Next, on your Desktop, right-click on empty space somewhere and choose to Create a Launcher. The type will be Application, which is the default, and for the command, enter the following:

shutdown -Ph now

You may name it whatever you please, although my choice is one word, a simple "Off", reflecting the universal term found on remote controls and other appliances since time began. Under comments, you may wish to note "Power down" or "Shut down" if you wish. To change the icon, click on the springboard icon (which is the default), because we can do better than that. I found an appropriate icon to suggest "Off" located right here in Linux Mint 17:

/usr/share/pixmaps/pidgin/emblems/scalable/unavailable.svg

After you save this, try it out and see whether it works. Mine worked right away without a hitch. For a challenge, you might try setting up a launcher for Restart as well. You can find all the options available for the shutdown command by opening a terminal and typing shutdown --help.

I find these little icons quite convenient, especially for an HTPC scenario where the computer will only remain on for as long as an audience is watching shows. Saves me three clicks.

Comments
algy 9 years ago

Newbie question...
How to remove this and restore original settings please?
Thanks.


f3ktony 9 years ago

Just used this to add a power button to Mint 17.1 Cinnamon. These commands worked just fine, I used this icon /usr/share/icons/Mint-X/apps/scalable/gnome-shutdown.svg

Click, move, click, move further, click to shut off your computer? Nah, set this up and do it with a double click.

Nice one gloriousigor, thank you.


gloriousigor 9 years ago

Well, in your terminal, enter "sudo shutdown --help" to find all the options for shutdown. It is a versatile little beast.

Xfce is now my preferred desktop over buggy KDE. In Xfce's Settings, I also like to click on the Keyboard settings and set up a macro. I like to just press F12 to execute "shutdwon -P now" rather than having to click on anything. Turns out that the keyboard is actually faster than the mouse, which requires a bit of maneuvering. So, when I am done watching my show, I tap F12, and that's all she wrote.


rogonow 10 years ago

"halt NOW" under sudo doesn't shut down my pc. :(


rogonow 10 years ago

"shutdown -P now" doesn't shut down my pc. :(


jahid_0903014 10 years ago

thnks


gloriousigor 11 years ago

KDE users when changing the icon can select Status and then looked for user-offline.


gloriousigor 11 years ago

I couldn't find that icon, as I'm using KDE, but I did find a user-offline icon that looked a little bit better.


fucimin 11 years ago

Hi, this is my 1st comment. I would like to suggest some better icons for "off" and "reboot" to complete this wonderful trick. Go to
/usr/share/icons/gnome-colors-common/scalable/apps

and look for gnome-shutdown.svg and gnome-session-reboot.svg
Regards :-)


gloriousigor 11 years ago

Well, I didn't have any problem with the shutdown. This is more of a convenience, to just make one click of the mouse rather than three. I find that it saves about five seconds on average. Me Lazybones? Why yes, thank you very much.


Lee-Larsson 11 years ago

Sweeet! Had similar problem w/KDE/Pinguy..I, had to use terminal... "halt NOW!"
I could not even activate w/Cntrl-Alt-Del !! your Idea is better solution.. IF screen doesn't LOCK!