I am using Plank on Ubuntu 14.04, I want to add "show desktop" shortcut to plank so that whenever I click it I get to see the desktop directly instead of minimizing all the windows. How can I do it?

  1. First of all install the xdotool:

    sudo apt-get install xdotool

  2. Create a Desktop Shortcut for the 'Show Desktop' for simulate the press key WIN+D using xdotool:

    sudo nano /usr/share/applications/show-desktop.desktop

    The contents:

    [Desktop Entry]
    Exec=xdotool key --delay 100 super+d
    Name=Show Desktop

    Or skip the boring edit part from above and enter this:

    echo -e "[Desktop Entry]\nType=Application\nExec=xdotool key --delay 100 super+d\nName=Show Desktop\nIcon=desktop\nTerminal=false\nStartupNotify=false" | sudo tee /usr/share/applications/show-desktop.desktop > /dev/null

  3. Create a Dockitem file in Phank:

    nano ~/.config/plank/dock1/launchers/show-desktop.dockitem

    The contents:


    Or skip the boring edit part from above and enter this:

    /bin/bash -c 'echo -e "[PlankItemsDockItemPreferences]\nLauncher=file:///usr/share/applications/show-desktop.desktop" | tee ~/.config/plank/dock1/launchers/show-desktop.dockitem'

  4. Make It Permanent

    Now create a entry for the command above in gnome-session-properties. Because if accidentally make a mistake and remove the "Show Desktop" dockitem (uncheck 'Keep In Dock'), so you need to re-create the dockitem file again every time. To solve this problem, we just force to recreate the dockitem file on every session startup:

    echo -e "[Desktop Entry]\nType=Application\nExec=/bin/bash -c 'echo -e \"[PlankItemsDockItemPreferences]\\\nLauncher=file:///usr/share/applications/show-desktop.desktop\" | tee ~/.config/plank/dock1/launchers/show-desktop.dockitem'\nHidden=false\nX-GNOME-Autostart-enabled=true\nName=show-desktop-in-phank" | tee ~/.config/autostart/show-desktop-in-phank.desktop > /dev/null

  • there are some spelling mistakes and errors in your code please review it, also I did all still its not working :-/ – Edward Torvalds Apr 26 '15 at 6:28
  • @edwardtorvalds, try this , I remake the whole procedure. Sorry my bad english, your help in this matter will be very appreciated! – Maxwel Leite Apr 27 '15 at 23:57
  • Hello, it doesn't behave correctly when I click on it. It either takes me to the unity dash or it hides all the windows. And when it hides all the windows, it doesn't let me unhide all the windows again. It is a bit bizarre. – vikramreddym Jun 8 '17 at 0:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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