<div dir="ltr">I was wandering the same thing about 2 months ago, and I came up with the following script based on Ukurama's thoughts:<div><br></div><div>raise:</div><div><br></div><div><div>!/usr/bin/bash</div><div><br>
</div><div>if [ "$#" -gt 1 ]; then</div><div>    echo "Has arguments, starting..."</div><div>    "$@" &</div><div>    exit</div><div>fi</div><div><br></div><div>CMD="$1"</div><div>
app="$(wmctrl -lx | grep "$CMD" | head -n 1)"</div><div>if [ -z "$app" ]; then</div><div>    echo "App not found, starting..."</div><div>    "$CMD" &</div><div>else</div>
<div>    id="$(echo $app | cut -f 1 -d ' ')"</div><div>    echo "Refocusing app..."</div><div>    wmctrl -i -R "$id"</div><div>fi</div></div><div><br></div><div>You use it like:</div>
<div>raise lxterminal # will start the first terminal</div><div>raise lxterminal # will refocus to the previously running instance</div><div><br></div><div>I then used raise in all my openbox keyboard shortcuts, and it works, most of the time. Some apps might not, for example java swing apps because the script relies on application names, and some of them are just called java. Also, if it finds multiple application instances it refocuses only the first one listed by wmctrl, and I don't know how they are sorted. But you might still find it useful as I have.</div>
<div><br></div><div>wujek</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jul 18, 2013 at 7:23 PM, Brian Mattern <span dir="ltr"><<a href="mailto:rephorm@rephorm.com" target="_blank">rephorm@rephorm.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">There was a thread in Oct. 2011 titled "Launching applications" that<br>
gives various examples of accomplishing this for one specific program<br>
(mutt launched in a terminal).<br>
<br>
I'm not sure you could generalize the method easily, however.<br>
<span class="HOEnZb"><font color="#888888"><br>
Brian<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On Thu, 18 Jul 2013, Antoine wrote:<br>
<br>
> Hello!<br>
> I've been an Openbox user for a while now, and it is the best<br>
> interface known to man.<br>
> However, there's something I never managed to do :<br>
> Imagine you have an item in the root menu corresponding to an<br>
> application. If the application has not been launched yet, then run<br>
> it.<br>
> But if the application is already running, just go to the workspace<br>
> where the window is, and raise the window.<br>
> In an ideal world, if there are more than one window, display a<br>
> submenu allowing to choose the wanted one.<br>
> You'll notice that it's the habitual behavior of most "docks", like<br>
> in Unity or even Windows. But it would be awesome to be able to do<br>
> it with Openbox menus.<br>
> Is there currently some hackish way to do this? I believe it would<br>
> be a very useful feature otherwise.<br>
><br>
> Cheers,<br>
> Antoine from France<br>
> _______________________________________________<br>
> openbox mailing list<br>
> <a href="mailto:openbox@icculus.org">openbox@icculus.org</a><br>
> <a href="http://icculus.org/mailman/listinfo/openbox" target="_blank">http://icculus.org/mailman/listinfo/openbox</a><br>
_______________________________________________<br>
openbox mailing list<br>
<a href="mailto:openbox@icculus.org">openbox@icculus.org</a><br>
<a href="http://icculus.org/mailman/listinfo/openbox" target="_blank">http://icculus.org/mailman/listinfo/openbox</a><br>
</div></div></blockquote></div><br></div>