.ratpoisonrc - The Breakdown of a Config File


by hootiegibbon


## This article is presented  in a way that allows you to directly use it as .ratpoisonrc it contains

## a few extra details and options not present in my current published ratpoisonrc

##  OK, so you have decided to download my RatPoison remaster of PCLinuxOS here

##  http://cozmodesigns.co.uk/jase/files/

##  You know that the 'EK' or EscapeKey is Control_R or the "notsign" (¬) and that some

##  keyboard combinations do some cool things on screen

##  You are also aware that this remaster is based on my personal setup of ratpoison and the

##  way I like it - you may not like it all or want to make it yours whether that means you want

##  different default apps or a different key combination that matches your needs.

##  I thought it may be nice to breakdown the ratpoisonrc file on a line by line basis and

## discuss/explain/waffle about each section of the configuration file and offer some potential

##  alternatives

##  ok so the first line looks like this:

#####start

#exec conky

## To many, this will be obvious as being a commented out command to launch (ie start up)

## conky, which is a hugely configurable monitoring application (worthy of an article of its own)
## I have left this commented as I like to invoke it only as required; in fact while writing this
## it seems to be a good candidate for a keybinding to turn it on and one to turn it off)

## Let’s add a conky on/off keybinding
## to turn it on requires the selection of an unbound key I will choose the #/~ key
## let’s launch it with EK and then # and turn it off (kill it) with ~
## you need to know the actual name of those two symbols, fortunately ratpoison makes this easy
## by using the message system (in the right top corner of the ratpoison wm) try pressing EK
## ie Control_R then the # in the right hand corner its name appears - and states it’s unbound
## do the same with ~
## the two names should be "numbersign" and "asciitilde" so now we can bind those two keys to
## two commands - one to launch conky (exec) and another to kill the process (killall) the lines
## will look like this
   
bind numbersign exec conky
bind asciitilde exec killall conky

## conky-on/conky-off, not so difficult eh? ratpoison really does make it as simple as possible

##  to add custom keybindings  

## OK, back to the subject matter
## the following lines set up some command chains to a key, in this case it set up various split

## screen formats with up to 4 usable windows to manually switch between.
## the echo lines appear in the top right-hand corner of the ratpoison screen.

bind F1 exec ratpoison -c "select -" -c "only" -c "next" -c "echo Fullscreen!"
bind F2 exec ratpoison -c "select -" -c "only" -c "vsplit" -c "next" -c "echo Layout 1"
bind F3 exec ratpoison -c "select -" -c "only" -c "hsplit" -c "next" -c "echo Layout 2"
bind F4 exec ratpoison -c "select -" -c "only" -c "hsplit" -c "next" -c "focusright" -c "next" -c "vsplit" -c "next" -c "focusleft" -c "resize 200 -40" -c "next" -c "echo Layout 3"
bind F5 exec ratpoison -c "select -" -c "only" -c "vsplit" -c "next" -c "hsplit" -c "next" -c "focusdown" -c "hsplit" -c "next" -c "echo Layout 4"
bind F6 exec ratpoison -c "select -" -c "only" -c "vsplit" -c "next" -c "focusdown" -c "hsplit" -c "next" -c "echo Layout 5"

## Workspaces stuff, the following line sets up 10 virtual work spaces which uses Alt + F1-F10

##  to switch between them

exec rpws init 10 -k

## This following line is what changes the EK from the default C-t combination


escape notsign

## having changed the EK lets make it more user friendly (at this point you can hear the

## hard-core ratpoison users scream)
## this will change the behavior of ratpoison to use a single control key instead of the

## combination of the ctrl-t.
## The control key set by this string is the "right control" key on the right side of keyboards, it will

## also mean you can use the notsign key as an alternate.

definekey top Control_R readkey root
definekey root Control_R link notsign

## now I want to be sure that the default is completely removed so we unbind the key combo
## this stops this key combo taking preference over opening a new tab in xxxterm or other apps


unbind C-t

## ok, I killed the default welcome message with this line I have yet to learn how to replace it
startup_message off
## perhaps this can be done with the use of an unbound echo command that will execute at startup..

exec ratpoison -c "echo Greetings and Salutations $USER"

## works for me!

##Use the app name rather than title in the window list


defwinname name

##app groups? let me know if you figure out app groups, as I am not clear on the matter..

#gnewbg one
#gnewbg two
#gnewbg three

## Moving on....
## here are a couple of cool keybindings
## the first allows you to copy any url from the screen to the clipboard and then go to the site by using EK then g

#copy & paste selected highlighted links into browser

bind g exec xxxterm -n `$RATPOISON -c getsel`

## even better this next one will paste any copied text into a search engine

## (it’s a good secure search engine Andy, so relax)

## search for highlighted by using copy and then EK  \ to paste that directly into a search engine

bind backslash exec xxxterm -e "tabnew https://startpage.com/do/metasearch.pl?query=`$RATPOISON -c getsel`"


## I prefer smaller fonts for information stuff if you want a bigger font change this to 11 or 12

set font fixed-8

## sets how each application is named in the winlist (EK then w) choices are title | name | class  

set winname name

## ok this is the fomat of how the winlist entries are shown options are
#            %a by the application name (resource name),
#              %c by the resource class,
#              %f by the frame number,
#              %g by the gravity of the window,
#              %h by the height of the window,
#              %H by the unit to resize the window vertically (height_inc)
#              %i by the X Window ID,
#              %p by the process ID,
#              %l by the last access number,
#              %M by the string Maxsize, if it specifies a maximum size,
#              %n by the window number,
#              %s by window status (* is active window, + would be chosen by other, - otherwise)
#              %S by the screen number
#              %t by the window name (see set winname),
#              %T by the string Transient, if it is a transient window
#              %w by the width of the window
#              %W by the unit to resize the window horizontally (width_inc)
#              %x by the xine screen number and
#              %% by a single %
# the default is

set winfmt %n %s %t

## the winlist can be shown as a column or a row

set winliststyle column

##  wingravity nw|w|sw|n|c|s|ne|e|se
##              Set the default gravity new normal windows will get.  
##              Possible values are the same as in the gravity command,
##              which changes the gravity of an existing window: cardinal points or numbers 1 to 9. northwest.

set wingravity center

##transgravity nw|w|sw|n|c|s|ne|e|se
##              Set the default gravity new transient windows will get.  
##              Possible values are the same as in the gravity command,
##       which changes the gravity of an existing window: cardinal points or numbers 1 to 9.


set transgravity center

## maxsizegravity nw|w|sw|n|c|s|ne|e|se
##              Set the default gravity new self-maximised windows will get.  
##              Possible values are the same as in the gravity command,
##              which changes the gravity of an existing window: cardinal points or numbers 1 to 9.


set maxsizegravity c

#this next one gives enough room for my conky script to fit in (takes up the top 12pixels of the screen)
## just to explain that the numbers represent the 4 sides of your screen LEFT | TOP | RIGHT | BOTTOM

set padding 0 12 0 0

## This sets the border around each window

set border 1

## this sets the border that the command/messsage box gets

set barborder 0

## and the padding around it

set barpadding 4 4

## and where on screen it appears options are nw|w|sw|n|c|s|ne|e|se

set bargravity ne

## the width of the command bar

set inputwidth 350

## these set the basic backgrond and forgound colors

set fgcolor grey
set bgcolor #090909
set fwcolor grey
set bwcolor #343434
set waitcursor 3

##This keeps a list of the session commands and undos (undo is EK then u)

set historysize 50
set maxundos 50

# still not got the grip of this next one

rudeness 12

## Let’s set up some handy keybindingd  to show the date and as an example the acpi detail

bind a exec ratpoison -c "echo `date '+%A %d %B, %Y %R'`"
bind B exec ratpoison -c "echo `acpi -V | sed 's/     //g'`"
bind c exec sakura

## this is the alternative terminal (the reverse is ro reverse teh forgound background as I dislike lightterminals

bind C-c exec vte --reverse

#pointerstuff = this sets a cursor arrow instead of the crosshairs

exec xsetroot -cursor_name left_ptr

#alias keys within ratpoison

## bind semicolon (EK then ;) to launch a ratpoison command.

bind semicolon colon

## and execute a command via the colon (EK then :)

bind colon exec

## group moving still don’t quite get groups - let me know...
#bind greater gnext
#bind less gprev

#following to automate the use of tmpwm however I found that using this method ties up my terminals afterwards
## if you can’t use terminals or have less than 192ram this may be the most effective way to use floating apps
## like gimp and skype


bind C-M-space exec ratpoison -c "tmpwm icewm-light" -c "echo returning you to ratpoison"

## so as a work around I suggest using the following line whch will open up a new Xserver on ctrl+alt+F9
## the keybinding for this is EK then Crontrol+Alt+Insert - this should work smoothly with 192 megs or more


bind C-M-Insert exec startx /home/$USER/.xserver2instruct -- :1

#the following do not need the escapekey to action C=Control s=mod4 S=Shift M=Alt
#the following sets up the winkey (mod4) as a launch modifier as an alternate to the defaults not using the winkey.

#definekey top s-Print exec scrot ~/Pictures/screenshots/'%Y-%m-%d--%H:%M:%S--$wx$h.png'
#definekey top s-x exec xlock
#definekey top s-F1 exec /usr/bin/xxxterm
#definekey top s-F2 exec sakura -e alpine
#definekey top s-F3 exec sakura -e weechat-curses
#definekey top s-F4 exec xnview
#definekey top s-F5 exec pcmanfm
#definekey top s-F6 exec leafpad
#definekey top s-F7 exec pcc
#definekey top s-F8 exec gksu dbus-launch /usr/sbin/synaptic
#definekey top s-F9 exec Ted
#definekey top S-s-Return exec sakura
#definekey top s-r exec dmenu_run
#definekey top s-Escape delete
#definekey top s-XF86Back prev
#definekey top s-XF86Forward next


#
#if you do not have a winkey then don’t worry as the following to use a mix of the ctrl and the alt keys
#
#control &Fkeys used to prevent issues with workspaces

definekey top C-F1 exec /usr/bin/xxxterm
definekey top C-F2 exec sakura -t alpine -e alpine
definekey top C-F3 exec sakura -t weechat -e weechat-curses
definekey top C-F4 exec xnview
definekey top C-F5 exec pcmanfm
definekey top C-F6 exec leafpad
definekey top C-F7 exec pcc
definekey top C-F8 exec gksu dbus-launch /usr/sbin/synaptic
definekey top C-F9 exec Ted

definekey top M-Print exec scrot ~/Pictures/screenshots/'%Y-%m-%d--%H:%M:%S--$wx$h.png'
definekey top M-x exec xlock
definekey top M-Return exec sakura -t Terminal
definekey top M-r exec dmenu_run
definekey top M-Escape delete
definekey top M-XF86Back prev
definekey top M-XF86Forward next


### OK, that’s this config file. I hope that this conversational config file has been of interest
### if it has I may cover further configuration files in future articles
### Please keep the next line intact if you copy paste this file
### .ratpoisonrc by hootiegibbon for the PCLinuxOS Magazine