ratpoison-devel
[Top][All Lists]
Advanced

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

[RP] vscreens


From: venky
Subject: [RP] vscreens
Date: Sun Jul 13 02:32:26 2003
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Hi,


This script will help create 3 vscreens with the following
configuration


   +-----------+        +-----+------+     +-----+------+
   |           |        |     |      |     |     |      |
   |           |        |     |      |     |     |      |
   |           |        |     |      |     +-----+------+
   |           |        |     |      |     |     |      |
   |           |        |     |      |     |     |      |
   +-----------+        +-----+------+     +-----+------+

        1                     2                  3


User can either navigate forward or backward in the list.

I guess this can be achieved using groups (from CVS).

-ksv


#!/bin/bash
#
# This allows outside scripts to tell this script where to find
# ratpoison.
if [ -z $RATPOISON ]; then
    RATPOISON=ratpoison
fi

# The number of vscreens. This can easily be made a env variable.

NUMOFVS=3


rp_call ()
{
    $RATPOISON -c "$*"
}

vs_init ()
{
    # Backup the frames
    FS=`rp_call fdump`
    rp_call select -
    rp_call only

    rp_call setenv fs0 `rp_call fdump`
    rp_call vsplit
    rp_call setenv fs1 `rp_call fdump`
    rp_call only
    rp_call split
    rp_call vsplit
    rp_call focusdown
    rp_call vsplit
    rp_call setenv fs2 `rp_call fdump`
    rp_call setenv ws 0

    # restore the frames
    rp_call frestore $FS
}

vs_save ()
{
    WS=`rp_call getenv ws`
    rp_call setenv fs$WS `rp_call fdump`
}

vs_restore ()
{
    vs_save
    WS=`rp_call getenv ws`
    if [ $1 == n ]; then
        W=`expr $((WS+1)) % $NUMOFVS`
    else
            if [ $WS == 0 ]; then
                W=`expr $NUMOFVS - 1`
            else
                W=`expr $WS - 1`
            fi
    fi
    rp_call echo Workspace $W
    rp_call frestore `rp_call getenv fs$W`
    rp_call setenv ws $W
}

vs_bindings ()
{
    rp_call bind p exec $0 n
    rp_call bind o exec $0 p
}

echo boom >/tmp/boom

if [ -z $@ ]; then
    echo "Usage:"
    echo "$0 -i      -- initialize the vscreen"
    echo "$0 -b     -- setup some key bindings"
    echo "$0 n     -- Switch to next vscreen"
    echo "$0 p     -- Switch to prev vscreen"
else
    if [ $1 == -i ]; then
        vs_init
    elif [ $1 == -b ]; then
        vs_bindings
    else
        vs_restore $1
    fi
fi






reply via email to

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