Fichero de configuración de Ratpoison

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.

En otros artículos abundaré en Ratpoison; y escribiré también sobre screen, el compañero ideal (y padre espiritual) de Ratpoison, otro de mis programas de uso cotidiano.

Más información sobre Ratpoison

~/.ratpoisonrc

Y, por fin, he aquí el motivo de esta página: mi fichero de configuración .ratpoisonrc:


# ~/.ratpoisonrc

# Ratpoison's config file
# by Marcos Cruz (programandala.net)

# 2009-05-03 Modified.
# 2009-06-19 Added alias zx app for fuse and ace for xace 0.5; added app key z for fuse.
# 2009-12-09 Modified some alias.
# 2010-03-03 Apart keymap for emulators.
# 2010-06-19 Added key for Google Chrome; added alias for SimCoupe (SAM Coupé's emulator).
# 2010-07-31 Added some alias for emulators.
# 2011-06-15 Added key bind for uzbl.
# 2011-06-15 Added keymap for documents with first bind for pv.odt.
# 2011-06-16 Added top padding for xbattbar.
# 2011-12-15 Different key bind for uzbl-tabbed and uzbl-browser.
# 2011-12-15 Support for groups.
# 2011-12-15 All keyboard maps are renamed with descriptive names (formerly the used their key as name).
# 2012-02-16 New bindings for accessing windows 10-15 with A-F.
# 2012-02-27 Added key for SpecBAS. Changed the key of BASin.
# 2012-03-03 Midori and Arora updated to the new compiled versions.
# 2012-03-04 Added key for Dillo.

###############################################################
# 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

###############################################################
# xbattbar

# 2011-06-16
# Dejar una zona de dos pixeles libres en la parte superior de la pantalla:
set padding 0 2 0 0
# (izq, arr, der, aba)
# ...para que los use la barra de xbattbar.
# Así evitamos que la barra se borre al cambiar de ventana,
# y que coincida con la posición del puntero cuando este
# es «desterrado» a la esquina inferior derecha de la pantalla
# (porque entonces xbattbar muestra una incómoda ventana con el estado de la batería).

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

unbind a
unbind A
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
bind C-l redisplay
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
#bind w exec ~/bin/ratpoison_windows.sh
bind w windows
unbind W
unbind C-w

# bind C-apostrophe # buggy?
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

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

###############################################################
# 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



###############################################################
# keymap for frame

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 applications

newkmap application
bind a readkey application

#definekey application a exec amsn
definekey application a exec arora
#definekey application a exec ~/opt/arora/arora
#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 c exec google-chrome
definekey application d exec dillo
#definekey application e exec x-terminal-emulator -T Elinks -e /usr/bin/elinks
definekey application f exec firefox
definekey application g exec gimp
definekey application l exec libreoffice
#definekey application m exec amsn
#definekey application m exec amule
#definekey application m exec ~/bin/midori.sh
definekey application m exec midori
definekey application o exec opera
definekey application p exec pidgin 
definekey application q exec gqview
definekey application u exec amule

# Esta versión:
#definekey application s exec x-terminal-emulator -bg black -fg green -T screen -e /usr/bin/screen -D -R
# La sustituí por un alias, usado también en ~/.xinitrc:
#definekey application s exec xs
# Pero el alias no funciona. Lo dejo igual:
#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 -fs Huge -bg black -fg green -T screen -e /usr/bin/screen -D -R

#definekey application t exec x-terminal-emulator -bg black -fg green -T terminal
#definekey application u exec uzbl --config ~/.uzbl/config
#definekey application u exec uzbl-browser --config ~/.uzbl/config
#definekey application u exec uzbl-tabbed --config ~/.uzbl/config
definekey application u exec uzbl-browser
definekey application U exec uzbl-tabbed 
definekey application v exec gvim
definekey application w exec wicd-client -n

###############################################################
# keymap for documents

newkmap document
bind d readkey document

definekey document p exec libreoffice -writer ~/doc/pv.odt
definekey document d exec libreoffice -writer ~/doc/d.odt
definekey document c exec libreoffice -writer ~/doc/c.ods

###############################################################
# keymap for emulators

newkmap emulator
bind e readkey emulator

# Jupiter Ace:
definekey emulator j exec x-terminal-emulator -T xace -e ~/bin/xace.sh

# SAM Coupé:
definekey emulator s exec /opt/SimCoupe-1.0/simcoupe &

# ZX Spectrum:
definekey emulator b exec ~/bin/specbas &
definekey emulator B exec /usr/bin/wine ~/.wine/drive_c/Archivos_de_programa/BASin/BASin.exe &
definekey emulator f exec /usr/bin/fbzx &
definekey emulator z exec /usr/bin/fuse &

# QL:
definekey emulator Q exec wine ~/.wine/drive_c/Archivos_de_programa/QPC2/QPC2.EXE &
definekey emulator q exec wine ~/.wine/drive_c/Archivos_de_programa/QPC2/QPC2.EXE -os ~/.wine/drive_c/Archivos_de_programa/QPC2/SMSQE_800X480.BIN &
definekey emulator l exec wine ~/.wine/drive_c/Archivos_de_programa/Q-emuLator/QemuLator.exe &
#definekey emulator q exec wine ~/.wine/drive_c/Archivos_de_programa/QPC2/QPC2.EXE -os ~/.wine/drive_c/Archivos_de_programa/QPC2/smsqe_800x480.bin &
#definekey emulator Q exec wine ~/.wine/drive_c/Archivos_de_programa/QPC2/QPC2.EXE -os ~/.wine/drive_c/Archivos_de_programa/QPC2/smsqe_1024x768.bin &
definekey emulator u exec /opt/uqlx/bin/qmin -g 800x480 -b '10 lrun win1_boot_uqlx_bas'
definekey emulator U exec /opt/uqlx/bin/qmin -g 1024x768 -b '10 lrun win1_boot_uqlx_bas'
definekey emulator 2 exec ~/bin/ql2k.sh

# EPOC:
definekey emulator e exec ~/bin/epoc_emulator.sh sys_ratpoison_800x480

###############################################################
# alias for emulators

alias ace exec x-terminal-emulator -T xAce -e ~/bin/xace.sh
alias basin exec /usr/bin/wine ~/.wine/drive_c/Archivos_de_programa/BASin/BASin.exe
alias uqlx800 exec /opt/uqlx/bin/qmin -g 800x480 -b '10 lrun win1_boot_uqlx_bas'
alias uqlx1024 exec /opt/uqlx/bin/qmin -g 1024x768 -b '10 lrun win1_boot_uqlx_bas'
alias qpc exec wine ~/.wine/drive_c/Archivos_de_programa/QPC2/QPC2.EXE &
alias qpc800 exec wine ~/.wine/drive_c/Archivos_de_programa/QPC2/QPC2.EXE -os ~/.wine/drive_c/Archivos_de_programa/QPC2/SMSQE_800X480.BIN &
#alias qpc1024 exec wine ~/.wine/drive_c/Archivos_de_programa/QPC2/QPC2.EXE -os ~/.wine/drive_c/Archivos_de_programa/QPC2/smsqe_1024x768.bin &
alias sam exec /opt/SimCoupe-1.0/simcoupe &
alias zx exec x-terminal-emulator -T fuse -e /usr/bin/fuse

###############################################################
# alias for applications

alias amu exec amule
alias amule exec amule
alias ams exec amsn
alias amsn exec amsn
alias aw exec abiword
alias el exec x-terminal-emulator -T Elinks -e /usr/bin/elinks
alias elinks exec x-terminal-emulator -T Elinks -e /usr/bin/elinks
alias ff exec firefox
alias ftp exec x-terminal-emulator -T lftp -e /usr/bin/lftp
#alias fz exec filezilla
alias gi exec gimp
alias gimp exec gimp
alias gn exec gnumeric
alias gnumeric exec gnumeric
alias gt exec gtimer
alias gtimer exec gtimer
alias gv exec gv
alias gvi exec gvim
alias gvim exec gvim
alias iw exec firefox
alias lf exec x-terminal-emulator -T lftp -e /usr/bin/lftp
alias lftp exec x-terminal-emulator -T lftp -e /usr/bin/lftp
alias lp exec leafpad
alias mc exec x-terminal-emulator -T mc -e /usr/bin/mc
#alias oow exec oowriter
#alias ooc exec oocalc
#alias ooi exec ooimpress
#alias oob exec oobase
#alias ood exec oodraw
alias op exec opera -nomail
alias opera exec opera -nomail
alias qv  exec gqview
#alias vi exec x-terminal-emulator -T Vim -e /usr/bin/vim
#alias vim exec x-terminal-emulator -T Vim -e /usr/bin/vim
alias vi exec gvim
alias vim exec gvim
alias xp exec xpdf
alias xpdf exec xpdf
#alias wicd exec /opt/wicd/gui.py
alias wicd exec wicd-client -n
#alias win exec x-terminal-emulator -T Windows -e ~/bin/titan.sh
#alias titan exec x-terminal-emulator -T Windows -e ~/bin/titan.sh
#alias ya exec x-terminal-emulator -T yafc -e /usr/bin/yafc
#alias yafc exec x-terminal-emulator -T yafc -e /usr/bin/yafc

###############################################################
# Doc

# Reference:
# http://noone.org/blog/English/Computer/X/How%20to%20get%20Network%20Manager%20working%20with%20ratpoison.html