Configuración de Ratpoison

Descripción del contenido de la página

Ejemplos de configuración del gestor de ventanas Ratpoison.

Etiquetas:

Mi gestor de ventanas favorito desde hace muchos años es Ratpoison, esto es, «veneno para ratas». El nombre lo dice todo. Por si quedara duda, su lema es Dile adiós al roedor. Y es que para trabajar el teclado es más eficaz que el ratón.

He probado otros muchos gestores de ventanas, antes y después de conocer Ratpoison, pero tras probarlo siempre regresé a él. Los otros dos gestores de ventanas que utilicé durante algún tiempo son Fluxbox y Openbox; especialmente este último es muy recomendable por su ligereza, su configurabilidad y su manejo del teclado. Sin embargo el heterodoxo Ratpoison gana la comparativa en todos los aspectos.

Esto es lo que me gusta de Ratpoison:

Una ventaja muy especial de Ratpoison es que ayuda a concentrarse en la tarea que tenemos entre manos, porque en pantalla vemos sólo la aplicación con la que estamos trabajando. Es posible dividir la pantalla en cuadros y ver en cada uno de ellos una aplicación diferente, pero normalmente no es necesario.

Por supuesto con Ratpoison pueden funcionar otras aplicaciones que añadan paneles de control con sombras translúcidas en tres o cuatro dimensiones, menús flotantes que hagan soniditos cuadrafónicos, gestores de escritorio sembrados de iconitos de carpetas que se abran y cierren solas, pantallitas que informen de si está lloviendo o hace sol sobre tal o cual pueblo... y demás cosas muy útiles para derrochar tanto los recursos de nuestra máquina como nuestro tiempo. Pero probablemente quien sabe apreciar la austeridad y eficacia de Ratpoison no necesita ese tipo de complementos.

El compañero ideal (y «padre espiritual») de Ratpoison es Screen, otro de mis programas favoritos de uso cotidiano.

Más información sobre Ratpoison

~/.ratpoisonrc

Algunos extractos de mi fichero de configuración .ratpoisonrc (en 2016-03-12), que pueden resultar útiles como ejemplo:

# Part of Ratpoison config file
# by Marcos Cruz (programandala.net)

###############################################################
# preferences

startup_message off

# "r" is under the right forefinger in the Spanish Dvorak keyboard layout:
escape C-r

banish
select -
defborder 0
defpadding 0 0 0 0

set border 0

set winfmt %2n.%1f %3s %8a: %32t

# change the default cursor and background
#exec xsetroot -cursor_name left_ptr
#exec xsetroot -solid black
#exec xsetroot -solid black -cursor_name left_ptr
#exec xsetroot -solid blue -cursor_name left_ptr
#exec xloadimage -onroot -quiet -center /home/mythtv/.mythtv/mythtvstart.jpg

# Use the name of the program rather than the title in the window list
defwinname name

# Free 1-pixel row at the top of the screen:
#set padding 0 1 0 0
# That space will be used by xbattbar's bar
# (needed on the Pandora, not on the Raspberry Pi).

# Default gravity
set wingravity center

###############################################################
# top level keys

unbind a
unbind A
bind b banish
unbind C-a
unbind C-A
unbind C-b
unbind c
unbind C-i
bind h time
bind i info
bind k delete
bind K kill
unbind C-k
unbind C-K
#bind l windows
unbind l
bind C-l redisplay
unbind m
unbind n
unbind C-n
unbind o
bind O tmpwm openbox
unbind p
bind P tmpwm ratpoison
unbind C-p
unbind Q
bind C-q quit
# "other" upper and lower case (because of possible caps lock):
bind r other
bind R other
# somehow "meta" works in gvim but not in vim (in a terminal under X Windows):
bind C-r meta
bind C-R meta
# no "restart" hotkey any more
#bind C-R restart
unbind s
unbind S
unbind C-s
bind C-S restart
unbind t
unbind T
bind C-t title
unbind C-V

# XXX TODO
# 2016-01-26
# http://ratpoison.wxcvbn.org/cgi-bin/wiki.pl/mouseless_paste
bind C-v exec ~/bin/screen2xsel.sh


#bind w exec ~/bin/ratpoison_windows.sh
bind w windows
unbind W
unbind C-w

# bind C-apostrophe # buggy?

# Split in frames:
bind underscore vsplit
bind bar hsplit

#bind ISO_left_tab other
bind Tab other
bind Return other
unbind C-Return
bind space only
unbind C-space
bind Right next
bind Left prev

bind F1 help
bind F2 title
bind F5 redisplay
bind F10 quit

# Make prtscreen work, as long as in ratpoison mode. "import" is an Imagemagick command.
# Found in http://en.wikibooks.org/wiki/Using_Ratpoison/Example_Config
bind Print exec import -window root png:$HOME/snapshot_$(date %Y%m%d%H%M%S)$$.png

# Here's a hack from John Meacham
# Found in http://threebit.net/mail-archive/mythtv-users/msg35742.html
# It doesn't work fine for me: the calendar is not shown.
bind c exec ratpoison -d :0.0 -c "echo `date +'%r - %A %n    %D - %B'` `cal | tail +2 | sed -e 's/^Su/\n\n Su/' -e 's/.*/ & /' -e \"s/\ $(date +%e)\ /\<$(date +%e)\>/\"`"
# it produces output like the following in the message window, very handy:
#         +-----------------------+
#         |05:05:24 PM - Tuesday  |
#         |   09/09/03 - September|
#         |                       |
#         |Su Mo Tu We Th Fr Sa   |
#         |    1  2  3  4  5  6   |
#         | 7  8< 9>10 11 12 13   |
#         |14 15 16 17 18 19 20   |
#         |21 22 23 24 25 26 27   |
#         |28 29 30               |
#         +-----------------------+

###############################################################
# windows list

bind A select 10
bind B select 11
bind C select 12
bind D select 13
bind E select 14
bind F select 15

newkmap from00
bind n readkey from00

newkmap from00to09
definekey from00 0 readkey from00to09

definekey from00to09 0 select 0
definekey from00to09 1 select 1
definekey from00to09 2 select 2
definekey from00to09 3 select 3
definekey from00to09 4 select 4
definekey from00to09 5 select 5
definekey from00to09 6 select 6
definekey from00to09 7 select 7
definekey from00to09 8 select 8
definekey from00to09 9 select 9

newkmap from10to19
definekey from00 1 readkey from10to19

definekey from10to19 0 select 10
definekey from10to19 1 select 11
definekey from10to19 2 select 12
definekey from10to19 3 select 13
definekey from10to19 4 select 14
definekey from10to19 5 select 15
definekey from10to19 6 select 16
definekey from10to19 7 select 17
definekey from10to19 8 select 18
definekey from10to19 9 select 19

newkmap from20to29
definekey from00 2 readkey from20to29

definekey from20to29 0 select 20
definekey from20to29 1 select 21
definekey from20to29 2 select 22
definekey from20to29 3 select 23
definekey from20to29 4 select 24
definekey from20to29 5 select 25
definekey from20to29 6 select 26
definekey from20to29 7 select 27
definekey from20to29 8 select 28
definekey from20to29 9 select 29
definekey from20to29 9 select 29

###############################################################
# keymap for windows

newkmap window
bind W readkey window

# change the current window's number:
definekey window 0 number 0
definekey window 1 number 1
definekey window 2 number 2
definekey window 3 number 3
definekey window 4 number 4
definekey window 5 number 5
definekey window 6 number 6
definekey window 7 number 7
definekey window 8 number 8
definekey window 9 number 9
definekey window A number 10
definekey window B number 11
definekey window C number 12
definekey window D number 13
definekey window E number 14
definekey window F number 15

###############################################################
# keymap for frames

newkmap frame
bind f readkey frame
#definekey frame Tab focuslast
#definekey frame Return focuslast
definekey frame Space only
definekey frame Left focusleft
definekey frame Right focusright
definekey frame Up focusup
definekey frame Down focusdown
definekey frame C-Left exchangeleft
definekey frame C-Right exchangeright
definekey frame C-Up exchangeup
definekey frame C-Down exchangedown
definekey frame f focuslast
definekey frame ' fselect
definekey frame 0 fselect 0
definekey frame 1 fselect 1
definekey frame 2 fselect 2
definekey frame 3 fselect 3
definekey frame 4 fselect 4
definekey frame 5 fselect 5
definekey frame 6 fselect 6
definekey frame 7 fselect 7
definekey frame 8 fselect 8
definekey frame 9 fselect 9
definekey frame c remove
definekey frame d dedicated
definekey frame m shrink
definekey frame o only
definekey frame r resize
#definekey frame r frestore
#definekey frame C-r frestore
#definekey frame s fdump
definekey frame t resize
definekey frame u undo

# Frame layouts
# Found in:
#http://threebit.net/mail-archive/mythtv-users/msg35742.html

# bind M-! to store the current frame layout in slot #1
#bind M-exclam exec ratpoison -c "setenv fs1 `ratpoison -c 'fdump'`"

#bind M-1 to restore the frame layout in slot #1
#bind M-1 exec ratpoison -c "frestore `ratpoison -c 'getenv fs1'`"

# Do the same for slot #2 and bind it to M- (at)  and M-2, respectively.
###bind M-at exec ratpoison -c "setenv fs2 `ratpoison -c 'fdump'`"
###bind M-2 exec ratpoison -c "frestore `ratpoison -c 'getenv fs2'`"

# Give ourselves another slot on M-# and M-3, respectively.
###bind M-numbersign exec ratpoison -c "setenv fs3 `ratpoison -c 'fdump'`"
###bind M-3 exec ratpoison -c "frestore `ratpoison -c 'getenv fs3'`"

###############################################################
# keymap for group

newkmap group
bind g readkey group
# alternative syntax:
#definekey top g readkey group

definekey group n gnew
definekey group N gnewbg
definekey group w groups
definekey group g gother
definekey group Right gnext
definekey group Left gprev
definekey group ' gselect
definekey group 0 gselect 0
definekey group 1 gselect 1
definekey group 2 gselect 2
definekey group 3 gselect 3
definekey group 4 gselect 4
definekey group 5 gselect 5
definekey group 6 gselect 6
definekey group 7 gselect 7
definekey group 8 gselect 8
definekey group 9 gselect 9
definekey group t grename
definekey group F2 grename
definekey group i gmerge
definekey group d gdelete
definekey group F8 gdelete

#definekey group m gmove
#definekey group F6 gmove
# keymap for group movement:
newkmap group_move
definekey group m readkey group_move
definekey group_move 0 gmove 0
definekey group_move 1 gmove 1
definekey group_move 2 gmove 2
definekey group_move 3 gmove 3
definekey group_move 4 gmove 4
definekey group_move 5 gmove 5
definekey group_move 6 gmove 6
definekey group_move 7 gmove 7
definekey group_move 8 gmove 8
definekey group_move 9 gmove 9

###############################################################
# keymap for menus

# dmenu is part of the package suckless-tools

newkmap menu
bind m readkey menu

# all executables in the current path:
definekey menu m exec dmenu_run -l 8 -fn -xos4-terminus-bold-r-normal--24-240-72-72-c-120-iso8859-15

# ZX Spectrum configurations with Fuse:
definekey menu z exec $(ls ~/bin/zx*.sh -1 | xargs -n1 basename | dmenu -l 8 -fn -xos4-terminus-bold-r-normal--24-240-72-72-c-120-iso8859-15)

###############################################################
# keymap for window managers

newkmap windowmanager
bind M readkey windowmanager

definekey windowmanager d tmpwm dwm
definekey windowmanager i tmpwm i3
definekey windowmanager o tmpwm openbox
definekey windowmanager p tmpwm spectrwm
definekey windowmanager s tmpwm spectrwm
definekey windowmanager t tmpwm stumpwm

###############################################################
# keymap for applications

newkmap application
bind a readkey application

#definekey application a exec amsn
#definekey application b exec x-terminal-emulator -T BASin -e wine "~/.wine/drive_c/Archivos de programa/BASin/BASin.exe &"
#definekey application b exec wine "~/.wine/drive_c/Archivos de programa/BASin/BASin.exe"
#definekey application c exec x-terminal-emulator -T mc -e /usr/bin/mc
#definekey application e exec x-terminal-emulator -T Elinks -e /usr/bin/elinks
definekey application f fbreader
definekey application g gimp
#definekey application g exec gitk
#definekey application G exec git-gui
definekey application l libreoffice
#definekey application m exec amsn
#definekey application m exec amule
#definekey application o ooffice
#definekey application p exec pidgin
definekey application p exec mtpaint

# Run the LXDE Panel in its own frame, just in case the keyboard could fail:
#definekey application p exec ratpoison_panel.sh
# The file contains:
#	  #!/bin/sh
#	  ratpoison -c "split -32" -c "focuslast"
#	  lxpanel &
#	  ratpoison -c "gravity south" -c "focuslast"
# Simpler method, without an external file:
#definekey application p exec ratpoison -c "exec lxpanel" -c "focuslast" -c "split -32" -c "exec lxpanel" -c "gravity south" -c "focuslast"
# It works, but the touch screen doesn't work fine anyway!

#definekey application q exec gqview
#definekey application u exec amule

# In ~/.xinitrc an alias is used to invoke screen,
# but it doesn't work here.
#definekey application s exec x-terminal-emulator -bg black -fg green -T screen -e /usr/bin/screen -D -R
#definekey application s exec x-terminal-emulator -bg gray20 -fg green -T screen -e /usr/bin/screen -D -R
#definekey application s exec x-terminal-emulator -fa monaco -fs 16 -bg black -fg green -T screen -e /usr/bin/screen -D -R
definekey application s screen

#definekey application t exec x-terminal-emulator -bg black -fg green -T terminal

definekey application v exec gvim
#definekey application w exec wicd-client -n

###############################################################
# keymap for web browsers

newkmap browser
bind n readkey browser

#definekey browser a exec arora
definekey browser D exec dillo
definekey browser f exec firefox
#definekey browser c exec google-chrome
#definekey application m exec ~/bin/midori.sh
definekey browser m exec midori
#definekey browser o exec opera
#definekey browser u exec uzbl --config ~/.uzbl/config
#definekey browser u exec uzbl-browser --config ~/.uzbl/config
#definekey browser u exec uzbl-tabbed --config ~/.uzbl/config
#definekey browser u exec uzbl-browser
#definekey browser U exec uzbl-tabbed
definekey browser v exec vimprobable2
definekey browser d exec dwb
definekey browser q exec qupzilla