Rxvt-Unicode Configuration Tutorial
Contents
Introduction
This article is a tutorial covering basic configuration setups for the rxvt-unicode (urxvt) terminal.
In short, your plain urxvt terminal can change from this:
to this:
A user can enhance the look and performance of the terminal by setting environment variables and resources; these settings are controlled through existing and additional configuration files.
Features such as font and font size, transparency, tinting, scrollback buffer size, and scrollbar placement can be set by editing small plain text files.
This tutorial gives a brief description of the Rxvt-Unicode terminal, a basic terminal environment setup, and the creation of the .Xdefaults configuration file.
Description of the Rxvt-Unicode Terminal
Rxvt-Unicode is a terminal emulator for the X Window System. It is based-on rxvt version 2.7.11, and provides Unicode, pseudo-transparency, shading, tinting, backgrounds, embedded perl support, and many other options and features. Since version 8.3, it offers full support for AfterStep's libAfterImage library.
Rxvt-Unicode has replaced aterm as the preferred terminal emulator for the AfterStep window manager; it offers more features and makes no sacrifices in terms of performance.
For a complete feature list, downloads, and detailed documentation, visit the Rxvt-Unicode WEBSITE.
A note on aterm: Although aterm has served its demanding users very well, it has one shortcoming: aterm does not support Unicode.
The number-one requested feature submitted to the aterm development team has been for Unicode support. Implementing this support isn't practical, as much of the aterm code would need significant rewriting; the end product wouldn't offer the light, fast terminal that users expect.
aterm development has merged with rxvt-unicode; aterm is currently maintained, but future development work is targeted to rxvt-unicode.
Rxvt-Unicode and libAfterImage (libAI)
While not a requirement to run Rxvt-Unicode, libAfterImage adds additional features and performance; libAI support is enabled as default with the Rxvt-Unicode distribution.
Starting with Rxvt-Unicode version 8.3, libAfterImage (either as a stand-alone image manipulation library, or as a library provided by the AfterStep window manager) can be utilized for:
- pseudo-transparency
- loading background images
- blending images over the root background
- dynamic scaling
- background image bluring
Supported image formats include: BMP, GIF, ICO, JPG, PNG, SVG, TGA, TIFF, XPM, XCF, and AfterStep's XML image script.
libAfterImage version 1.15 (or AfterStep 2.2.7) or subsequent versions are required for use with Rxvt-Unicode. To view libAfterImage's features and documentation, or to download its source code, visit this WEBSITE. The AfterStep window manager can be found on this WEBSITE.
Basic Terminal Setup
Before configuring Rxvt-Unicode you need to setup some tools and environment variables.
A terminal visually benefits by having colored folders, files, and a command prompt; folders stand-out and are distinct from files and the prompt is readily visible. Open a terminal and type "ls -l", verifying that folders are colored differently than files. Check that the prompt is a distinct color. If you aren't seeing multiple colors, you will need to modify the ".bashrc" file.
To implement colored folders and command prompts, edit the ~/.bashrc ($HOME/.bashrc) file, located in the user's home folder.
Under the heading:
# User specific aliases and functions:
Add the following lines:
alias ls="ls -h --color=auto" export PS1='\[\033[01;32m\]\u@\h \[\033[00;31m\]\W \$ \[\033[00m\]'
The first line allows folders and specific files to be colored. The second line colors the prompt, with the format "name@host current-folder". In the second line, the colors are "01;32" and "00;31". Additional colors can be found in the following table:
0;30 Black 0;31 Red 0;32 Green 0;33 Brown 0;34 Blue 0;35 Purple 0;36 Cyan 0;37 Light Gray 1;30 Dark Gray 1;31 Light Red 1;32 Light Green 1;33 Yellow 1;34 Light Blue 1;35 Pink 1;36 Light Cyan 1;37 White
Close the terminal and reopen it. Use the "ls -l" command again. You should see a colored prompt and folders.
You will also need to set the language locale to use, and to tell your system that you are using a rxvt-based terminal.
Edit the ~/.bash_profile ($HOME/.bash_profile) file, adding the following lines under the heading:
# User specific environment and startup programs:
export LANG=en_US.UTF-8 export TERM=rxvt-unicode
.Xdefaults configuration file
Creating or modifying the .Xdefaults file is the final step in configuring Rxvt-Unicode. Once this file is edited and saved, all subsequent launchings of the Rxvt-Unicode terminal will contain the aforementioned settings.
The .Xdefaults file contains all of the terminal specific settings for Rxvt-Unicode. Xterm settings and other application settings can go in here as well. This .Xdefaults example shows data for urxvt; you can either append this data to an existing .Xdefaults file, or append additional information to this file.
The following settings are very basic, and should be enough to make the terminal functional and visually pleasing. For more settings, please read the urxvt man page or read the "Terminal Configuration" portion the the Rxvt-Unicode FAQ HERE.
Check to see if you already have an ~/.Xdefaults ($HOME/.Xdefaults) file in your home folder. Open it with a text editor if you do; otherwise, open a text editor and create it. To the ~/.Xdefaults file, add the following lines:
URxvt*transparent: true URxvt*tintColor: Blue #URxvt*shading: 40 URxvt*saveLines: 12000 URxvt*foreground: White URxvt*background: Blue #URxvt*font: xft:Bitstream Vera Sans Mono:pixelsize=12:antialias=true:hinting=true #URxvt*boldFont: xft:Bitstream Vera Sans Mono:bold:pixelsize=12:antialias=true:hinting=true URxvt*font: xft:DejaVu Sans Mono:pixelsize=12:antialias=true:hinting=true URxvt*boldFont: xft:DejaVu Sans Mono:bold:pixelsize=12:antialias=true:hinting=true #URxvt*font: xft:Liberation Mono:pixelsize=13:antialias=true:hinting=true #URxvt*boldFont: xft:Liberation Mono:bold:pixelsize=13:antialias=true:hinting=true #URxvt*font: xft:terminus:pixelsize=15 #URxvt*boldFont: xft:terminus:bold:pixelsize=15 #URxvt*font:-*-courier-medium-r-normal-*-14-*-*-*-*-*-iso8859-1 #URxvt*boldFont:-*-courier-bold-r-normal-*-14-*-*-*-*-*-iso8859-1 URxvt*color4: RoyalBlue URxvt*color12: RoyalBlue URxvt*scrollBar: true URxvt*scrollBar_right: false URxvt*scrollstyle: rxvt
Both the listing above and below are the same file functionally. The listing below simply has comments added for reference. Cut and paste either into ~/.Xdefaults.
# transparency - true or false (default) URxvt*transparent: true # tint with any color; i.e., blue, red, tomato4, olivedrab2, etc. # some nice listings are at: # http://www.nisrv.com/drupal/?q=node/11 # http://www.htmlgoodies.com/tutorials/colors/article.php/3478921 URxvt*tintColor: Blue # shading - 0 to 99 darkens, 101 to 200 lightens. # Don't use with tintColor; just use a darker or lighter color instead. #URxvt*shading: 40 # scrollback buffer lines - 65535 is max on most machines (64 is default) URxvt*saveLines: 12000 # font color (default is black) URxvt*foreground: White # background color (prior to tinting) (default is white) URxvt*background: Blue # Xft (X FreeType) with Bitstream, DejaVu, Liberation, or Terminus fonts: # Fedora/debian packages: libXft/libxft2 # An anti-aliased font setup with Xft looks fantastic; it can be a bit choppy # on older systems. You can always turn off anti-aliasing (antialias=false) if # your terminal is sluggish. Use only ONE of the Xft pairs below: # # Xft: Bitstream fonts # Fedora/debian packages: bitstream-vera-sans-mono-fonts/ttf-bitstream-vera #URxvt*font: xft:Bitstream Vera Sans Mono:pixelsize=12:antialias=true:hinting=true #URxvt*boldFont: xft:Bitstream Vera Sans Mono:bold:pixelsize=12:antialias=true:hinting=true # # Xft: DejaVu fonts # Fedora/debian packages: dejavu-sans-mono-fonts/ttf-dejavu URxvt*font: xft:DejaVu Sans Mono:pixelsize=12:antialias=true:hinting=true URxvt*boldFont: xft:DejaVu Sans Mono:bold:pixelsize=12:antialias=true:hinting=true # # Xft: Liberation fonts # Fedora/debian packages: liberation-mono-fonts/ttf-liberation #URxvt*font: xft:Liberation Mono:pixelsize=13:antialias=true:hinting=true #URxvt*boldFont: xft:Liberation Mono:bold:pixelsize=13:antialias=true:hinting=true # # Xft: Terminus fonts # Fedora/debian packages: terminus-fonts/xfonts-terminus #URxvt*font: xft:terminus:pixelsize=15 #URxvt*boldFont: xft:terminus:bold:pixelsize=15 # Traditional fonts - a more traditional font setup in lieu of xft #URxvt*font:-*-courier-medium-r-normal-*-14-*-*-*-*-*-iso8859-1 #URxvt*boldFont:-*-courier-bold-r-normal-*-14-*-*-*-*-*-iso8859-1 # Replace blue folder colors with a lighter shade for clarity. To # set colored folders and files within urxvt, xterm, and aterm, add # the following line to your ~/.bashrc ($HOME/.bashrc) file under # the heading "# User specific aliases and functions": # alias ls="ls -h --color=auto" URxvt*color4: RoyalBlue URxvt*color12: RoyalBlue # scrollbar - true (default) or false URxvt*scrollBar: true # scrollbar position - left=false (default) or right=true URxvt*scrollBar_right: false # scrollbar style - rxvt (default), plain, next, or xterm URxvt*scrollstyle: rxvt
Notes, Tips, and Hints
- You can't use the colors "white" or "black" as tinting colors; in terms of tinting they equal "none" and you'll get no tint.
- Tinting with gray(s) is equivalent to shading; use the Shading option instead.
- Don't use tinting and shading together; it uses unnecessary resources. Just select a lighter or darker color for tinting. HERE and HERE are some nice charts with plenty of colors to choose from.