Last active
November 8, 2016 08:14
-
-
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)
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 | |
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There is a updated version, with the additional functionality of minimizing the window available here: https://gist.github.com/olegtc/d4b9858e9257ef7a0811ea8b109dd0c2