Rxvt-Unicode Configuration Tutorial

From AfterWiki
Revision as of 14:02, 3 April 2008 by Vaevictus (talk | contribs)
Jump to navigationJump to search

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:

Urxvt xdefaults before.png


to this:

Urxvt xdefaults after.png


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 benefits from having colored folders when the "ls" command is executed within it; folders stand-out and are distinct from files. Open a terminal and type "ls -l" and verify that folders are colored differently than files; if they aren't colored differently, you will need to modify the ".bashrc" file.

To implement colored folders, edit the ~/.bashrc ($HOME/.bashrc) file, located in the user's home folder. Add the following line under the heading:

# User specific aliases and functions:
alias ls="ls -h --color=auto"

Close the terminal and reopen it. Use the "ls -l" command again. You should see colored 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=13
#URxvt*font:-*-courier-medium-r-normal-*-*-140-*-*-*-*-iso8859-1
#URxvt*boldFont:-*-courier-bold-r-normal-*-*-140-*-*-*-*-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. The listing below can be found as a download-able file HERE

# 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/modules.php?name=Hex_Colors
#     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; use a darker or lighter color instead.
#URxvt*shading:40

# scrollback buffer lines - 65535 is max (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 fonts - anti-aliased xft font setup is nice, but can be choppy
URxvt*font: xft:Bitstream Vera Sans Mono:pixelsize=13

# traditional fonts - a more traditional font setup in lieu of xft
#URxvt*font:-*-courier-medium-r-normal-*-*-140-*-*-*-*-iso8859-1
#URxvt*boldFont:-*-courier-bold-r-normal-*-*-140-*-*-*-*-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.

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