[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.2 Binding Keys

Function: define-key map key command

Add a keybinding mapping for the key, key, to the command, command, in the specified keymap. If command is nil, remove an existing binding. For example,

 
(stumpwm:define-key stumpwm:*root-map* (stumpwm:kbd "C-z") "echo Zzzzz...")

Now when you type C-t C-z, you’ll see the text “Zzzzz...” pop up.

Function: undefine-key map key

Clear the key binding in the specified keybinding.

Function: kbd keys

This compiles a key string into a key structure used by ‘define-key’, ‘undefine-key’, ‘set-prefix-key’ and others.

Command: set-prefix-key key

Change the stumpwm prefix key to KEY.

 
(stumpwm:set-prefix-key (stumpwm:kbd "C-M-H-s-z"))

This will change the prefix key to <Control> + <Meta> + <Hyper> + <Super> + the <z> key. By most standards, a terrible prefix key but it makes a great example.

Function: make-sparse-keymap

Create an empty keymap. If you want to create a new list of bindings in the key binding tree, this is where you start. To hang frame related bindings off C-t C-f one might use the following code:

 
(defvar *my-frame-bindings*
  (let ((m (stumpwm:make-sparse-keymap)))
    (stumpwm:define-key m (stumpwm:kbd "f") "curframe")
    (stumpwm:define-key m (stumpwm:kbd "M-b") "move-focus left")
    m ; NOTE: this is important
  ))

(stumpwm:define-key stumpwm:*root-map* (stumpwm:kbd "C-f") '*my-frame-bindings*)
Variable: *root-map*

This is the keymap by default bound to C-t (along with *group-root-map* and either *tile-group-root-map*, *float-group-root-map*, or *dynamic-group-map*). It is known as the prefix map.

Variable: *top-map*

The top level key map. This is where you’ll find the binding for the prefix map.

Variable: *groups-map*

The keymap that group related key bindings sit on. It is bound to C-t g by default.

Variable: *group-top-maps*

An alist of the top level maps for each group type. For a given group, all maps whose type matches the given group are active. So for a tile-group, both the group map and tile-group map are active.

Order is important. Each map is seached in the order they appear in the list (inactive maps being skipped). In general the order should go from most specific groups to most general groups.

Variable: *exchange-window-map*

The keymap that exchange-window key bindings sit on. It is bound to C-t x by default.

Variable: *key-seq-color*

Color of a keybinding when displayed in windows such as the prefix keybinding in the which-key window.

Command: bind key command

Hang a key binding off the escape key.

Command: unbind key

Remove a key binding from the escape key.

Command: send-escape

Send the escape key to the current window.

Function: grab-pointer screen

Grab the pointer and set the pointer shape.

Function: ungrab-pointer

Remove the grab on the cursor and restore the cursor shape.

Variable: *banish-pointer-to*

Where to put the pointer when no argument is given to (banish-pointer) or the banish command. May be one of :screen :head :frame or :window

Function: final-key-p keys class

Determine if the key is a memeber of a class

Function: help-key-p keys

If the key is for the help command.

Function: cancel-key-p keys

If a key is the cancelling key binding.

Variable: *editor-bindings*

A list of key-bindings for line editing.

Variable: *numpad-map*

A keycode to keycode map to re-wire numpads when the numlock key is active


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated on January 28, 2024 using texi2html 1.82.