1

How can I shutdown my laptop in one mouse click (or maybe two mouse clicks) from the unity launcher?

I've found a number of posts which describe how to create a unity launcher so you can shutdown your laptop with one mouse click - but these are for older versions of Unbuntu (16.04 etc). https://www.faqforge.com/linux/distributions/ubuntu/trigger-system-shutdown-ubuntu-unity-launcher/

Unfortunately these methods don't appear to work with the current version of Unity. Any help would be much appreciated.

Ian
  • 13
  • 2
  • Are we talking about "gnome"? Ubuntu 20.04 doesn't use "unity" anymore. And why don't you want to use the "power" icon on the top right? – kanehekili Dec 13 '21 at 20:37
  • Does this answer your question? [What is the shutdown command?](https://askubuntu.com/questions/283984/what-is-the-shutdown-command) – vanadium Dec 14 '21 at 11:15
  • This (and answer from kanehekili) is EXTREMELY valuable for some circumstances. (It's helpful for 'regular' people who want / need to use a Gnome desktop in the easiest way possible.) See my comment at his answer. – Art Swri May 16 '23 at 16:53

1 Answers1

1

In case you are using a standard Ubuntu with "gnome" (not unity - which would make not much difference) here my proposal: create a file like /home/yourusername/.local/share/applications/exit.desktop

Add the following code:

#!/usr/bin/env xdg-open
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Exec=systemctl poweroff
Name=My Exit
Comment=One Click Exit 
Icon=application-exit
NoDisplay=false
Categories=Utilities;System

Save it. I had to change the "group" to "adm", by using the properties dialog:

Go to activities and search for "exit". Rightclick the icon and add it as "favorite". Now you have your icon (choose any you like) in the "dock"...

kanehekili
  • 5,846
  • 1
  • 12
  • 32
  • Thank you. This works brilliantly and is exactly what I was trying to do. – Ian Dec 15 '21 at 16:59
  • Then you should accept the answer. It honors the time one put into it ;-) – kanehekili Dec 15 '21 at 23:11
  • :-) Accepted the answer - Thanks.......BTW it's not that obvious to a new user that you are supposed to do this?? – Ian Dec 17 '21 at 12:18
  • No sir. There might be tools around (I haven't checked) but it took me some time in the past to figure it out Glad I could share and it helped you. Especially Gnome incapacitates the user - one of the reasons why I'd prefer either KDE or XFCE. But it is a good place to start, as long as Gnome will provide a terminal ;-) – kanehekili Dec 17 '21 at 22:58
  • For me I had a system that was having graphics problems. Monitors going blank - so the top panel could not be seen or accessed. So (a) use gnome-extension to put the launcher (at least for now) on all monitors (ran gnome-extensions prefs [email protected]) and (b) create the button per kanehekili answer and add to the dash/launcher. Now I have a quick shutdown button on all screens/monitors - much better than yanking power every time the graphics go wonky. Thanks kanehekili!!! – Art Swri May 16 '23 at 16:53