Skip to content

Instantly share code, notes, and snippets.

@un33k
Last active August 29, 2015 14:17
Show Gist options
  • Save un33k/888eda229982dd418878 to your computer and use it in GitHub Desktop.
Save un33k/888eda229982dd418878 to your computer and use it in GitHub Desktop.
#/bin/bash
active_id=$(printf "0x%08x\n" $(xdotool getactivewindow))
active_title=$(wmctrl -l | grep $active_id | awk '{for (i=4;i<=NF;++i)print $i}')
if $(echo $active_title | grep -q -i '\- Sublime Text$'); then
bash_title=$(wmctrl -l | grep -i 'st3_bash' | awk '{for (i=4;i<=NF;++i)print $i}')
wmctrl -a $bash_title
else
sublime_title=$(wmctrl -l | grep -i '\- Sublime Text$' | awk '{for (i=4;i<=NF;++i)print $i}')
wmctrl -a $sublime_title
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment