Score:0

How to get Show Desktop working for use by all users?

kr flag

New install of Ubuntu desktop 22.04. I'm trying to get Show Desktop script working for use by all users, with icon in Left Panel of apps. I've put both a shell script show-desktop.sh permissions of 644) using wmctrl and a desktop file show-desktop.desktop with permissions of 744 in /usr/share/applications. However, I don't get Show Desktop found in Activities or Apps. Here is show-desktop.desktop:

[Desktop Entry]

Type=Application Name=Show Desktop Exec=/usr/share/applications/show-desktop.sh Icon=desktop

Here is show-desktop.sh:

#!/bin/bash

status="$(wmctrl -m | grep "showing the desktop" | sed -r 's/(.*)(ON|OFF)/\2/g')"

if [ $status == "ON" ]; then wmctrl -k off else wmctrl -k on fi

What am I doing wrong?

Score:0
cn flag

.desktop launchers are only included in the overview if the minimum of required fields is valid. In this case, the exec= entry is not valid: the permission of the script are set to "read only" for others. Therefore, the script is not recognized as a valid executable for users that are not the owner. Thus, make the script executable by "others".

kr flag
I changed permissions of desktop file in /usr/share/applications to 777, but app still not found in Activities or Apps.
vanadium avatar
cn flag
I copied your files exactly, and "Show Desktop" for me appears in the application overview, with a generic icon though because I do not have a "desktop" icon.
Score:0
kr flag

Now working. Here is my ShowDesktop.desktop file (with permissions 644) in /usr/share/applications/: [Desktop Entry] Version=1.0 Type=Application Terminal=false Exec=/usr/bin/ShowDesktop.sh Name=Show Desktop Comment=Show Desktop Icon=/usr/share/pixmaps/ShowDesktop.jpeg

Here is my ShowDesktop.sh file (with permissions 755) in /usr/bin/: #!/bin/bash

status="$(wmctrl -m | grep "showing the desktop" | sed -r 's/(.*)(ON|OFF)/\2/g')"

if [ $status == "ON" ]; then wmctrl -k off else wmctrl -k on fi

My icon ShowDesktop.jpeg (with permissions 644) is in /usr/share/pixmaps/

The directories I used for the Exec and the Icon lines in the ShowDesktop.desktop file (/usr/bin/, /usr/share/pixmaps) were culled from previous AskUbuntu answers: Standard place for custom scripts Icon Path in Desktop File

kr flag
Correction to my answer: /usr/bin should be /usr/local/bin in my answer.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.