Difference between revisions of "Rxvt-Unicode Configuration Tutorial"

From AfterWiki
Jump to navigationJump to search
 
(2 intermediate revisions by the same user not shown)
Line 10: Line 10:
 
to this:
 
to this:
  
[[Image:Urxvt_xdefaults_after.png]]
+
[[Image:Urxvt_xdefaults_after2.png]]
  
  
Line 18: Line 18:
  
 
This tutorial gives a brief description of the Rxvt-Unicode terminal, a basic terminal environment setup, and the creation of the .Xdefaults configuration file.
 
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 ==
 
== Description of the Rxvt-Unicode Terminal ==
Line 60: Line 59:
 
Before configuring Rxvt-Unicode you need to setup some tools and environment variables.
 
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.
+
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, edit the ~/.bashrc ($HOME/.bashrc) file, located in the user's home folder. Add the following line under the heading:
+
To implement colored folders and command prompts, edit the ~/.bashrc ($HOME/.bashrc) file, located in the user's home folder.
  
 +
Under the heading:
 
<pre>
 
<pre>
 
# User specific aliases and functions:
 
# User specific aliases and functions:
 
</pre>
 
</pre>
  
 +
Add the following lines:
 
<pre>
 
<pre>
 
alias ls="ls -h --color=auto"
 
alias ls="ls -h --color=auto"
 +
 +
export PS1='\[\033[01;32m\]\u@\h \[\033[00;31m\]\W \$ \[\033[00m\]'
 +
</pre>
 +
 +
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:
 +
 +
<pre>
 +
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
 
</pre>
 
</pre>
  
Close the terminal and reopen it.  Use the "ls -l" command again.  You should see colored folders.
+
 
 +
Close the terminal and reopen it.  Use the "ls -l" command again.  You should see a colored prompt and folders.
  
  
Line 87: Line 112:
 
export TERM=rxvt-unicode
 
export TERM=rxvt-unicode
 
</pre>
 
</pre>
 +
 +
In the above example, "en_US.UTF-8" is used. To see a list of available UTF-8 supported languages, in a terminal type:
 +
 +
<pre>
 +
locale -a | grep utf8
 +
</pre>
 +
 +
and substitute your language of preference on the "export LANG=" line.
  
 
== .Xdefaults configuration file ==
 
== .Xdefaults configuration file ==
Line 102: Line 135:
  
 
<pre>
 
<pre>
URxvt*transparent:true
+
URxvt*transparent: true
URxvt*tintColor:blue
+
URxvt*tintColor: Blue
#URxvt*shading:40
+
#URxvt*shading: 40
URxvt*saveLines:12000
+
URxvt*saveLines: 12000
URxvt*foreground:White
+
URxvt*foreground: White
URxvt*background:Blue
+
URxvt*background: Blue
URxvt*font: xft:Bitstream Vera Sans Mono:pixelsize=13
+
#URxvt*font: xft:Bitstream Vera Sans Mono:pixelsize=12:antialias=true:hinting=true
#URxvt*font:-*-courier-medium-r-normal-*-*-140-*-*-*-*-iso8859-1
+
#URxvt*boldFont: xft:Bitstream Vera Sans Mono:bold:pixelsize=12:antialias=true:hinting=true
#URxvt*boldFont:-*-courier-bold-r-normal-*-*-140-*-*-*-*-iso8859-1
+
URxvt*font: xft:DejaVu Sans Mono:pixelsize=12:antialias=true:hinting=true
URxvt*color4:RoyalBlue
+
URxvt*boldFont: xft:DejaVu Sans Mono:bold:pixelsize=12:antialias=true:hinting=true
URxvt*color12:RoyalBlue
+
#URxvt*font: xft:Liberation Mono:pixelsize=13:antialias=true:hinting=true
URxvt*scrollBar:true
+
#URxvt*boldFont: xft:Liberation Mono:bold:pixelsize=13:antialias=true:hinting=true
URxvt*scrollBar_right:false
+
#URxvt*font: xft:terminus:pixelsize=15
URxvt*scrollstyle:rxvt
+
#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
 
</pre>
 
</pre>
  
Both the listing above and below are the same file functionally. The listing below simply has comments added for reference.
+
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.
The listing below can be found as a download-able file [http://wiki.afterstep.org/examples/Xdefaults_example.txt HERE]
 
  
 
<pre>
 
<pre>
 
# transparency - true or false (default)
 
# transparency - true or false (default)
URxvt*transparent:true
+
URxvt*transparent: true
  
 
# tint with any color; i.e., blue, red, tomato4, olivedrab2, etc.
 
# tint with any color; i.e., blue, red, tomato4, olivedrab2, etc.
 
#  some nice listings are at:
 
#  some nice listings are at:
#    http://www.nisrv.com/modules.php?name=Hex_Colors
+
#    http://www.nisrv.com/drupal/?q=node/11
 
#    http://www.htmlgoodies.com/tutorials/colors/article.php/3478921
 
#    http://www.htmlgoodies.com/tutorials/colors/article.php/3478921
URxvt*tintColor:blue
+
URxvt*tintColor: Blue
  
 
# shading - 0 to 99 darkens, 101 to 200 lightens.
 
# shading - 0 to 99 darkens, 101 to 200 lightens.
#  Don't use with tintColor; use a darker or lighter color instead.
+
#  Don't use with tintColor; just use a darker or lighter color instead.
#URxvt*shading:40
+
#URxvt*shading: 40
  
# scrollback buffer lines - 65535 is max (64 is default)
+
# scrollback buffer lines - 65535 is max on most machines (64 is default)
URxvt*saveLines:12000
+
URxvt*saveLines: 12000
  
 
# font color (default is black)
 
# font color (default is black)
URxvt*foreground:White
+
URxvt*foreground: White
  
 
# background color (prior to tinting) (default is white)
 
# background color (prior to tinting) (default is white)
URxvt*background:Blue
+
URxvt*background: Blue
  
# xft fonts - anti-aliased xft font setup is nice, but can be choppy
+
# Xft (X FreeType) with Bitstream, DejaVu, Liberation, or Terminus fonts:
URxvt*font: xft:Bitstream Vera Sans Mono:pixelsize=13
+
#  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
+
# Traditional fonts - a more traditional font setup in lieu of xft
#URxvt*font:-*-courier-medium-r-normal-*-*-140-*-*-*-*-iso8859-1
+
#URxvt*font:-*-courier-medium-r-normal-*-14-*-*-*-*-*-iso8859-1
#URxvt*boldFont:-*-courier-bold-r-normal-*-*-140-*-*-*-*-iso8859-1
+
#URxvt*boldFont:-*-courier-bold-r-normal-*-14-*-*-*-*-*-iso8859-1
  
 
# Replace blue folder colors with a lighter shade for clarity. To
 
# Replace blue folder colors with a lighter shade for clarity. To
# set colored folders and files within urxvt, xterm, and aterm, add
+
# set colored folders and files within urxvt, xterm, and aterm, add
# the following line to your ~/.bashrc ($HOME/.bashrc) file under
+
# the following line to your ~/.bashrc ($HOME/.bashrc) file under
# the heading "# User specific aliases and functions":
+
# the heading "# User specific aliases and functions":
 
#  alias ls="ls -h --color=auto"
 
#  alias ls="ls -h --color=auto"
URxvt*color4:RoyalBlue
+
URxvt*color4: RoyalBlue
URxvt*color12:RoyalBlue
+
URxvt*color12: RoyalBlue
  
 
# scrollbar - true (default) or false
 
# scrollbar - true (default) or false
URxvt*scrollBar:true
+
URxvt*scrollBar: true
  
 
# scrollbar position - left=false (default) or right=true
 
# scrollbar position - left=false (default) or right=true
URxvt*scrollBar_right:false
+
URxvt*scrollBar_right: false
  
 
# scrollbar style - rxvt (default), plain, next, or xterm
 
# scrollbar style - rxvt (default), plain, next, or xterm
URxvt*scrollstyle:rxvt
+
URxvt*scrollstyle: rxvt
 
</pre>
 
</pre>
  

Latest revision as of 14:30, 20 February 2012

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

In the above example, "en_US.UTF-8" is used. To see a list of available UTF-8 supported languages, in a terminal type:

locale -a | grep utf8

and substitute your language of preference on the "export LANG=" line.

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