Config settings of urxvt, make it looks better!

Urxvt is a quite popular Linux terminal. It is pretty lightweight and has a lot of visual settings. Urxvt even supports pseudo-transparency. It doesn’t require any compositing managers, which can slow down the system. So, that’s why urxvt is a choice of most users, who wants to customize Linux environment in a simple way.

I have shown the settings below in this article – urvxt config + Iosevka fonts.

So, let’s start.

Where urxvt config is located?

Many resources explain it differently. There are two names of config file. Use one that works. First name:

~/.Xresources

But it doesn’t work for me. So, i use the second one:

~/.Xdefaults

This one works fine for me. I write all urxvt settings in this file.

How to disable a setting without erasing the line?

We can use ! character for this. For example, temporarily disable terminal transparency:

!URxvt.transparent: true

Settings for urxvt

The first, set the height and width size of urxvt:

URxvt.geometry: 87x20

The following setting set the indent from the windows border:

URxvt.internalBorder: 15

We can remove the scrollbar. It really doesn’t need since we can use the mouse wheel to scroll down and up in urxvt:

URxvt.scrollBar: false

Set the terminal buffer size. This determines how many lines will be saved. So, old lines will be cleared in urxvt:

URxvt.saveLines: 1000

By this setting, we can scroll in urxvt by using mouse wheel:

URxvt.scrollWithBuffer: true

Set the main font color. It is based on html color codes. Use this tool – W3 Schools HTML Color Picker to find out what code corresponds to your color:

*foreground: #38b33f

Set cursor color, it is a thing in commandline that blinks:

URxvt.cursorColor: #C0C0C0

Make cursor to blink:

URxvt.cursorBlink: 1

Set bold font and its pixel size (read below how to find it):

URxvt.boldFont: xft:Iosevka:size=14,style=Bold

Set font and pixel size (read below how to find it):

URxvt.font: xft:Iosevka:size=14, Iosevka Medium:style=Medium Italic,Italic

Space between lines in pixels:

URxvt.lineSpace: 7

This setting makes terminal preudo-transparent. Urxvt calculates relative position and saves part of wallpaper as its background:

URxvt.transparent: true

If a text in urxvt merges with the wallpaper, add some shading. This will make the background darker. In following example 15 means 15%:

URxvt.shading: 15

If we don’t want to use pseudo-transparency, we need to set the background color:

URxvt.background: #000000

Settings for X system

Dots per inch value:

Xft.dpi: 96

Enable font smoothing. The font becomes thicker and easier to read:

Xft.antialias: true

Enable font hinting. This will increase edge contrast:

Xft.hinting: true

Font alignment on the grid:

Xft.hintstyle: hintfull

Set RGB color model:

Xft.rgba: rgb

Set color palette, which is used to files type highlight in urxvt

There are only 16 default colors. But it is a lot, and probably not needed. We can divide them into groups and assign the same color:

*color0:         #101010
*color8:         #525252

*color1:        #e158b8
*color9:        #e158b8

*color2:        #49dd9a
*color10:       #49dd9a

*color3:        #5e65de
*color11:       #5e65de

*color4:        #337ed4
*color12:       #337ed4

*color5:        #aa50db
*color13:       #aa50db

*color6:        #009999
*color14:       #009999

*color7:         #b9b9b9
*color15:        #f7f7f7
Color palette in urxvt
How files and directories look like after setting the color palette

How to find out the font name and its possible styles

In Debian all fonts are installed in /usr/share/fonts directory. But it is uncomfortable to browse the whole directory. To list all fonts installed and their styles make fc-list:

fc-list
...
/usr/share/fonts/truetype/dejavu/DejaVuSerif-Bold.ttf: DejaVu Serif:style=Bold
/usr/share/fonts/truetype/arphic/uming.ttc: AR PL UMing TW MBE:style=Light
/usr/share/fonts/truetype/iosevka/ttf/iosevka-term-semibold.ttf: Iosevka Term,Iosevka Term Semibold:style=Semibold,Regular
---And more

If you know font name and want to show all its variants, use grep:

fc-list | grep Iosevka
...
/usr/share/fonts/truetype/iosevka/ttf/iosevka-term-semibold.ttf: Iosevka Term,Iosevka Term Semibold:style=Semibold,Regular
/usr/share/fonts/truetype/iosevka/ttf/iosevka-term-bolditalic.ttf: Iosevka Term:style=Bold Italic
/usr/share/fonts/truetype/iosevka/ttf/iosevka-term-boldoblique.ttf: Iosevka Term,Iosevka Term Bold Oblique:style=Bold Oblique,Regular
---And more

We are interested in the second part of these lines, after “ttf:”. For example:

/usr/share/fonts/truetype/iosevka/ttf/iosevka-term-bolditalic.ttf: Iosevka Term:style=Bold Italic

The part after “ttf:” is:

Iosevka Term:style=Bold Italic

In urxvt config we use exactly this string. “xft:” literally means request this font from the system libXft library:

URxvt.boldFont: xft:Iosevka Term:style=Bold Italic

Add “size” option and set the bold font size. The options must be separated by a comma:

URxvt.boldFont: xft:Iosevka Term:size=14,style=Bold Italic

In another example:

URxvt.boldFont: xft:Iosevka, Iosevka Medium:style=Medium Italic,Italic

“size” option must be listed exactly after the font family name:

URxvt.boldFont: xft:Iosevka:size=14, Iosevka Medium:style=Medium Italic,Italic
Updated: June 25, 2019 — 2:13 pm

2 Comments

Add a Comment
  1. This is great. Where did you find this information? I checked the man pages but it lists very little in terms of how to actually configure it and what to put in .Xdefaults/.Xresources

    1. I don’t remember clearly, but I definitely looked for it on the Internet, on resources like Arch wiki and similar.
      I now tried to find. Man page says that urxvt –help (exactly two dashes!) option gives a complete list of parameters for urxvt config:
      urxvt –help
      I found several man pages, but this one has a few options with a detailed description:
      https://ultra-technology.org/wp-content/uploads/2019/05/uxvt-man-page-resouces.jpg
      It is possible to see commandline options:
      urxvt -help (one dash)
      This can be used as aliases in bash (~/.bashrc), if it contains an option that is not supported by config
      Also all Xft* options in this arcticle is X options, since .Xresources (more modern), .Xdefaults (more older) are config files used by X applications
      More precisely, Xft* options are for libXft (responsible for fonts drawing).
      So, you can find even more settings to make the system looks better.

Leave a Reply

Your email address will not be published.