[openbox] Go to a program if it's already running
Antoine
antoine.vigouroux at numericable.fr
Thu Jul 18 14:44:12 EDT 2013
On 18/07/2013 19:43, Wujek Srujek wrote:
> !/usr/bin/bash
>
> if [ "$#" -gt 1 ]; then
> echo "Has arguments, starting..."
> "$@" &
> exit
> fi
>
> CMD="$1"
> app="$(wmctrl -lx | grep "$CMD" | head -n 1)"
> if [ -z "$app" ]; then
> echo "App not found, starting..."
> "$CMD" &
> else
> id="$(echo $app | cut -f 1 -d ' ')"
> echo "Refocusing app..."
> wmctrl -i -R "$id"
> fi
>
Thanks a lot. I had never heard of wmctrl, that's awesome.
More information about the openbox
mailing list