Patrick Haller a écrit :
> On 2011-10-26 11:48, Manolo Martínez wrote:
> >
> > In openbox I have a key bound to the following:"wmctrl -xa mutt ||
> > urxvt -name mutt -e mutt"
>
> xlsclients | grep -q mutt || urxvt -e mutt
No, this is not equivalent because the following command:
wmctrl -xa mutt
activates the first client matching the given 'title'.
You could rather do:
#! /bin/sh
wid=$(lsw -l | grep -m 1 "$@" | cut -d ' ' -f 1)
if [ -n "$wid" ]; then
xdotool windowactivate "$wid"
else
case "$@" in
mutt)
urxvt -title mutt -e mutt;;
MOC)
urxvt -e mocp;;
*)
echo "don't know how to raise '$@'" >&2
exit 1;;
esac
fi