xxx

Thursday 24 September 2020

"Show desktop" on one monitor only, on a Linux Desktop

I was browsing a reddit group and so a question from someone asking if it was possible to set a shortcut to minimize all the windows in a specific desktop.

I decided to investigate and couldn't find anything so I decided to write a little script to do just that using 

  • xrandr
  • wmctrl
  • xdotool
While there is some overlap on the functionality of those tools to manage the windows, I just implemented using the commands I already knew. Maybe later I will improve it.

minimizeWindowsInMonitor.sh

The usage is very simple, just call it passing an integer indicating the monitor number.

It works as a toggle: run it once and it minimizes the windows of the selected monitor specified, run it again and it restores the windows.

The script considers a window to be "in" a monitor, if the top let corner is within that monitor. 

Just make it executable and assign a keyboard shortcut to execute it:


Currently it has a few of minor bugs (that I know of)

  • When restoring windows, it restores even windows that were originally minimized.
  • There are some screens which report their offset "wrong" so they appear to be outside the window
  • It does not validate the input parameter
Note: It creates a file (.wmfm) in the home folder of the user to save the parameters of the minimized windows. I thought about putting it in /tmp but that may be a security risk. If you don't like the file there, you can edit the script and specify any other location.

No comments:
Write comments

© 2014 Using FOSS. Designed by Bloggertheme9
Powered by Blogger.