Created
July 19, 2017 11:55
-
-
Save codepuncher/806cabf9c72263fbd5addd50ade39ad8 to your computer and use it in GitHub Desktop.
Quickwin - Focus active window or open program
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
#!/usr/bin/env bash | |
# Focus window from 1st argument or | |
# executes command from 2nd argument | |
wmctrl -ia $(wmctrl -l | grep -i ${1} | awk '{print $1}') || ${2} & |
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
# Example usage: | |
# from cli | |
./quickwin 'user@hostname:' 'gnome-terminal --hide-menubar' # Tries to focus window with title 'user@hostname:' or run gnome-terminal | |
./quickwin 'chrome' 'google-chrome' | |
# keyboard shortcut usage | |
bash -c "~/.local/bin/quickwin 'user@hostname:' 'gnome-terminal --hide-menubar'" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment