rxvt-unicode

rxvt-unicode is a customizable terminal emulator forked from rxvt. Features of rxvt-unicode include international language support through Unicode, transparency, the ability to display multiple font types and support for Perl extensions.

Installation

Install the rxvt-unicode package, or rxvt-unicode-truecolorAUR for 24-bit true color support.

Configuration

See urxvt(1) and urxvt(7) for available settings and values.

Xresources

Rxvt-unicode is controlled by command-line arguments or Xresources. Command-line arguments override, and take precedence over resource settings, see the X resources article for details.

urxvt --help prints all available rxvt resources to standard error. The man page has full explanations of each resource.

Scrollback position

By default, when shell output appears the scrollback view will automatically jump to the bottom of the buffer to display new output. If in cases where you want to see previous output (e.g., compiler messages), set the following options in ~/.Xresources:

! do not scroll with output
URxvt*scrollTtyOutput: false

! scroll in relation to buffer (with mouse scroll or Shift+Page Up)
URxvt*scrollWithBuffer: true

! scroll back to the bottom on keypress
URxvt*scrollTtyKeypress: true

Scrollback buffer in secondary screen

When you scroll a pager in a secondary screen (e.g. without the option), it may be a good idea to disable the scrollback buffer to be able to scroll in the pager itself, instead of the terminal's buffer: this is default and unchangeable behaviour in konsole and vte-based terminals.

In urxvt, to disable the scrollback buffer for the secondary screen:

URxvt.secondaryScreen: 1
URxvt.secondaryScroll: 0

The above configuration works as expected except when scrolling with a mouse wheel. When you scroll a pager in the secondary screen with the mouse wheel - and there has been something in the scrollback buffer, instead of the pager itself - the scrollback buffer will be scrolled by the mouse wheel. To solve this issue, it is necessary to introduce a new option into rxvt-unicode . A patched rxvt-unicode is available in AUR as . After installing it, add the following to the configuration file:

URxvt.secondaryWheel: 1

Font declaration methods

URxvt.font: 9x15

is the same as:

URxvt.font: -misc-fixed-medium-r-normal--15-140-75-75-c-90-iso8859-1

And, for the same font in bold:

URxvt.font: 9x15bold

is the same as:

URxvt.font: -misc-fixed-bold-r-normal--15-140-75-75-c-90-iso8859-1

The complete list of short names for X core fonts can be found in (there are also some fonts.alias files in some of the other subdirectories of /usr/share/fonts/, but as they are packaged separately from the actual fonts, they may list fonts you do not actually have installed). It is worth noting that these short aliases select for ISO-8859-1 versions of the fonts rather than ISO-10646-1 (Unicode) versions, and 75 DPI rather than 100 DPI versions, so you are probably better off avoiding them and choosing fonts by their full long names instead.

Note: The above paragraph is only for bitmap fonts. Other fonts can be used through Xft using the following format:
URxvt.font: xft:monaco:size=10

Or

URxvt.font: xft:monaco:bold:size=10

A nice method for testing out fonts in a live terminal before committing to the configuration is by printing escape codes in the terminal, for example:

$ printf '\e]710;%s\007' "xft:Terminus:pixelsize=12"

Font spacing

By default the distance between characters can feel too wide. The spacing can be reduced by one pixel as such:

There is some debate over how urxvt calculates character widths. changes this calculation, usually resulting in tighter character spacing.

Colors

By default, rxvt-unicode is compiled with color support. In addition to the default foreground and background colors, rxvt can display up to 256 colors (plus high-intensity bold/blinking/underlined and any mix of these).

It is also possible to specify the color values of foreground, background, cursorColor, cursorColor2, colorBD, colorUL as a number 0-15, as a convenient shorthand to reference the color name of color0-color15. See #Xresources for details.

Printing

By default, rxvt-unicode will print out a screen dump, via lpr, when is pressed. Using or will include the terminal's scroll back in the printout as well. This behavior can be changed, or disabled entirely, based on personal preference and need.

Reload the configuration

After changing the configuration use to reload the config. The new configuration is applied for all new terminals.

Cut and paste

Rxvt-unicode uses cut buffers which are loaded into the current PRIMARY selection by default. See Selecting and pasting text for details.

It is possible to access the selection with the bindings ALT-CTRL-c and for copy and paste respectively.

If you wish to copy into PRIMARY selection and also ensure that your selection is updated with the same contents, you may add the following:

URxvt.perl-ext-common:  ...,selection-to-clipboard,...

and

URxvt.clipboard.autocopy: true
URxvt.keysym.M-c: perl:clipboard:copy
URxvt.keysym.M-v: perl:clipboard:paste


See also Clipboard#Managers.

Perl extensions

We can enable URxvt perl extensions by including the following line:

 URxvt.perl-ext-common: extension_name_1,extension_name_2,...

Please take note that there should not be any spacing between extension names.

Clickable URLs

You can make URLs in the terminal clickable using the matcher extension. For example, to open links in the default web browser with the left mouse button, add the following to :

URxvt.perl-ext-common: default,matcher
URxvt.url-launcher: /usr/bin/xdg-open
URxvt.matcher.button: 1

Since rxvt-unicode 9.14, it is also possible to use matcher to open and list recent (currently limited to 10) URLs via keyboard:

URxvt.keysym.C-Delete: perl:matcher:last
URxvt.keysym.M-Delete: perl:matcher:list

Matching links can be colored with a chosen foreground or background color, for example blue:

URxvt.matcher.rend.0: Uline Bold fg5

Alternatively, use for a #RRGGBB color. This will however color all underlined text, instead of only link matches:

URxvt.colorUL: #4682B4

Yankable URLs (no mouse)

In addition, you can select and open URLs in your web browser without using the mouse. Install the package and adjust your as necessary. An example is shown below:

URxvt.perl-ext: default,url-select
URxvt.keysym.M-u: perl:url-select:select_next
URxvt.url-select.launcher: /usr/bin/xdg-open
URxvt.url-select.underline: true

Key commands:

KeyDescription
Enter selection mode. The last URL on your screen will be selected. You can repeat to select the next upward URL.
kSelect next upward URL
Select next downward URL
Open selected URL in browser and quit selection mode
Open selected URL in browser without quitting selection mode
Copy (yank) selected URL and quit selection mode
EscCancel URL selection mode

Simple tabs

To add tabs to urxvt, add the following to your ~/.Xresources:

URxvt.perl-ext-common: ...,tabbed,...

To control tabs use:

KeyDescription
New tab
Go to left tab
Go to right tab
Move tab to the left
Move tab to the right
Ctrl+dClose tab

You can change the colors of tabs with the following:

URxvt.tabbed.tabbar-fg: 2
URxvt.tabbed.tabbar-bg: 0
URxvt.tabbed.tab-fg: 3
URxvt.tabbed.tab-bg: 0

If you need to rename the tab, you would probably want to install instead.

Fullscreen

You can install the AUR package , and then set a key binding to put urxvt fullscreen.

Changing font size on the fly

Install from the AUR, add it to your Perl extensions within ~/.Xresources

 URxvt.perl-ext-common:  ...,resize-font,...

The default keybindings are

  • (or ) to increase size
  • Ctrl+- to decrease size
  • to reset size
  • to see current size

You can also change key bindings, for example like this:

 URxvt.keysym.C-Down:  resize-font:smaller
 URxvt.keysym.C-Up:    resize-font:bigger

For the Ctrl+Shift bindings to work, a default binding needs to be disabled (see discussion here):

 URxvt.iso14755: false
 URxvt.iso14755_52: false

Confirm paste

The extension is enabled by default and it displays a confirmation dialog when a paste containing control characters is detected.

It can be disabled in the following way:

URxvt.perl-ext-common:-confirm-paste

Disabling Perl extensions

If you do not use the Perl extension features, you can improve the security and speed by disabling Perl extensions completely.

URxvt.perl-ext:
URxvt.perl-ext-common:

To selectively disable an extension, you need to prepend a hyphen before the extension name. For example:

Urxvt.perl-ext-common:-extension
Note: If you use multiple Perl extension features, you can list them in succession, comma-separated: URxvt.perl-ext-common:default,matcher,tabbed

Troubleshooting

Transparency not working after upgrade to v9.09

The rxvt-unicode developers removed compatibility code for a lot of non standard wallpaper setters with this update. Using a non compatible wallpaper setter will break transparency support. Recommended wallpaper setters:

  • feh
  • hsetroot
  • esetroot

To make true transparency work, make sure to comment URxvt.tintColor and URxvt.inheritPixmap.

Remote hosts

If you are logging into a remote host, you may encounter problems when running text-mode programs under rxvt-unicode. This can be fixed by installing on the remote host or by copying from your local machine to your host at ; same for rxvt-unicode-256color.

Some remote systems do not change title automatically unless you specify TERM=xterm. To fix the issue add this line to .bashrc on the remote machine:

PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}:${PWD}\007"'

Another fix you can try is to put following in your .Xresources:

URxvt*termName: rxvt

This is useful when connecting into remote hosts without admin privileges to install terminfo definition for rxvt-unicode.

Using rxvt-unicode as gmrun terminal

Unlike some other terminals, urxvt expects the arguments to to be given separately, rather than grouped together with quotes. This causes trouble with gmrun, which assumes the opposite behavior. This can be worked around by putting an "eval" in front of gmrun's "Terminal" variable in :

Terminal = eval urxvt
TermExec = ${Terminal} -e

(gmrun uses /bin/sh to execute commands, so the "eval" is understood here.) The "eval" has the side-effect of "breaking up" the argument to in the same way that does in Bash, making the command intelligible to urxvt.

My numerical keypad acts weird and generates differing output? (e.g. in vim)

Some Debian GNU/Linux users seem to have this problem, although no specific details were reported so far. It is possible that this is caused by the wrong TERM setting, although the details of whether and how this can happen are unknown, as TERM=rxvt should offer a compatible keymap.

However, using the xmodmap program (), you can re-map your number pad keys back.

1. Check the keycode that your numerical keypad (numpad) generates using program.

  • Start the program
  • Press your number pad keys and look for ... keycode xxx ... in 's output. For example, numpad 1 in some keyboards is also "End" key, that have a 'keycode 87'.

2. Create or modify your xmodmap file, usually ~/.Xmodmap, with the content representing your keycode.

Example of xmodmap file with number pad keycode:

3. Load your xmodmap file at X session start-up.

For example, in file add:

...
xmodmap ~/.Xmodmap
...

Key combinations do not work

See Get Alt key to work in terminal.

Slow performance when drawing glyphs

Some programs like alsamixer and xprop do not perform well with some graphics drivers and in consequence redraw very slowly. The option "skipBuiltinGlyphs" for ~/.Xresources or the command line option may fix this. One possible solution is to add the following to ~/.Xresources:

URxvt*skipBuiltinGlyphs:    true

Very long lines cause slowdown

The plugin may be the culprit here. It must match a regex against a line every time the line updates, and if you have a large value this can exacerbate the problem by allowing a very large maximum line length.

There are some simple workarounds:

  • Reduce
  • Disable the plugin

If neither of those are palatable options, you can compromise by disabling URL matching past a certain cutoff point:

  1. Copy to ~/.urxvt/ext/ (creating the directory if necessary)
  2. Edit , and find the line in the sub. It should be line 270.
  3. After that line, insert the line . This disables URL matching on any line that starts more than 100 rows behind the top of the terminal.
gollark: Thanks, oversized bookmark library!
gollark: https://sdleffler.github.io/RustTypeSystemTuringComplete/
gollark: It's Turing-complete IIRC.
gollark: Rust's type system is an esolang, sort of.
gollark: U+262D HAMMER AND SICKLE EMOJI.

See also

This article is issued from Archlinux. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.