Re: [dev] Find window with dmenu

2013-02-12 Thread Chris Down
(perhaps I should expand since that's perhaps a "no shit" considering it's ERE) sed has no ERE in POSIX, and kinda lacks for certain functionality when you're looking for portability. In general awk doesn't suffer the same caveat. But I'm an awk fanboy, so I would say that. Chris On 13 February

Re: [dev] Find window with dmenu

2013-02-12 Thread Chris Down
-r is not POSIX. On 13 February 2013 07:29, Nimrod Omer wrote: > > > I disagree because grep (with -E or as egrep) does support Extended > > Regular Expressions, which sed does not. > > > > sed -r >

Re: [dev] Find window with dmenu

2013-02-12 Thread Nimrod Omer
> I disagree because grep (with -E or as egrep) does support Extended > Regular Expressions, which sed does not. > sed -r

Re: [dev] Find window with dmenu

2013-02-12 Thread Sam Watkins
markus schnalke wrote: > I disagree because grep (with -E or as egrep) does support Extended > Regular Expressions, which sed does not. if you want fancy regular expressions, just use perl (troll ducks for cover!) ;)

Re: [dev] Find window with dmenu

2013-02-12 Thread Sam Watkins
People wrote: > grep? awk? sed? Or you can just use the simplest tool for the job now, grep, and if your needs change some day, you can use a different tool. OMFG I had to switch to a different tool the sky is falling the sky is falling. No seriously.

Re: [dev] Find window with dmenu

2013-02-12 Thread Thomas Dean
On Tue, Feb 12, 2013 at 16:40:55 +0100, Andreas Amann wrote: > the ids of visible windows is stored in the _NET_CLIENT_LIST property of the > root window and can be accessed with "xprop -root _NET_CLIENT_LIST" > > The followning script lets you select one with dmenu and then focus it: Thank you f

Re: [dev] Find window with dmenu

2013-02-12 Thread stanio
* markus schnalke 2013-02-12 16:39 > The following is NOT portable: > > > sed -E 's/\s\+// ; /"(vim|surf):"/d' > > http://pubs.opengroup.org/onlinepubs/9699919799/utilities/sed.html > > If you want sed with Extended Regular Expressions, take awk. :-) For the particular case of emulating these m

Re: [dev] Find window with dmenu

2013-02-12 Thread Andreas Amann
On Tue, Feb 12, 2013 at 10:36:27AM +0100, Thomas Dean wrote: > all the unwanted windows in the list. See the attached scripts. Does anyone > know a solution for this? Is there an existing tool that lists all > "visible" windows along with their id? > the ids of visible windows is stored in the _

Re: [dev] Find window with dmenu

2013-02-12 Thread markus schnalke
[2013-02-12 14:27] Truls Becken > On 2013-02-12, at 13:22, Chris Down wrote: > > > Considering he's already doing rudimentary filtering through in *addition* > > to sed calls, awk is more generalisable choice to the problem set. > > Alternatively, you could say that sed is the more generalisable

Re: [dev] Find window with dmenu

2013-02-12 Thread Truls Becken
On 2013-02-12, at 13:22, Chris Down wrote: > Considering he's already doing rudimentary filtering through in *addition* > to sed calls, awk is more generalisable choice to the problem set. Alternatively, you could say that sed is the more generalisable choice since grep is pretty much a subset of

Re: [dev] Find window with dmenu

2013-02-12 Thread Peter Hartman
What I've been doing for a bit is using a modified version of lsw + xdotool: ~/bin $ cat dwm-xdo-focus #!/bin/sh TMPFILE=$HOME/.tmp/dwm-lastwindow xdotool getwindowfocus > $TMPFILE xdotool windowactivate $1 diff -r e86225980f5d lsw.c --- a/lsw.c Sat Jun 18 18:47:03 2011 +0100 +++ b/lsw.c

Re: [dev] Find window with dmenu

2013-02-12 Thread Chris Down
Yes, you can string a huge bunch of stuff in one grep invocation, which is great until you discover you want to do other stuff down the line. Considering he's already doing rudimentary filtering through in *addition* to sed calls, awk is more generalisable choice to the problem set. Chris On 12 F

Re: [dev] Find window with dmenu

2013-02-12 Thread Martti Kühne
On Tue, Feb 12, 2013 at 10:39 AM, Chris Down wrote: > Just a comment on your method rather than your problem, calling ''grep'' > that many times through that many pipes is fairly expensive and should be > avoided, since it has to create each new process and pass the same data > through every singl

Re: [dev] Find window with dmenu

2013-02-12 Thread Thomas Dean
On Tue, Feb 12, 2013 at 11:07:52 +0100, Michał Kazior wrote: > You might consider using lsw (http://tools.suckless.org/lsw). Excellent! I think I tried it earlier, but it did not list the window id's back then. Now it does the job perfectly, thanks!

Re: [dev] Find window with dmenu

2013-02-12 Thread Michał Kazior
You might consider using lsw (http://tools.suckless.org/lsw). -- Michal.

Re: [dev] Find window with dmenu

2013-02-12 Thread Thomas Dean
Yes, my solution is very ad hoc, I'm sure it can be improved in many ways. But I'm looking for something that avoids the problem to begin with. On Tue, Feb 12, 2013 at 17:39:30 +0800, Chris Down wrote: > Just a comment on your method rather than your problem, calling ''grep'' > that many times thr

Re: [dev] Find window with dmenu

2013-02-12 Thread Chris Down
Just a comment on your method rather than your problem, calling ''grep'' that many times through that many pipes is fairly expensive and should be avoided, since it has to create each new process and pass the same data through every single one. You'd be better using awk and a single pipe. Chris O

[dev] Find window with dmenu

2013-02-12 Thread Thomas Dean
I often have many windows open (mostly with pdf files I need to read), and try to come up with a tool that lets me find and focus a window easily. I now simply list all windows with xwininfo and feed that to dmenu. But the list is full of invisible/dummy windows I don't care about. I clean the list