0

I'm using Raspbian GNU/Linux 11 (bullseye) with the LXDE desktop.

I'd like to create an XDG desktop file that (a) places a "Logout" icon on the user's desktop, and (b) immediately logs out the currently logged in user, without prompting for confirmation, when the user clicks on the desktop icon.

What command line should I use for the Exec property in this desktop file:

${HOME}/Desktop/logout.desktop
[Desktop Entry]
Comment[en_US]=Immediately logs out of the LXDE Desktop
Comment=Immediately logs out of the LXDE Desktop
Exec=????
GenericName[en_US]=Logoff
GenericName=Logoff
Icon=system-log-out
MimeType=
Name[en_US]=Logout
Name=Logout
Path=????
StartupNotify=false
Terminal=false
Type=Application

Also, what file permissions should this desktop file have? Does the desktop file require execute permissions (0755), or should its file permissions be those of an ordinary file (0644)?

1 Answer 1

1

The logout dialog is produced by lxsession-logout, which terminates lxsession upon confirmation. If you don't want to display it, you can just directly terminate lxsession:

pkill -SIGTERM -f lxsession

That would be your Exec= line. The Path= line can be left empty.

It's not strictly necessary to have the execute bit set on a .desktop file, but it's customary to have this bit set. IMO without the execute bit you'll get an additional dialog in some environments asking whether you want to execute or edit the file, or a warning such as this one. Not sure if it's the case of Raspbian.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.