Re: [dev] Focusing on windows by name

2011-10-26 Thread pancake
I think [ "$foo" ] will work too. No need for -n. But yeah. Bashisms did lot of brain damage On 26/10/2011, at 20:09, Rob wrote: > On 26 October 2011 14:51, Peter John Hartman > wrote: >> I do something similar: >> >> if [[ $foo != "" ]]; then > > [ -n "$foo" ] > > if you're going for POSI

Re: [dev] Focusing on windows by name

2011-10-26 Thread Rob
On 26 October 2011 14:51, Peter John Hartman wrote: > I do something similar: > > if [[ $foo != "" ]]; then [ -n "$foo" ] if you're going for POSIX.

Re: [dev] Focusing on windows by name

2011-10-26 Thread Peter John Hartman
I do something similar: TMPFILE=/tmp/dwm-lastwindow xdotool getwindowfocus > $TMPFILE foo=$(xdotool search --class st) if [[ $foo != "" ]]; then xdotool windowactivate $foo else st -e tmux-start & fi -- sic dicit magister P University of Toronto / Fordham University Collins Hall

Re: [dev] Focusing on windows by name

2011-10-26 Thread Bastien Dejean
Manolo Martínez a écrit : > Is using xdotool's search option slower or otherwise > worse than this? I can't tell. > (btw, i'm not sure I know what lsw is) http://tools.suckless.org/lsw Greetings, -- Bastien

Re: [dev] Focusing on windows by name

2011-10-26 Thread Manolo Martínez
On 10/26/11 at 12:32pm, Bastien Dejean wrote: > 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) > >

Re: [dev] Focusing on windows by name

2011-10-26 Thread Manolo Martínez
On 10/26/11 at 05:51pm, Patrick Haller 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 > xdotool seems to work: "xdotool search "mutt" windowactivate | urxvt -e mutt" Manolo --

Re: [dev] Focusing on windows by name

2011-10-26 Thread Bastien Dejean
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

Re: [dev] Focusing on windows by name

2011-10-26 Thread Manolo Martínez
On 10/26/11 at 05:51pm, Patrick Haller 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 > Thanks, Patrick, this does half of what I want: it launches mutt only if there is no previous mutt wi

Re: [dev] Focusing on windows by name

2011-10-26 Thread Patrick Haller
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

[dev] Focusing on windows by name

2011-10-26 Thread Manolo Martínez
Dear all, In openbox I have a key bound to the following:"wmctrl -xa mutt || urxvt -name mutt -e mutt" The idea is not to have many instances of mutt lying around -- my key raises a "mutt" window if there is one, or launches it if there isn't. wmctrl does not speak to dwm, if I understand it corr