ratpoison-devel
[Top][All Lists]
Advanced

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

[RP] keybinders


From: fubarbaz
Subject: [RP] keybinders
Date: Sun May 25 20:49:01 2003

>...I *hope* to get some more-like-emacs nested keymaps...

This just in!

I have finally, at this moment, found a simple stand-alone keybinder that does 
nesting!

It's called epist(rophy), and it's in the openbox code (see fm.net under 
openbox).  It's in the current deb binaries, too.

It's got some (i think) *box-specific window switching code, which I was 
planning to remove; maybe you guys want to check it out.

I still think having a separate keybinder is move useful than inside any given 
program, tho maybe doing ratpoison -c <foo> is slower than doing it internally.

If we're starting on keybinders, here's some design ideas 

-------------------------------------------------------------------------------
NyxWM - keysd

keysd monitors keyboard input, catches it and/or passes it on, and executes 
commands based on that input.  It can handle nested keybindings.

The configuration file can be got from a file or from stdin.  By default keysd 
looks in ${HOME}/.keysdrc and /etc/nyxwm/keysdrc.


keysd [-d <DISPLAY>] [--stdin | <FILE>[:<LABEL>] ...]

-------------------------------------------------------------------------------
NyxWM - .keysdrc

There are four types of lines in keysdrc: bindings, submaps, labels and global 
options.

keysdrc is case sensitive.  Special words are in uppercase so they will not 
interfere with commands.   Lines continue until an EOL is reached (or a closing 
brace, for submaps).

You may wish to use UP or TOP as an exit hook.  If you use TOP for all execs, 
you'll get an emacs-like system.

Within a particular map (not counting submaps), bindings work in a falll-
through fashion.  When a key-event is detected, it is checked against the first 
binding line.  If they do not match, it falls through to the next.  This means 
that is you put a `ANY+ANY' keybind at the end of a map, it will map any 
*leftover* key/mod combinations, not really all of them.  It also means that if 
you have multiple lines for the same keybind, the first one (in that map) will 
be used.

EXEC { <OPTIONS> } [<MODS>+]<KEY>  [<COMMAND>]
Executes a shell command.

    OPTIONS:    [SYNC|ASYNC] [PASS|CATCH] [SUCCEED|FAIL|FALLTHRU|UP|TOP]
        SYNC:       execute COMMAND synchronously.  This is usually a bad idea.
        ASYNC:      execute COMMAND asynchronously.  This is default
        PASS:       pass this keyboard event on to the next X client.
        CATCH:      do not forward this keyboard event on.  This is default.
        SUCCEED:        after exec/forking, exit keysd with a successful value.
        FAIL:       after exec/forking, exit keysd with a unsuccessful value.
        FALLTHRU:       after executing, exit keysd with the value returned by 
the 
                    COMMAND.  Implies EXEC.
        UP:             after exec/forking, load the parent map (of the current
                    map).
        TOP:        after exec/forking, load the top-level map (starting at
                    LABEL if so invoked).
    MODS:       <MOD>[+<MOD> ...]
        MOD:    {shift,lock,control,mod{1-5},alt,meta,super,hyper, ANY}

        Alt is a synonym for mod1, meta for mod2, super for mod3 and hyper for
        mod4.  They are deprecated, because those keys are not necessarily
        bound to those mods.  The any mod is special, it allows any combination
        of mods (including no mods at all) to be used.  If you use `any+mod1',
        it will bind to anything combination that has mod1 in it.

    KEY:        Key may be any valid X11 keysym.  Note that there may not be any
            space between the mods, spaces and keysym.  Also allowed is the
            special ANY keysym, which matches any keysym, including things like
            Hyper_L, which may be set as a modifier.
    COMMAND:    Any sh command.  By default, this is executed by /bin/sh. 


SUBMAP { <OPTIONS> } [<MODS>+]<KEY>  [<COMMAND>] {<SUBMAP>}

    Loads a submap of the current map.  It DOES NOT do this by executing
    itself, because this would break the UP and TOP options, and OPTION line
    inheritance.  Nevertheless, MOST of the options are the same as the EXEC
    line.  Specifics have not been addressed yet.

    COMMAND is executed synchronously before loading the map; it is intended
    for commands needed to correctly initialize the map.

LABEL <LABEL>

    LABEL is a string and may not contain whitespace.  This is used when
    invoking keysd or in INCLUDE lines.

UNLABEL <STRING>

    When parsing with a from a specific LABEL (rather than the whole file),
    *stop* interpreting when a corresponding UNLABEL is reached.  If no
    UNLABEL, goes to EOF as usual.

INCLUDE <FILE>[:<LABEL>]

    Equivalent to inserting the contents of a given file here.  If LABEL is
    given, insert file from LABEL to UNLABEL.

OPTION <OPTION> [<OPTION> ...]

    Finishes at EOL.  This works like a ./configure scripts options.  To turn
    an OPTION on just specify it, to turn it off use OPTION=0 (no spaces).  At
    present, OPTION can be any of the OPTIONs available in an EXEC line.  They 
    act as specifying the default value for those options (on or off).

    An OPTION applies from when it is speciified until the end of the map it's 
    in.  It also applies to submaps.




reply via email to

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