8

I'm looking for a "one click" way to shutdown Ubuntu Mate 18.10. I don't want to:

  1. Click the Gear / Settings / ??? whatever you call it
  2. Select Shutdown
  3. Click on Shutdown because that's REALLY what I want to do.

I'm pretty confident that when I want to shutdown my dang computer, I want to shut it down. I don't need to click 3 times. Just 1 click and get up and leave my desk.

Can someone tell me if there's a way to get a 1 click shutdown?

4
  • 1
    Is the power button an option or must it be done using the mouse?
    – Melebius
    Mar 28, 2019 at 12:58
  • 2
    absolute fastest would be SysRq+o, though safer would be SysRq+s, u, o
    – Aaron F
    Mar 28, 2019 at 15:29
  • 1
    Pulling the cord isn't an option right?
    – zero298
    Mar 28, 2019 at 22:18
  • 1
    Power button you have to hold down until the computer does a hard shutdown which I don't want to do either of those. I have no idea what SysRq+o even is and, um, pulling the cord on a laptop wouldn't give the desired results :)
    – user897232
    Mar 29, 2019 at 23:20

5 Answers 5

9

On Ubuntu, the command shutdown now allows you to shut down the system without being a root user. For a one-click solution in Mate, associate this command to a panel launcher.

Beware not to click this by accident, because it will heavily disrupt your work. But then, you asked a one-click solution.

For a two-click solution, Mate might still might offer a "traditional" shut down button you can add to the panel next to the 'Gear' icon. If not, then you still can create your own two-click shut-down launcher for mate-session-save --shutdown-dialog (gnome-session-quit --power-off for Gnome users).

4

How about a keyboard shortcut?

Go to your keyboard settings - for me, that's Settings ⇒ Devices ⇒ Keyboard(not sure what it is in Mate, but should be quite similar), scroll down to the bottom and click the + to add a new

Then, name it, the command you'll want is sudo poweroff (or sudo shutdown now does the same thing, really) - and set it to whatever keyboard shortcut you want. I recommend super+h, since that's not taken by default, and since super+l is lock- but obviously, you can do whatever you want.... including maping it to an F-key of your choice.

2
  • It was hard to pick a winner. Ultimately this is the closest / best alternative. The only thing is you can't include sudo. If you do, it doesn't work because when you use sudo it asks for a password. If you leave sudo out and assign a keyboard shortcut, it's a marvelous solution.
    – user897232
    Mar 29, 2019 at 23:22
  • @Jeff You can use sudo if you add that command (poweroff or shutdown) to sudoers for that user. Then, it won't ask for a password.
    – Joe
    Apr 9, 2019 at 11:12
3

This works for me on Ubuntu 18.04

sudo poweroff

another option is to shutdown

shutdown –h 09:30

Power off the system.

     --help      Show this help
     --halt      Halt the machine
  -p --poweroff  Switch off the machine
     --reboot    Reboot the machine
  -f --force     Force immediate halt/power-off/reboot
  -w --wtmp-only Don't halt/power-off/reboot, just write wtmp record
  -d --no-wtmp   Don't write wtmp record
     --no-wall   Don't send wall message before halt/power-off/reboot
1
  • You probably want now rather than 09:30, most of the time.
    – OrangeDog
    Mar 28, 2019 at 23:01
1

Creating an One Click button

This has been tested and worked on Ubuntu 18.04.2

Install a necessary package in order to easily create a desktop application. We will use the terminal because we need to use a special parameter to avoid unnecessary packages from being installed.

sudo apt update
sudo apt install --no-install-recommends gnome-panel

Call the app from the terminal, as follows

gnome-desktop-item-edit ~/.local/share/applications --create-new

In the opening window give a Name, Comment and an Icon of your choice.
The important here is the Command.

Copy-paste the following in the Command field:

dbus-send --system --print-reply --dest=org.freedesktop.login1 /org/freedesktop/login1 "org.freedesktop.login1.Manager.PowerOff" boolean:true

Example Picture

enter image description here

Click OK

Add the application wherever you want on your Desktop. The time you click the button, it will shutdown the PC without further questions.

Example Picture

enter image description here

0

If you don't care about shutting down "nicely," do this... Alt+F2 and then press and hold Ctrl + Alt + Del for a few seconds. Note that the computer will reboot, not just turn off, so you will have to push the power button on the boot splash after rebooting to shut it off. However, Ubuntu itself will be shut down as fast as possible by easy means because you don't have to type any commands (though a keyboard shortcut would work). If you just want to turn off the OS, you can use this.

You must log in to answer this question.