ratpoison-devel
[Top][All Lists]
Advanced

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

Re: [RP] Re: ratpoison script to show all windows


From: Florian Cramer
Subject: Re: [RP] Re: ratpoison script to show all windows
Date: Mon Nov 17 19:43:11 2003
User-agent: Mutt/1.5.4i

Am Montag, 17. November 2003 um 20:02:47 Uhr (-0600) schrieb Joe Corneli:
> > curframe=`ratpoison -c windows | grep "^[0-9]*\*" | sed -e 
> > "s/^\([0-9]*\).*/\1/"`
> 
> Yes, that looks like the best possible regexp, and sorry about the
> potentially misleading aspect of my bugfix.

I updated/cleaned up the script so that it can also work non-interactively, 
with the number of seconds the window overview should be visible as an
argument. This makes it possible to use the script within ratpoison, for
example via

bind W exec /usr/local/bin/rpshowall 3

If "0" is given as the argument, the script lets the user interactively
pick one window from the overview (via "column fselect"), opening it
full screen on exit (without restoring the previous frameset).

bind W exec /usr/local/bin/rpshowall 0

thus allows to use ratpoison in a whole new way.

A not-so-nice, but entertaining recursive hack of the script (don't try
it if you have valuable data in your X11 clients, as it can be stopped
only by killing the X server):
 
addhook switchframe exec /usr/local/bin/rpshowall

...which vaguely reminds me of <http://oss.jodi.org>.

-F


#!/bin/sh

# rpshowall
# ratpoison script to show all open windows 
# 2003 Florian Cramer <address@hidden>

# Usage : 
#
# rpshowall [no arguments]
# if called from a terminal, show all open windows and
# restore previous frame layout upon keystroke
#
# rpshowall [n>1]
# show all open windows for n seconds, 
# then restore previous frame layout
#
# rpshowall 0
# show all open windows, do not restore previous frame layout



# Parse input argument

if [ $*>0 ]; then
        wait="$*"
else 
        wait=-1
fi


# Save current frameset

framecount=`ratpoison -c windows | wc -l | sed -e "s/[ ]*//g"`
curframe=`ratpoison -c windows | grep "^[0-9]*\*" | sed -e 
"s/^\([0-9]*\).*/\1/"`
curlayout=`ratpoison -c fdump`


# Create split view of all open windows

ratpoison -c only
i=2; 
while [ $i -le $framecount ]; do 
        if [ $i -le `echo $framecount/2 | bc` ] ; then
                ratpoison -c hsplit
        else
                ratpoison -c vsplit
        fi
        ratpoison -c focus
        ratpoison -c focus
        i=$[$i+1];
done



# Restore frameset after keyboard input / delay / keep layout
# as it is

ratpoison -c "select $curframe"
if [ $wait -eq -1 ]; then
        echo -n "Hit return to restore window layout. "
        read i
elif [ $wait -eq 0 ]; then
        exit
else
        sleep $wait
fi
ratpoison -c "frestore $curlayout"



reply via email to

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