Skip to content

Instantly share code, notes, and snippets.

@vnprc
Last active December 24, 2022 14:51
Show Gist options
  • Save vnprc/5ab086ba4a6772503bf9 to your computer and use it in GitHub Desktop.
Save vnprc/5ab086ba4a6772503bf9 to your computer and use it in GitHub Desktop.
Hide, show, open terminal
#!/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
@vnprc
Copy link
Author

vnprc commented Dec 24, 2022

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/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment