Skip to content

Instantly share code, notes, and snippets.

@iberianpig
Created April 20, 2016 05:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iberianpig/797f77ea2fde627549e90a42e9b6fae9 to your computer and use it in GitHub Desktop.
Save iberianpig/797f77ea2fde627549e90a42e9b6fae9 to your computer and use it in GitHub Desktop.
toggle browser and terminal from shellscript
#!/bin/bash
browser_title="Google Chrome"
terminal_title="byobu"
current_window_id=$(xdotool getwindowfocus)
browser_window_id=$(xdotool search --name --onlyvisible "$browser_title")
terminal_window_id=$(xdotool search --name --onlyvisible "$terminal_title")
if test $current_window_id -eq $browser_window_id
then
xdotool windowactivate $terminal_window_id
else
xdotool windowactivate $browser_window_id
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment