Skip to content

Instantly share code, notes, and snippets.

@kurobeats
Created October 17, 2016 21:32
Show Gist options
  • Select an option

  • Save kurobeats/15661d18d0c64a0b9d3cc282ec4d9f06 to your computer and use it in GitHub Desktop.

Select an option

Save kurobeats/15661d18d0c64a0b9d3cc282ec4d9f06 to your computer and use it in GitHub Desktop.
Single instance gnome terminal script
#!/usr/bin/env bash
# You'll want xdotool, but other than that, you would be good to go.
# Just download and set keyboard shortcut
if [ "$(xdotool search --onlyvisible --class gnome-terminal)" == "$(xdotool getwindowfocus)" ]; then
xdotool windowminimize $(xdotool getwindowfocus)
exit
fi
if ps aux | grep "[g]nome-terminal" > /dev/null
then xdotool windowactivate $(xdotool search --onlyvisible --class gnome-terminal)
else
gnome-terminal &
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment