Node: Commands, Next: , Previous: Keystrokes, Up: Top



Commands

ratpoison can be controlled with commands (so called colon-commands). The summary of available commands is listed below:

abort Command
This is a pretty useless command. By default, it is bound to C-t g, and its purpose is to abort other commands.

addhook hook command Command
Add a command to hook. When the hook is run, command will be executed.

The following hooks are available:

prefix
Run when the prefix key is pressed
switchwin
Run when the user switches to a different window in the current frame.
switchframe
Run when the user switches to another frame. This is also run when the user switches to a different screen, since a frame switch also occurs.
switchgroup
Run when the user switches to a different group.

alias name command Command
An allows you to name a ratpoison command something else. For instance, if you frequently open emacs you may want to make an alias called emacs that loads emacs. You would do it like this:
          : alias emacs exec emacs
          

An alias is treated exactly like a colon command in that you can call it from the colon prompt, bind it to a key, and call it non-interactively with ratpoison -c.

banish Command
Banish the mouse to the lower right corner of the screen.

bind Key command Command
Bind a key to a ratpoison command. This command takes two arguments: the key to bind and the command to run. For example, to bind C-t R to restart ratpoison:
          : bind R restart
          

If no command is specified then bind works exactly like unbind, unbinding the key.

chdir Command
Change the current directory for ratpoison.

clrunmanaged Command
Clear the unmanaged window list. See unmanage for an explanation of the unmanaged window list.

colon command Command
Run a ratpoison command.

curframe Command
Indicate which frame is the current frame.

defbarborder n Command
Set the border width for the bar window.

defbargravity g Command
Set the default alignment for the message bar. See the gravity command.

When called non-interactively with no arguments, the current setting is returned.

defbarpadding x y Command
Set the horizontal and vertical padding inside the bar.

When called non-interactively with no arguments, the current setting is returned.

defbgcolor color Command
Set the background color for all text ratpoison displays. color is any valid X11 color.

defborder n Command
Set the border width for all windows.

When called non-interactively with no arguments, the current setting is returned.

deffgcolor color Command
Set the foreground color for all text ratpoison displays. color is any valid X11 color.

deffont font Command
Set the font. font is a font string like 9x15bold.

definputwidth n Command
Set the width of the input window.

When called non-interactively with no arguments, the current setting is returned.

defmaxsizegravity g Command
Set the default alignment for windows with maxsize hints. See the gravity command.

When called non-interactively with no arguments, the current setting is returned.

defpadding left top right bottom Command
Set the padding around the edge of the screen.

When called non-interactively with no arguments, the current setting is returned.

defresizeunit pixels Command
Set the number of pixels a frame will grow or shrink by when being dynamically resized.

deftransgravity g Command
Set the default alignment for transient windows. See the gravity command.

When called non-interactively with no arguments, the current setting is returned.

defwaitcursor n Command
Set whether the rat cursor should change into a square when waiting for a key. A non-zero number means change the cursor. Zero means don't change the cursor.

When called non-interactively with no arguments, the current setting is returned.

defwinfmt fmt Command
Set the default window format for the windows command. By default it is N-W. The following is a list of valid format characters:
%n
The window number
%s
Window status (current window, last window, etc)
%t
Window Name
%a
Application Name
%c
Resource Class
%i
X11 Window ID
%l
A unique number based on when the window was last accessed. The higher the number, the more recently it was accessed.

When called non-interactively with no arguments, the current setting is returned.

defwingravity g Command
Set the default gravity for normal windows. See the gravity command.

When called non-interactively with no arguments, the current setting is returned.

defwinliststyle setting Command
The window list can be displayed in a row or a column. setting can be row or column.

defwinname name Command
There are three resources ratpoison can get a window's name from: the WMNAME hint, the res_name from the WMCLASS hint, or the res_class from the WMCLASS hint. name can be title which is what most window managers put in the title bar, name which is the res_name, or class which is the res_class.

When called non-interactively with no arguments, the current setting is returned.

delete Command
This deletes the current window. You can access it with the C-t k keystroke.

newkmap kmap Command
Delete the keymap, kmap.

echo text Command
Display text as a message.

escape key Command
Set the prefix to to key. For example escape C-b sets the prefix key to <C-b>.

exec command Command
Execute a shell command. By default, C-t ! does this.

fdump Command
dump the current frame layout as text. When used non-interactively (from the command-line), ratpoison will print the frame layout. When used interactively, nothing happens.

focus Command
cycle through ratpoison's frames.

focusdown Command
Move to the frame below the current frame.

focuslast Command
Switch to the last focused frame.

focusleft Command
Move to the frame left of the current frame.

focusright Command
Move to the frame right of the current frame.

focusup Command
Move to the frame above the current frame.

frestore frames Command
Restore the frame layout based on the list of frames frames. frames should be the text that was printed after calling fdump.

fselect n Command
Select a frame by number. If an argument is passed to it then attempt to select the frame whose number is n. If not, ratpoison will print a number at the top left corner of each frame and wait for the user to type the number they wish to select. Currently there is no way to select a frame whose number is greater than 9 unless the number is passed as an argument.

gdelete group Command
Delete a group. group is optional. If it is not specified ratpoison will attempt to delete the current group. Only empty groups can be deleted. To empty a group see gmerge.

getenv env Command
Display the value of the environment variable, env.

gmerge group Command
Merge group with the current group. All windows in group will be moved to the current group. group is not deleted.

gmove group Command
Move the current window to group.

gnew name Command
Create a new group with the name name. name is optional. This new group becomes the new group.

gnewbg name Command
This is the same as gnew except that the current group does not change.

gnext Command
Go to the next group in the list.

gprev Command
Go to the previous group in the list.

gravity g Command
Change the gravity of the current window. A normal window will default to the top-left corner of the screen, but it can also be placed at the bottom-right corner of the screen. Valid values for g are the 8 directions northwest, north, northeast, east, southeast, south, southwest and west, clockwise from the top left corner. center will center the window in the frame. g and can be abbreviated to the standard compass 1 and 2 letter abbreviations (i.e. nw, s, etc).

When called non-interactively with no arguments, the current setting is returned.

groups Command
Display a list of groups with a similar format to windows.

gselect group Command
Select a particular group by name or number. If group is not provided, ratpoison will interactively prompt for the group.

help Command
Display a help screen that lists all bound keystrokes.

info Command
Display information about the current window.

kill Command
This destroys the current window. Normally you should only need to use delete, but just in case you need to rip the heart out of a misbehaving window this command should do the trick. Also available as C-t K.

lastmsg Command
Display the last message.

license Command
Display ratpoison's license. By default, this is bound to C-t V.

link key Command
Call the command that key is bound to. For instance link C-t would call the command other and switch to the last window.

meta Command
Send a C-t to the current window.

msgwait n Command
Set the bar's timeout in seconds.

When called non-interactively with no arguments, the current setting is returned.

newkmap kmap Command
Create a new keymap named kmap.

newwm window-manager Command
This is a bad-bad command. It kills ratpoison and revives that ugly rodent! Yuck! Avoid!

next Command
This jumps you to the next window in the window list. This one is bound to three keystrokes, namely C-t n, C-t space, and C-t enter.

nextscreen Command
This jumps you to the next X11 screen. nextscreen is used for dual-head displays and multiple monitor setups.

number n target Command
Set a window's number to n. If another window occupies the requested number already, then the windows' numbers are swapped.

The second argument, target, is optional. It should be the number of the window whose number will be changed. If target is omitted ratpoison defaults to the current window.

only Command
Kill all frames but the current one.

other Command
This toggles between the current window and the last window. By default, this is bound to C-t C-t.

prev Command
This jumps you to the previous window in the window list. By default, this is bound to C-t p.

prevscreen Command
This jumps you to the previous X11 screen. prevscreen is used for dual-head displays and multiple monitor setups.

quit Command
Quit ratpoison.

readkey kmap Command
Read a key from the keyboard and execute the command associated with it in the keymap, kmap.

redisplay Command
Redisplay the current window, just like C-t l would do.

remhook hook command Command
Remove command from the hook. See addhook for a list of available hooks.

remove Command
Kill the current frame. This is a no-op if there is only one frame.

resize horizontal vertical Command
Resize the current frame by horizontal pixels horizontally, and vertical pixels vertically. If no arguments are given and the command is called interactively, ratpoison will let the user dynamically resize the frame using C-p to shrink vertically, C-n to grow vertically, C-b to shrink horizontally, C-f to grow horizontally, and s to shrink the frame to the size of the window (See the shrink command). When you have resized the frame to your liking, press Return to finish.

restart Command
Restart ratpoison.

rudeness n Command
The rudeness command lets you decide what windows pop-up automatically and when. This is often useful for those deep hack sessions when you absolutely can't be disturbed.

There are two kinds of windows: normal windows (like an xterm) and transient windows (generally pop-up dialog boxes). When a client program wants to display a new window it makes a requests to ratpoison. ratpoison then decides whether to grant the request and display the window or ignore it. A client program can also request that one of its windows be raised. You can customize ratpoison to either honour these requests (the default operation) or ignore them.

n is a number from 0 to 15. Each of the four bits determine which requests ratpoison grants.

Bit 0
Tells ratpoison to grant raise requests on transient windows
Bit 1
Tells ratpoison to grant raise requests on normal windows
Bit 2
Tells ratpoison to grant display requests on new transient windows
Bit 3
Tells ratpoison to grant display requests on new normal windows

For example, if you wanted only wanted to grant transient windows raise requests and display requests you would type rudeness 5. If a request is not granted ratpoison will tell you about the request with a message like Raise request from window 1 (emacs).

When called non-interactively with no arguments, the current setting is returned.

select n Command
This jumps you to window n where n is the window number as shown in the Program Bar. You can do the same trick with C-n too. To select no window, blanking the current frame, type select -.

select window-name Command
Go to a window by name. A shortcut is C-t '.

setenv env value Command
Set the environment variable env to value

shrink Command
If a window has resize increment hints, such as xterms, the window may not be able to take up the whole frame. In this case, use this command to suck the frame up to the to window, reclaiming any wasted space.

source file Command
Read a text file containing ratpoison commands.

split n Command
hsplit n Command
Split the current frame horizontally in two. The last accessed window not occupying a frame will be the second window.

n is either a fraction of the form x/y or a number. If it is a fraction then the current frame is resized to that fraction of its original size and the new frame takes up the remaining space. For instance, split 1/4 will split the current frame to a quarter of its original size and the new frame will then be 3/4 of the size of the original frame.

If it is a pixel, the original frame is resized to that many pixels. If n has a minus sign before it, then the new frame will shrink by that many pixels.

startup_message state Command
Turn on or off the startup_message. This is most useful in your .ratpoisonrc file. state can be on or off.

When called non-interactively with no arguments, the current setting is returned.

tmpwm WM Command
Gives control over to another window manager and regains control once it has terminated. WM is the path to the new window manager. This command is useful when you want to temporarily take a look at another window manager, or program under a different window manager, but you want to come back to ratpoison when you've finished your investigation.

time Command
Show current time. Disappears after 5 seconds, like all other info bars. In the default setup, the C-t a keystroke is bound to this command.

title title Command
Rename the currently active window. This name will remain for the duration of the window's life, unless you change it again. By default, the C-t A keystroke is bound to this command.

unalias name Command
Remove name from the list of defined aliases.

unbind key Command
Unbind a keystroke.

unmanage text Command
Add text to the unmanaged window list. Any window whose name matches any of the strings in the unmanaged window list will not be handled in any way by ratpoison. This only applies to new windows (not windows already managed by ratpoison).

When called non-interactively with no arguments, the list is returned.

unsetenv env Command
Clear the value of the environment variable, env.

verbexec command Command
Verbosely exec the shell command command. Raptoison displays a message saying command was executed.

version Command
Print ratpoison version. By default, this is bound to C-t v.

vsplit n Command
Split the current frame vertically in two. The last accessed window not occupying a frame will be the second window.

n is either a fraction of the form x/y or a number. If it is a fraction then the current frame is resized to that fraction of its original size and the new frame takes up the remaining space. For instance, split 1/4 will split the current frame to a quarter of its original size and the new frame will then be 3/4 of the size of the original frame.

If it is a pixel, the original frame is resized to that many pixels. If n has a minus sign before it, then the new frame will shrink by that many pixels.

warp state Command
Toggle rat warping. By default ratpoison saves the position of the rat when leaving a window and when the user returns to the window the rat's position is restored. This can be counter-intuitive, so you can toggle it with this command. state can be on or off.

windows fmt Command
This displays the Program Bar which displays the windows you currently have running. The number before each window name is used to jump to that window. You can do this by typing C-t n where n is the number of the window. Note that only windows with numbers from 0 to 9 can be referenced using this keystroke. To reach windows with numbers greater than 9, use C-t ' and type the number at the prompt.

After 5 seconds the Program Bar disappears.

This command is bound to C-t w by default.

When invoked from the command-line like this,

          $ ratpoison -c windows
          

Instead of a message bar, you will get a list of the windows printed to stdout. This allows you to write more advanced scripts than simple keyboard macros. This is where fmt comes into play. If windows is given an arg it treats it as the format string as described in defwinfmt.