4

In GNOME desktop, how can I minimize/restore all windows of a specific application?

I know the shortcut Super + d hides all normal windows and then restores them, but I'm looking for its equivalent that works only for windows of a given application (for example, the application running in the current window).

Kurt
  • 61

1 Answers1

1

I came up with rather a hacky, non-universal solution using wmctrl and xdotool. A custom keyboard shortcut registered with the command

/bin/bash -c "for wid in $(wmctrl -l -p | grep $(xdotool getactivewindow getwindowpid) | awk '{print $1}') ; do xdotool windowactivate $wid > /dev/null 2>&1 ; done"

activates specific windows that have the same PID as the current one's, and works as desired with applications like GNOME Terminal, Nautilus, Firefox, and others. The minimization shortcut can be added with the windowminimize option replacing windowactivate. I tested the shortcuts in Ubuntu 18.04 with GNOME version 3.28.4.

Since the command discriminates windows by their PIDs, this solution does not work when windows of the same application have different PIDs.

Kurt
  • 61