ratpoison-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[RP] selecting windows by search term


From: Florian Cramer
Subject: [RP] selecting windows by search term
Date: Thu Aug 12 07:34:06 2004

Hi, 

this is a quick Perl hack adding a function that I am missing in
ratpoison: Selecting windows by searchword. If you run the script with a
regular expression searchterm as an argument, ratpoison switches to the
first window with a matching title. 

Unfortunately, one cannot sensibly bind this to a key since there is no
possibility to pass an argument to the script that way.

My ideal would be a script that implements an incremental search
function similar to C-e in Emacs, and allows users to cycle through all
windows matching the search term. Any ideas how this could be
done via external scripting?

-F



#!/usr/bin/perl
# rpsearch.pl
# lets ratpoison select the first window matching the 
# search term passed as an argument to this script 

$searchword = $ARGV[0];
chomp $searchword;
@windows = split (/\n/, `ratpoison -c windows`);

foreach $window(@windows) {
        if ($window =~ /$searchword/i) {
                $window_number = $window;
                $window_number =~ s/^([0-9]+).*/\1/;
                `ratpoison -c \"select $window_number\"`;
                exit;
                }
        }

-- 
http://userpage.fu-berlin.de/~cantsin/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]