Difference between revisions of "Ratpoison"

From ArchWiki
Jump to: navigation, search
(Wallpaper and Transparency: Adding a link to xcompmgr)
m (Style)
Line 1: Line 1:
 
[[Category:Tiling WMs]]
 
[[Category:Tiling WMs]]
 
[[uk:Ratpoison]]
 
[[uk:Ratpoison]]
'''Ratpoison''' is a minimalistic [[window manager]] which can be controlled 100% through keyboard. It behaves like the terminal-multiplexer GNU screen. Every window is maximized to fit the whole screen, no pixel is wasted on stuff like borders or other decoration. The user can also "split" the screen into two or more frames in order to display more than one window at the time. For more information check the official homepage at http://www.nongnu.org/ratpoison/.
 
  
==Installation==
+
From the project [http://www.nongnu.org/ratpoison/ home page]:
 +
: ''Ratpoison is a simple [[Window Manager]] with no fat library dependencies, no fancy graphics, no window decorations, and no rodent dependence. It is largely modelled after [[GNU Screen]] which has done wonders in the virtual terminal market. The screen can be split into non-overlapping frames. All windows are kept maximized inside their frames to take full advantage of your precious screen real estate. All interaction with the window manager is done through keystrokes. ratpoison has a prefix map to minimize the key clobbering that cripples Emacs and other quality pieces of software.''
 +
 
 +
== Installation ==
 +
 
 
Ratpoison can be installed with package {{Pkg|ratpoison}}, available in [[official repositories]].
 
Ratpoison can be installed with package {{Pkg|ratpoison}}, available in [[official repositories]].
  
==Configuration==
+
== Configuration ==
 +
 
 
To use ratpoison as your windowmanager, you have to create/edit the file {{Ic|~/.xinitrc}}.
 
To use ratpoison as your windowmanager, you have to create/edit the file {{Ic|~/.xinitrc}}.
  
 
Example .xinitrc:
 
Example .xinitrc:
# the black/white grid as background doesn't suit my taste.
+
{{bc|<nowiki>
xsetroot -solid black &
+
# the black/white grid as background doesn't suit my taste.
# ratpoison is compatible with xcompmgr! now you can have real transparency
+
xsetroot -solid black &
xcompmgr -c -f -D 5 &
+
# ratpoison is compatible with xcompmgr! now you can have real transparency
#fire up ratpoison!
+
xcompmgr -c -f -D 5 &
exec /usr/bin/ratpoison
+
#fire up ratpoison!
 +
exec /usr/bin/ratpoison
 +
</nowiki>}}
  
==Using ratpoison==
+
== Using ratpoison ==
After X11 starts up you will see a black screen and a little textbox on the upper right of it that says "Welcome to Ratpoison" :)
+
 
Now type {{Keypress|Ctrl+t}} and then {{Ic|?}} to get a list of keybindings. If you are used to GNU screen, you will feel at home very soon.
+
After X11 starts up you will see a black screen and a little textbox on the upper right of it that says "Welcome to Ratpoison".
 +
Now type {{ic|Ctrl+t}} and then {iIc|?}} to get a list of keybindings. If you are used to GNU screen, you will feel at home very soon.
  
 
You are able to define custom keystrokes and even override existing ones in {{Ic|~/.ratpoisonrc}}
 
You are able to define custom keystrokes and even override existing ones in {{Ic|~/.ratpoisonrc}}
  
 
Example:
 
Example:
# overriding CTRL+t 'c' to start aterm instead of xterm
+
{{bc|<nowiki>
bind c exec aterm
+
# overriding CTRL+t 'c' to start aterm instead of xterm
 +
bind c exec aterm
  
bind f exec firefox
+
bind f exec firefox
 +
</nowiki>}}
  
So, if you type {{Keypress|Ctrl+t}} and then {{Keypress|f}}, ratpoison will fire up firefox.
+
So, if you type {{ic|Ctrl+t}} and then {{ic|f}}, ratpoison will fire up Firefox.
  
Here is another .ratpoisonrc i'm using on my Computers:
+
Here is another .ratpoisonrc i'm using on my computers:
  
exec xsetroot -cursor_name left_ptr
+
{{bc|<nowiki>
startup_message off
+
exec xsetroot -cursor_name left_ptr
+
startup_message off
escape C-z
+
+
# make a screenshot
+
alias sshot exec import -window root ~/screenshot-`date +%F`.jpg
+
definekey top M-C-Print sshot
+
+
#virtual desks
+
gnewbg one
+
gnewbg two
+
+
definekey top M-l exec ratpoison -c "select -" -c "gprev" -c "next"
+
definekey top M-h exec ratpoison -c "select -" -c "gnext" -c "next"
+
+
#switch between windows
+
definekey top M-j next
+
definekey top M-k prev
+
+
#apps
+
unbind c
+
bind c exec urxvt -tr
+
#bind c exec aterm
+
+
bind g exec gftp
+
bind f exec firefox2
+
  
==Tips and tricks==
+
escape C-z
 +
 
 +
# make a screenshot
 +
alias sshot exec import -window root ~/screenshot-$(date +%F).jpg
 +
definekey top M-C-Print sshot
 +
 
 +
#virtual desks
 +
gnewbg one
 +
gnewbg two
 +
 
 +
definekey top M-l exec ratpoison -c "select -" -c "gprev" -c "next"
 +
definekey top M-h exec ratpoison -c "select -" -c "gnext" -c "next"
 +
 
 +
#switch between windows
 +
definekey top M-j next
 +
definekey top M-k prev
 +
 
 +
#apps
 +
unbind c
 +
bind c exec urxvt -tr
 +
#bind c exec aterm
 +
 
 +
bind g exec gftp
 +
bind f exec firefox
 +
</nowiki>}}
 +
 
 +
== Tips and tricks ==
 +
 
 +
=== Multiple workspaces ===
  
===Multiple workspaces===
 
 
By default, ratpoison only has one workspace, but using a script called rpws (installed by default) you can have more.
 
By default, ratpoison only has one workspace, but using a script called rpws (installed by default) you can have more.
  
Line 71: Line 83:
 
exec /usr/bin/rpws init 6 -k
 
exec /usr/bin/rpws init 6 -k
 
}}
 
}}
That creates 6 workspaces. By default, you can access to them by using {{Keypress|Alt+F1}} to access the first, {{Keypress|Alt+F2}} to access the second, etc.
+
That creates 6 workspaces. By default, you can access to them by using {{ic|Alt+F1}} to access the first, {{ic|Alt+F2}} to access the second, etc.
  
 
You can also add binds to them, like this:
 
You can also add binds to them, like this:
+
 
 
  bind C-1 exec rpws 1
 
  bind C-1 exec rpws 1
 
  bind C-2 exec rpws 2
 
  bind C-2 exec rpws 2
 
  ...
 
  ...
That allows to access them with {{Keypress|Ctrl+t}} {{Keypress|Ctrl+1}} (assuming {{Keypress|Ctrl+t}} as your escape key)
+
That allows to access them with {{ic|Ctrl+t}} {{ic|Ctrl+1}} (assuming {{ic|Ctrl+t}} as your escape key)
 +
 
 +
=== urxvt and xterm ===
  
===urxvt and xterm===
 
 
Urxvt and xterm would not resize to a fixed number of pixels. Instead, it resize itself to multiples of its font's size, therefore, chances that there are unfilled gaps are high.
 
Urxvt and xterm would not resize to a fixed number of pixels. Instead, it resize itself to multiples of its font's size, therefore, chances that there are unfilled gaps are high.
 
To correct this, we can use the xterm/urxvt option internalBorder and set the border of ratpoison to 0.  
 
To correct this, we can use the xterm/urxvt option internalBorder and set the border of ratpoison to 0.  
Line 94: Line 107:
 
If a combination cannot be found, you could try changing the font size and the font family also. (that changes the required border number)
 
If a combination cannot be found, you could try changing the font size and the font family also. (that changes the required border number)
  
 +
=== Launch on startup ===
  
===Launch on Startup===
+
Examples for launching programs when ratpoison starts. File {{ic|~/.ratpoisonrc}} is executed by ratpoison on startup.
Examples for launching programs when ratpoison starts. File {{ic|~/.ratpoisonrc}} is executed by ratpoison on startup.
+
  
{{hc|Launch urxvt with a tmux session|<nowiki>exec urxvt -e bash -c "tmux -q has-session && exec tmux attach-session -d || exec tmux new-session -n$USER -s$USER@$HOSTNAME"</nowiki>}}
+
{{hc|Launch urxvt with a tmux session|<nowiki>
 +
exec urxvt -e bash -c "tmux -q has-session && exec tmux attach-session -d || exec tmux new-session -n$USER -s$USER@$HOSTNAME"
 +
</nowiki>}}
  
{{hc|Launch optimized chromium|<nowiki>exec bash -c 'pidof chromium &>/dev/null || exec /usr/bin/chromium --disk-cache-dir=~/tmp/cache'</nowiki>}}
+
{{hc|Launch optimized chromium|<nowiki>
 +
exec bash -c 'pidof chromium &>/dev/null || exec /usr/bin/chromium --disk-cache-dir=~/tmp/cache'
 +
</nowiki>}}
  
=== Wallpaper and Transparency ===
+
=== Wallpaper and transparency ===
  
Example for setting transparency using [[xcompmgr]] and nitrogen.  
+
Example for setting transparency using [[xcompmgr]] and nitrogen.
 
First start nitrogen and set the desired wallpaper. Then use this in your .ratpoisonrc
 
First start nitrogen and set the desired wallpaper. Then use this in your .ratpoisonrc
  
{{hc|Wallpaper and transparency|<nowiki>exec xcompmgr -c -f -D 5 &
+
{{hc|Wallpaper and transparency|<nowiki>
exec nitrogen --restore</nowiki>}}
+
exec xcompmgr -c -f -D 5 &
 +
exec nitrogen --restore</nowiki>
 +
}}
 +
 
 +
== Some more useful KeyCombos ==
 +
 
 +
{{ic|Ctrl+t}} {{ic|!}} <''Program Name''> Start any program
 +
 
 +
{{ic|Ctrl+t}} {{ic|q}} Quit ratpoison
 +
 
 +
{{ic|Ctrl+t}} {{ic|?}} Show key bindings
 +
 
 +
{{ic|Ctrl+t}} {{ic|c}} Start an X terminal
 +
 
 +
{{ic|Ctrl+t}} {{ic|n}} Switch to next window
 +
 
 +
{{ic|Ctrl+t}} {{ic|p}} Switch to previous window
 +
 
 +
{{ic|Ctrl+t}} {{ic|1}}-{{ic|9}} Switch to windows 1-9
 +
 
 +
{{ic|Ctrl+t}} {{ic|k}} Close the current window
 +
 
 +
{{ic|Ctrl+t}} {{ic|Schift+k}} XKill the current application
 +
 
 +
{{ic|Ctrl+t}} {{ic|s}},{{ic|Shift+s}} Split the current frame into two vertical,horizontal ones
 +
 
 +
{{ic|Ctrl+t}} {{ic|Tab}}, {{ic|&larr;}}, {{ic|&uarr;}}, {{ic|&rarr;}}, {{ic|&darr;}} Switch to the next, left. top, right, bottom frame.
 +
 
 +
{{ic|Ctrl+t}} {{ic|Shift+q}} Make the current frame the only one
 +
 
 +
{{ic|Ctrl+t}} {{ic|:}} Execute a ratpoison command
 +
 
 +
 
 +
== Ratpoison and display managers ==
  
==Some more useful KeyCombos==
+
Many [[display manager|display managers]] (e.g., [[lightdm]]) source the available sessions from {{ic|/usr/share/xsessions/}} and most window managers and desktop environments create .desktop files there. However ratpoison instead creates a {{ic|ratpoison.desktop}} file in {{ic|/etc/X11/sessions/}}. To allow display managers to find ratpoison one may need to copy the ratpoison.desktop file from {{ic|/etc/X11/sessions/ratpoison.desktop}} to {{ic|/usr/share/xsessions/ratpoison.desktop}}. If the {{ic|/usr/share/xsessions}} directory does not exist, create it as root.
{{Keypress|Ctrl+t}} {{Keypress|!}} <''Program Name''> Start any program<br />
+
{{Keypress|Ctrl+t}} {{Keypress|q}} Quit ratpoison<br />                 
+
{{Keypress|Ctrl+t}} {{Keypress|?}} Show key bindings<br />
+
{{Keypress|Ctrl+t}} {{Keypress|c}} Start an X terminal<br />
+
{{Keypress|Ctrl+t}} {{Keypress|n}} Switch to next window<br />
+
{{Keypress|Ctrl+t}} {{Keypress|p}} Switch to previous window<br />
+
{{Keypress|Ctrl+t}} {{Keypress|1}}-{{Keypress|9}} Switch to windows 1-9<br />
+
{{Keypress|Ctrl+t}} {{Keypress|k}} Close the current window<br />
+
{{Keypress|Ctrl+t}} {{Keypress|Shift+k}} XKill the current application<br />
+
{{Keypress|Ctrl+t}} {{Keypress|s}},{{Keypress|Shift+s}} Split the current frame into two vertical,horizontal ones<br />
+
{{Keypress|Ctrl+t}} {{Keypress|Tab}}, {{Keypress|&larr;}}, {{Keypress|&uarr;}}, {{Keypress|&rarr;}}, {{Keypress|&darr;}} Switch to the next, left. top, right, bottom frame.<br />
+
{{Keypress|Ctrl+t}} {{Keypress|Shift+q}} Make the current frame the only one<br />
+
{{Keypress|Ctrl+t}} {{Keypress|:}} Execute a ratpoison command<br />
+
  
==Ratpoison and display managers==
+
== See also ==
Many [[display manager|display managers]] (e.g., [[lightdm]]) source the available sessions from /usr/share/xsessions/ and most window managers and desktop environments create .desktop files there. However ratpoison instead creates a ratpoison.desktop file in /etc/X11/sessions/. To allow display managers to find ratpoison one may need to copy the ratpoison.desktop file from /etc/X11/sessions/ratpoison.desktop to /usr/share/xsessions/ratpoison.desktop. If the /usr/share/xsessions directory does not exist, create it as root.
+
  
==See also==
+
* [http://ratpoison.wxcvbn.org/ The Ratpoison wiki]
* [http://ratpoison.wxcvbn.org/ The Ratpoison Wiki]
+
 
* [http://stumpwm.svkt.org/cgi-bin/ratpoison.pl?action=browse;id=keys X11 Keys in Ratpoison]
 
* [http://stumpwm.svkt.org/cgi-bin/ratpoison.pl?action=browse;id=keys X11 Keys in Ratpoison]
 
* [http://www.ormiret.com/?q=node/11 Ratpoison config sample]
 
* [http://www.ormiret.com/?q=node/11 Ratpoison config sample]

Revision as of 21:40, 27 June 2013


From the project home page:

Ratpoison is a simple Window Manager with no fat library dependencies, no fancy graphics, no window decorations, and no rodent dependence. It is largely modelled after GNU Screen which has done wonders in the virtual terminal market. The screen can be split into non-overlapping frames. All windows are kept maximized inside their frames to take full advantage of your precious screen real estate. All interaction with the window manager is done through keystrokes. ratpoison has a prefix map to minimize the key clobbering that cripples Emacs and other quality pieces of software.

Installation

Ratpoison can be installed with package ratpoison, available in official repositories.

Configuration

To use ratpoison as your windowmanager, you have to create/edit the file ~/.xinitrc.

Example .xinitrc:

# the black/white grid as background doesn't suit my taste.
xsetroot -solid black &
# ratpoison is compatible with xcompmgr! now you can have real transparency
xcompmgr -c -f -D 5 &
#fire up ratpoison!
exec /usr/bin/ratpoison

Using ratpoison

After X11 starts up you will see a black screen and a little textbox on the upper right of it that says "Welcome to Ratpoison". Now type Ctrl+t and then {iIc|?}} to get a list of keybindings. If you are used to GNU screen, you will feel at home very soon.

You are able to define custom keystrokes and even override existing ones in ~/.ratpoisonrc

Example:

# overriding CTRL+t 'c' to start aterm instead of xterm
bind c exec aterm

bind f exec firefox

So, if you type Ctrl+t and then f, ratpoison will fire up Firefox.

Here is another .ratpoisonrc i'm using on my computers:

exec xsetroot -cursor_name left_ptr
startup_message off

escape C-z

# make a screenshot
alias sshot exec import -window root ~/screenshot-$(date +%F).jpg
definekey top M-C-Print sshot

#virtual desks
gnewbg one
gnewbg two

definekey top M-l exec ratpoison -c "select -" -c "gprev" -c "next"
definekey top M-h exec ratpoison -c "select -" -c "gnext" -c "next"

#switch between windows
definekey top M-j next
definekey top M-k prev

#apps
unbind c
bind c exec urxvt -tr
#bind c exec aterm

bind g exec gftp
bind f exec firefox

Tips and tricks

Multiple workspaces

By default, ratpoison only has one workspace, but using a script called rpws (installed by default) you can have more.

Just edit your .ratpoisonrc, and add:

~/.ratpoisonrc
exec rpws -i
exec /usr/bin/rpws init 6 -k

That creates 6 workspaces. By default, you can access to them by using Alt+F1 to access the first, Alt+F2 to access the second, etc.

You can also add binds to them, like this:

bind C-1 exec rpws 1
bind C-2 exec rpws 2
...

That allows to access them with Ctrl+t Ctrl+1 (assuming Ctrl+t as your escape key)

urxvt and xterm

Urxvt and xterm would not resize to a fixed number of pixels. Instead, it resize itself to multiples of its font's size, therefore, chances that there are unfilled gaps are high. To correct this, we can use the xterm/urxvt option internalBorder and set the border of ratpoison to 0.

A trial and error process must be done to find the exact number of internalBorder for each combination of resolution and font size. (the border of ratpoison must be set to 0 before doing the tests) The term command line option -b can be used to test for the correct number and then can be saved on the following files.

~/.Xresources
urxvt*internalBorder: 8 #change urxvt to xterm if necessary. Using the font terminus in urxvt at 14px size, 8 is the correct number here.
~/.ratpoisonrc
set border 0

If a combination cannot be found, you could try changing the font size and the font family also. (that changes the required border number)

Launch on startup

Examples for launching programs when ratpoison starts. File ~/.ratpoisonrc is executed by ratpoison on startup.

Launch urxvt with a tmux session
exec urxvt -e bash -c "tmux -q has-session && exec tmux attach-session -d || exec tmux new-session -n$USER -s$USER@$HOSTNAME"
Launch optimized chromium
exec bash -c 'pidof chromium &>/dev/null || exec /usr/bin/chromium --disk-cache-dir=~/tmp/cache'

Wallpaper and transparency

Example for setting transparency using xcompmgr and nitrogen. First start nitrogen and set the desired wallpaper. Then use this in your .ratpoisonrc

Wallpaper and transparency
exec xcompmgr -c -f -D 5 &
exec nitrogen --restore

Some more useful KeyCombos

Ctrl+t ! <Program Name> Start any program

Ctrl+t q Quit ratpoison

Ctrl+t ? Show key bindings

Ctrl+t c Start an X terminal

Ctrl+t n Switch to next window

Ctrl+t p Switch to previous window

Ctrl+t 1-9 Switch to windows 1-9

Ctrl+t k Close the current window

Ctrl+t Schift+k XKill the current application

Ctrl+t s,Shift+s Split the current frame into two vertical,horizontal ones

Ctrl+t Tab, , , , Switch to the next, left. top, right, bottom frame.

Ctrl+t Shift+q Make the current frame the only one

Ctrl+t : Execute a ratpoison command


Ratpoison and display managers

Many display managers (e.g., lightdm) source the available sessions from /usr/share/xsessions/ and most window managers and desktop environments create .desktop files there. However ratpoison instead creates a ratpoison.desktop file in /etc/X11/sessions/. To allow display managers to find ratpoison one may need to copy the ratpoison.desktop file from /etc/X11/sessions/ratpoison.desktop to /usr/share/xsessions/ratpoison.desktop. If the /usr/share/xsessions directory does not exist, create it as root.

See also