Skip to content

Instantly share code, notes, and snippets.

@AKuederle
Last active November 8, 2016 08:14
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 AKuederle/ba0a2f3db7f887fbbfad to your computer and use it in GitHub Desktop.
Save AKuederle/ba0a2f3db7f887fbbfad to your computer and use it in GitHub Desktop.
Get Windows like App Hotkey Start-up behavior. First Argument: Path to app. Second argument: App-class (wmctrl -lx)
#!/bin/bash
contains() {
[[ $1 =~ $2 ]] && return 0 || return 1
}
app_list=$(wmctrl -lx | awk '{print $3}')
if contains "$app_list" "$2";
then wmctrl -x -a "$2" ;
else ("$1"&) ;
fi
@AKuederle
Copy link
Author

There is a updated version, with the additional functionality of minimizing the window available here: https://gist.github.com/olegtc/d4b9858e9257ef7a0811ea8b109dd0c2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment