Create shutdown button on Desktop

Message
Author
yoel
Posts: 14
Joined: Sat Jan 25, 2020 7:37 pm

Create shutdown button on Desktop

#1 Post by yoel »

On your desktop create a text file using your favourite text editor.

Paste the following inside the file:

[Desktop Entry]
Version=1.0
Encoding=UTF-8
Type=Application
Name=Shut Down
Comment=Shut off this machine
Categories=System;
Exec=sudo halt
Icon=system-shutdown
Terminal=false
StartupNotify=true
Path=


Save the file as shutdown.desktop
If necessary check the properties and make it executable. You will see a red circular icon on your desktop, just click on it.

That's it, you have a Shutdown button on your desktop. It works perfectly for me. Let me know if it works for you.

Huckleberry Finn

Re: Create shutdown button on Desktop

#2 Post by Huckleberry Finn »

Thank you.

Just .. "halt" may not always mean "poweroff" (like this laptop) .. therefore the command may be better as sudo init 0 or sudo shutdown -Ph now for a real shutdown.

User avatar
Jerry3904
Administrator
Posts: 23315
Joined: Wed Jul 19, 2006 6:13 am

Re: Create shutdown button on Desktop

#3 Post by Jerry3904 »

Does this work on all 3 versions of MX LInux? (hint, hint)
Production: MX-23 Xfce, AMD FX-4130 Quad-Core, GeForce GT 630/PCIe/SSE2, 16 GB, SSD 120 GB, Data 1TB
Personal: Lenovo X1 Carbon with MX-23 Fluxbox
Other: Raspberry Pi 5 with MX-23 Xfce Raspberry Pi Respin

User avatar
markol
Posts: 415
Joined: Sat Jan 30, 2021 8:33 am

Re: Create shutdown button on Desktop

#4 Post by markol »

Jerry3904 wrote: Tue Nov 08, 2022 10:59 am Does this work on all 3 versions of MX LInux? (hint, hint)
Have you tried "Compact Shutdown" widget for KDE and "Action Buttons" for XFCE panel?

User avatar
Jerry3904
Administrator
Posts: 23315
Joined: Wed Jul 19, 2006 6:13 am

Re: Create shutdown button on Desktop

#5 Post by Jerry3904 »

Not talking about those two ...
Production: MX-23 Xfce, AMD FX-4130 Quad-Core, GeForce GT 630/PCIe/SSE2, 16 GB, SSD 120 GB, Data 1TB
Personal: Lenovo X1 Carbon with MX-23 Fluxbox
Other: Raspberry Pi 5 with MX-23 Xfce Raspberry Pi Respin

User avatar
fehlix
Developer
Posts: 12767
Joined: Wed Apr 11, 2018 5:09 pm

Re: Create shutdown button on Desktop

#6 Post by fehlix »

Jerry3904 wrote: Tue Nov 08, 2022 10:59 am Does this work on all 3 versions of MX LInux? (hint, hint)
Should work on all MX/antiX install using "poweroff"

Code: Select all

[Desktop Entry]
# Filename: system-shutdown.desktop 
Type=Application
Name=Shut Down
Comment=Power off the machine
Categories=System;
Exec=sudo poweroff
Icon=system-shutdown
Terminal=false
StartupNotify=false
Categories=System;
Note: "sudo poweroff" instead of "sudo halt" but ,
the other one's recommended above like "sudo init 0" or "sudo shutdown ..."
won't work, as sudo would ask for password for those.
Works in MX Linux: Kde, Xfce and Fluxbox

User avatar
Jerry3904
Administrator
Posts: 23315
Joined: Wed Jul 19, 2006 6:13 am

Re: Create shutdown button on Desktop

#7 Post by Jerry3904 »

I was trying to suggest that it probably wouldn't work with MX Fluxbox.
Production: MX-23 Xfce, AMD FX-4130 Quad-Core, GeForce GT 630/PCIe/SSE2, 16 GB, SSD 120 GB, Data 1TB
Personal: Lenovo X1 Carbon with MX-23 Fluxbox
Other: Raspberry Pi 5 with MX-23 Xfce Raspberry Pi Respin

User avatar
fehlix
Developer
Posts: 12767
Joined: Wed Apr 11, 2018 5:09 pm

Re: Create shutdown button on Desktop

#8 Post by fehlix »

Jerry3904 wrote: Tue Nov 08, 2022 12:15 pm I was trying to suggest that it probably wouldn't work with MX Fluxbox.
After placing the desktop file into applications directory (either ~/.local/share/applications or system wide /usr/share/applications) it would be available in the menu(s) and ready to power off MX Fluxbox, too.

User avatar
Jerry3904
Administrator
Posts: 23315
Joined: Wed Jul 19, 2006 6:13 am

Re: Create shutdown button on Desktop

#9 Post by Jerry3904 »

Sure, but that makes no sense for MX Fluxbox:

1) MXFB already has a rootMenu entry for shutdown and has no need for another
2) no button appears on the desktop (unless of course the user goes through idesk).

So my original not-well-expressed point was: OP's solution is valid for Xfce and KDE only.
Production: MX-23 Xfce, AMD FX-4130 Quad-Core, GeForce GT 630/PCIe/SSE2, 16 GB, SSD 120 GB, Data 1TB
Personal: Lenovo X1 Carbon with MX-23 Fluxbox
Other: Raspberry Pi 5 with MX-23 Xfce Raspberry Pi Respin

Post Reply

Return to “Software / Configuration”