Last active
December 24, 2022 14:51
-
-
Save vnprc/5ab086ba4a6772503bf9 to your computer and use it in GitHub Desktop.
Hide, show, open terminal
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
pids="$(pidof gnome-terminal-server)" | |
if [ -z "$pids" ] | |
then | |
gnome-terminal | |
else | |
focus_window_pid="$(xdotool getwindowfocus getwindowpid)" | |
if [[ $pids == *"$focus_window_pid"* ]] | |
then | |
xdotool getactivewindow windowminimize | |
else | |
wmctrl -lp | while read identity desktop_number PID window_title; do | |
if [[ $pids == *"$PID"* ]]; then | |
wmctrl -ia $identity | |
fi | |
done | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This broke when I upgraded to Ubuntu 24. Switching back to Xorg from Wayland fixes it, though. https://beebom.com/how-switch-between-wayland-xorg-ubuntu/