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.