Created
April 20, 2016 05:19
-
-
Save iberianpig/797f77ea2fde627549e90a42e9b6fae9 to your computer and use it in GitHub Desktop.
toggle browser and terminal from shellscript
This file contains 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 | |
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