Re: browser integration?

Zed Lopez <[email protected]>
Newsgroups gmane.comp.window-managers.ratpoison.devel
Message-ID <[email protected]>
I wrote:
>I have scripts for ratmen and ratmenu that offer a menu of existing
>windows on the wiki: http://ratpoison.antidesktop.net/wiki/window-menu
>It's possible, but a bit of a pain, to adapt one of them to filter by
>class or application.

I've started doing something like this. dratmenu launches a dmenu to
choose among the application classes of managed windows:

#!/bin/bash
ratpoison -c "windows %c"|sort|uniq|dmenu -i|xargs drat

It calls drat, which selects a window if there was only one for that
application class or, if there's more, runs ratmenu to let you choose
among them by window title:

#!/usr/bin/env perl
my $class=shift;
my @windows = map { [split /\\000/] } grep { /^$class\\000/i } split
/\n/, `ratpoison -c "windows %c\\000%t\\000%n"`;
exec qq{ratpoison -c "select $windows[0][2]"} if @windows == 1;
open(my $ph, "|xargs -0 ratmenu") or die "can't open pipeline: $!";
print $ph qq{$_->[1]\000ratpoison -c "select $_->[2]"\000} for (@windows);

drat's also useful alone -- I have a key bound to "drat urxvt" to
choose from among my rxvt-unicode windows.

Using null as a delimiter and piping to xargs -0 ratmenu beats all
heck out of messing with printable delimeters and worrying about
escaping quotes.

(I'm back from ratmen to ratmenu since Axel Beckert backported
rubikitch's UTF-8 patch for ratmen to ratmenu -- thanks, Axel! thanks,
rubikitch!)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.