dsemy.com [Home] [Up]

Previous: ID display, Up: Customization


4.2 Window commands

Window commands are used to perform operations on specific windows. They are normal commands (interactive functions) which are bound to a key sequence in swsw-command-map. swsw-select, swsw-select-minibuffer and swsw-delete are implemented as window commands (See Usage).

swsw-run-window-command should be used to define window commands which require window selection. Alternatively, ensure swsw-before-command-hook runs before window selection, and swsw-after-command-hook runs after window selection. Window selection can be started by setting swsw--id-map as a transient map.

— Variable: swsw–id-map

Key map which is populated automatically with elements corresponding to all tracked windows. The ID of each window is converted to a vector (to serve as a key sequence), and is bound to a command which calls last-command with the window corresponding to the ID as the sole argument. There should be no reason to modify it directly; it is reset whenever window configuration is updated.

— Variable: swsw-command-map

Key map which holds bindings to window commands. This key map is set as the parent of swsw--id-map, so all window commands are available when it's active (unless they are shadowed by a window ID).

— Variable: swsw-window-count

Amount of windows currently tracked, including the minibuffer (if it's active). It can be used to change the behavior of window commands (or display functions, See ID display).

— Function: swsw-run-window-command fun

Run FUN as a window command. Run swsw-before-command-hook, set this-command to FUN, and set swsw--id-map as a transient map which runs swsw-after-command-hook on exit. This function can be used to easily define new window commands. The hooks ran by this function are expected by swsw to run for any window command which requires ID selection; they should be manually added even if this function isn't used when defining a new window command.