[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RP] browser integration?
From: |
Zed Lopez |
Subject: |
Re: [RP] browser integration? |
Date: |
Thu, 1 Jul 2010 16:58:58 -0700 |
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!)
- Re: [RP] browser integration?,
Zed Lopez <=