rxvt-unicode (Español)

From ArchWiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Tango-preferences-desktop-locale.pngEste artículo o sección necesita ser traducido.Tango-preferences-desktop-locale.png

Notas: traducción está desactualizada (Discusión en Talk:Rxvt-unicode (Español)#)

rxvt-unicode es un emulador de terminal altamente configurable derivado de rxvt. Comunmente es conocido como urxvt, este emulador puede ser demonizado para ejecutar los clientes en un solo proceso con el fin de minimizar el uso de los recursos del sistema. Desarrollado por Marc Lehmann, algunas de las características más sobresalientes de rxvt-unicode son el soporte de idiomas internacionales a través de Unicode, asi como la habilidad de mostrar múltiples tipografias y soporte para extensiones Perl.

Installación

rxvt-unicode es parte del repositorio official Arch Linux (extra) repositories

Install the latest version of rxvt-unicode:

# pacman -S rxvt-unicode

Configuración

Creando ~/.Xresources

El aspecto y las funciones de rxvt-unicode son especificados en el archivo .Xresources.

Si usas startx, añada este a tu ~/.xinitrc:

xrdb -merge ~/.Xresources
Nota: Command-line arguments override and take precedence over the resource settings established in this file.

Crear si no existe:

$ touch ~/.Xresources

Todo lo que hay que hacer es introducir los ajustes deseados editanto el archivo.

Ejemplo ~/.Xresources

rxvt-unicode Example screenshot

URxvt.buffered:         true
URxvt.background:       black
URxvt.foreground:       white
URxvt.cursorColor:      green
URxvt.underlineColor:   yellow
URxvt.font:             xft:Terminus:pixelsize=14:antialias=false
URxvt.boldFont:         xft:Terminus:bold:pixelsize=14:antialias=false
URxvt.perl-ext-common:  default,tabbed
URxvt.title:            ArchWiki Example

Mira la pagina de referencia de rxvt-unicode para ver una lista completa de ajustes disponibles.

Consejos & Trucos

URIs cliqueables

Puedes lograr URIs cliqueables en la terminal si tienes Perl instalado. Por ejemplo, para abrir enlaces en Firefox añade lo siguiente a ~/.Xresources:

URxvt.perl-ext-common:  default,matcher
URxvt.urlLauncher:      /usr/bin/firefox
URxvt.matcher.button:   1 
Nota: En caso de usar otro navegador, cambiar /usr/bin/firefox , por /usr/bin/EXPLORADOR)

Yankable URIs (Sin Mouse)

Además, puede seleccionar y abrir direcciones URL en su navegador web, sin necesidad de utilizar el ratón.

Instala el paquete urxvt-url-select[enlace roto: package not found] y modifica tu ~.Xresources como sea necesario. Un ejemplo es el siguiente:

URxvt.perl-ext:      default,url-select
URxvt.keysym.M-u:    perl:url-select:select_next
URxvt.urlLauncher:   firefox
URxvt.underlineURLs: true
Nota: Esta extensión reemplaza el de las URIs cliqueables mencionada anteriormente.

Comandos de teclado:

Alt + U Entrar en modo selección. La última URI en tu pantalla sera seleccionada. Puedes repetir Alt+U para seleccionar la URI que sigue hacia arriba.

K Selecciona la URI por encima

J Selecciona la URI por debajo

Return Abre la URI seleccionada en el navegador y sale del modo selección

O Abre la URI seleccionada sin salir del modo selección

Y Copia (yank) la URI seleccionada y sale del modo selección

Esc Cancelar modo selección

Copiar y pegar

Para los usuarios no familiarizados con el modo de transferencia de datos de Xorg, el intercambio de información desde y hacia rxvt-unicode puede convertirse en un dolor de cabeza.

Clipboard Management

  • Parcellite es un gestor de portapapeles GTK+ que también puede correr en segundo plano como demonio.
  • autocutselprovee de interfaz en línea de comandos y demonio para sincronizar los portapapeles.
  • Glipper es un applet para el panel de GNOME con antiguas versiones que pueden ser usadas en escritorios no GNOME.
  • Clipman (xfce-clipman-plugin) es un gestor de portapapeles grafico para el panel de Xfce (xfpanel).

Script de gestión automática

Skottish[1] creó un script en Perl que automáticamente copia cualquier seleccion en urxvt al portapapeles. Guarda lo siguiente como /usr/lib/urxvt/perl/clipboard:

#! /usr/bin/perl

sub on_sel_grab {
    my $query=quotemeta $_[0]->selection;
    $query=~ s/\n/\\n/g;
    $query=~ s/\r/\\r/g;
    system( "echo -en " . $query . " | xsel -i -b -p" );
}

Xyne creó tambien su propia version del script de Skottish's (el cual esta tambien disponible en el AUR urxvt-clipboardAUR):

#! /usr/bin/perl

sub on_sel_grab {
    my $query = $_[0]->selection;
    open (my $pipe,'|-','xsel -ibp') or die;
    print $pipe $query;
    close $pipe;
}

Necessita xsel y debe estar habilitado en *perl-ext-common o *perl-ext en ~/.Xresources. Por ejemplo:

URxvt.perl-ext-common: default,clipboard

Scrollbar

La apariencia de la scrollbar puede ser establecida a través de la siguiente entrada en ~/.Xresources:

! scrollbar style - rxvt (default), plain, next, or xterm
URxvt*scrollstyle:rxvt

De las cuales "plain" es la más compacta de todas.

Tabs

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

URxvt.perl-ext-common:  default,tabbed

To control tabs use:

Shift+ new tab

Shift+ go to left tab

Shift+ go to right tab

Ctrl+ move tab to the left

Ctrl+ move tab to the right

Ctrl+D: close 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

Colors must be specified using color indexes: 0 to 15 correspond to your ~/.Xresources colors, -1 is the background color and -2 is the foreground color. Colors are declared like this:

XTerm.color0: #000000
XTerm.color2: #aece92
XTerm.color3: #968a38

For named tabs, see urxvt-tabbedexAUR in the AUR, (Shift+Up: names a tab).

Font Declaration Methods

URxvt.font:            9x15

is the same as

-misc-fixed-medium-r-normal--15-140-75-75-c-90-iso8859-1

and

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 /usr/share/fonts/misc/fonts.alias. (There are also 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.

Improved Kuake-like Behavior in Openbox

This was originally posted on the forum by Xyne[2] and it relies on xdotool which is available in the Official repositories.

Scriptlets

Save this scriptlet from the urxvtc man page somewhere on your system as urxvtc (e.g., in ~/.config/openbox):

#!/bin/sh
urxvtc "$@"
if [ $? -eq 2 ]; then
   urxvtd -q -o -f
   urxvtc "$@"
fi

and save this one as urxvtq:

#!/bin/bash

wid=$(xdotool search --classname urxvtq)
if [ -z "$wid" ]; then
  /path/to/urxvtc -name urxvtq -geometry 80x28
  wid=$(xdotool search --classname urxvtq | head -1)
  xdotool windowfocus $wid
  xdotool key Control_L+l
else
  if [ -z "$(xdotool search --onlyvisible --classname urxvtq 2>/dev/null)" ]; then
    xdotool windowmap $wid
    xdotool windowfocus $wid
  else
    xdotool windowunmap $wid
  fi
fi

A previous version of xdotool introduced a bug which disabled recognition of visible windows and thus led some users to use the following scriptlet in place of the previous one. This is no longer necessary as xdotool >= 1.20100416.2809, but it has been left here for future reference.

#!/bin/bash

wid=$(xprop -name urxvtq | grep 'WM_COMMAND' | awk -F ',' '{print $3}' | awk -F '"' '{print $2}')
if [ -z "$wid" ]; then
  /path/to/urxvtc -name urxvtq -geometry 200x28
  wid=$(xprop -name urxvtq | grep 'WM_COMMAND' | awk -F ',' '{print $3}' | awk -F '"' '{print $2}')
  xdotool windowfocus $wid
  xdotool key Control_L+l
else
  if [ -z "$(xprop -id $wid | grep 'window state: Normal' 2>/dev/null)" ]; then
    xdotool windowmap $wid
    xdotool windowfocus $wid
  else
    xdotool windowunmap $wid
  fi
fi

Make sure that you change /path/to/urxvtc to the actual path to the urxvtc scriptlet that you saved above. We will be using urxvtc to launch both regular instances of urxvt and the kuake-like instance.

urxvtq with tabbing

If you want to have tabs in your kuake-like urxvtc (here called urxvtq) just replace the third line in your urxvtq:

wid=$(xdotool search --name urxvtq)

with:

wid=$(xdotool search --name urxvtq | grep -m 1 "" )

To activate the tab support, you can either replace the fifth line of your urxvtq:

/path/to/urxvtc -name urxvtq -geometry 80x28

with:

/path/to/urxvtc -name urxvtq -pe tabbed -geometry 80x28

or replace this line of your .Xresources:

URxvt.perl-ext-common: default,matcher

with

URxvt.perl-ext-common: default,matcher,tabbed
Tab control

<SHIFT>-Left: Switch to the tab left of current one

<SHIFT>-Right: Switch to the tab right of current one

<SHIFT>-Down: Create a new tab

You can also use your mouse to switch the tabs by clicking the wished one and create a new tab by clicking on [NEW].\\

To close a tab just enter 'exit' like you will close a terminal.

Openbox configuration

Now add the following lines to the <applications> section of ~/.config/openbox/rc.xml:

<application name="urxvtq">
   <decor>no</decor>
   <position force="yes">
     <x>center</x>
     <y>0</y>
   </position>
   <desktop>all</desktop>
   <layer>above</layer>
   <skip_pager>yes</skip_pager>
   <skip_taskbar>yes</skip_taskbar>
   <maximized>Horizontal</maximized>
</application>

and add these lines to the <keyboard> section:

<keybind key="W-t">
  <action name="Execute">
    <command>/path/to/urxvtc</command>
  </action>
</keybind>
<keybind key="W-grave">
  <action name="Execute">
    <execute>/path/to/urxvtq</execute>
  </action>
</keybind>

Here too you need to change the /path/to/* lines to point to the scripts that you saved above. Save the file and then reconfigure Openbox. You should now be able to launch regular instances of urxvt with the Windows/Super key + "t", and toggle the kuake-like console with Windows/Super+grave (`).

Further configuration

The advantage of this configuration over the urxvt kuake perl script is that Openbox provides more keybinding options such as modifier keys. The kuake script hijacks an entire physical key regardless of any modifier combination. Review the Openbox bindings documentation for the full range or possibilities.

The Openbox per-app settings can be used to further configure the behavior of the kuake-like console (e.g. screen position, layer, etc). You may need to change the "geometry" parameter in the urxvtq scriptlet to adjust the height of the console.

Related scripts

  • hbekel has posted a generalized version of the urxvtq here which can be used to toggle any application using xdotool.

Rxvt-unicode as gmrun terminal

Unlike some other terminals, urxvt expects the arguments to -e 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 .gmrunrc:

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 -e in the same way $@ does in bash, making the command intelligible to urxvt.

Improving Performance

  • Avoid the use of Xft fonts. If Xft fonts must be used, append :antialias=false to the setting value.[3]
  • Build rxvt-unicode with disabled support for unnecessary features, --disable-xft and --disable-unicode3 in particular.[4]
  • Limit the number of saveLines (option -sl) in the scrollback buffer to reduce memory usage.[5]
  • Consider running urxvtd as a daemon accepting connections from urxvtc clients.

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 copying /usr/share/terminfo/r/rxvt-unicode from your local machine to your host at ~/.terminfo/r/rxvt-unicode.

True Transparency

To enable true transparency, make sure you have a WM that supports compositing and a compositing manager installed and enabled, then add the following lines to your .Xresources changing the rgba values to whatever color you would like:

URxvt.depth: 32
URxvt*background: rgba:0000/0000/0000/cccc

Problems

Transparency not working after upgrade to V9.09

The rxvt-unicode devs 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.

External resources