Minimize all WINDOWS keyboard shortcut in Linux Mint

Raphael_AU
  8 years ago
  0

First of all,

Show desktop != Minimize all windows

In my opinion Show desktop should show the desktop as it says and Minimize all windows should minimize all the running applications in taskbar and not the ones in system tray. This is quite helpful if like me, you use sticky notes such as Xpad to keep track of everything.

 

And I could not find any shortcuts that would let me do so in Linux Mint. So, I created two shell scripts and used it to accomplish the above.

 

To do that, first install devilspie using the command:

sudo apt-get update && sudo apt-get install devilspie

 

Next, you need to create some devilspie scripts to do the job for you and save those to ~/.devilspie.

 

The first devilspie:

( if
    ( begin
       ( not ( is ( window_name ) "Conky (yourPCname)" ) )
    )
    ( begin
       ( minimize )
    )
)

So, what this devilspie does is that it minimizes all windows except Conky. Save this script as somename1.ds

 

The second devilspie:

( if
    ( begin
       ( is ( window_name ) "Desktop" )
    )
    ( begin
       ( unminimize )
    )
)

This devilspie unminimizes the desktop. Save this script as somename2.ds

 

Now, from the third devildpie onwards, add the applications you want to keep in desktop after the shortcut is pressed. For e.g., plank, xpad, etc.

( if
    ( begin
       ( is ( window_name ) "plank" )
    )
    ( begin
       ( unminimize )
    )
)

The above script unminimizes plank. Save this script as somename3.ds

( if
    ( begin
       ( is ( application_name ) "Xpad" )
    )
    ( begin
       ( unminimize )
    )
)

The above script unminimizes xpad. Save this script as somename4.ds

 

Next, you need to create a shell script:

#!/bin/bash

cd ~/.devilspie
devilspie somename1.ds somename2.ds somename3.ds somename4.ds


exit 0

Save the above script as somenamesh1.sh

Next, you need to add this script to custom shortcut. So, head over to System Settings > Keyboard > Custom Shortcuts > Add custom shortcut

There, enter any name to your liking and as command do:

bash '/path/to/your/script'

By now, you should be able to minimize all windows except the windows you want to keep. But, there's a slight glitch in that. Your script keeps on running and when you open a new window, it starts minimized. To overcome this issue, you need the other script:

 

#!/bin/bash

while true
do
    pkill "devilspie"
    sleep 1
done

exit 0

Save this script as somenamesh2.sh and add this script to your list of startup applications. Also, you don't need to worry about the resource taken by the above script as after 7 days of continuous usage on my PC (without any shutdown), it utilizes a maximum of 460 KiB RAM and 0% CPU.