Rxvt-unicode (Español)

From ArchWiki
Revision as of 16:07, 4 December 2012 by Kynikos.bot (Talk | contribs) (wikify some external links, use https for archlinux.org)

Jump to: navigation, search

Tango-preferences-desktop-locale.pngThis article or section needs to be translated.Tango-preferences-desktop-locale.png

Notes: please use the first argument of the template to provide more detailed indications. (Discuss in Talk:Rxvt-unicode (Español)#)

Tango-edit-clear.pngThis article or section needs language, wiki syntax or style improvements.Tango-edit-clear.png

Reason: please use the first argument of the template to provide a brief explanation. (Discuss in 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

Creaando ~/.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
Note: 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 #1

rxvt-unicode Example #1 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.

Ejemplo ~/.Xresources #2

rxvt-unicode Example #2 Screenshot

URxvt.geometry: 400x30 
URxvt.buffered: true
URxvt.background: black
URxvt.foreground: green
URxvt.cursorColor: yellow
URxvt.underlineColor: green
URxvt.font:xft:Bitstream Vera Sans Mono:pixelsize=12:antialias=true

!------------
!True Transparency
!------------
!set to 32-bit for real transparency (compositing required (see xcompmgr)
urxvt*depth:             32
!transparent=0000 opaque=ffff
urxvt*background: rgba:1111/1111/1111/dddd
!urxvt*background: rgba:1111/1111/1111/0000


!------------------
!False tranparency
!------------------
!URxvt.transparent: true
!URxvt.shading: 50 

Urxvt.secondaryScroll:  true    # Enable Shift-PageUp/Down in screen

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

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

Template:Keypress Selecciona la URI por encima

Template:Keypress Selecciona la URI por debajo

Template:Keypress Abre la URI seleccionada en el navegador y sale del modo selección

Template:Keypress Abre la URI seleccionada sin salir del modo selección

Template:Keypress Copia (yank) la URI seleccionada y sale del modo selección

Template:Keypress 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

The look of the scrollbar can be chosen through this entry in ~/.Xresources:

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

Of which "plain" is the most compact one.

Tabs

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

URxvt.perl-ext-common:  default,tabbed

To control tabs use:

Template:Keypress+Template:Keypress new tab

Template:Keypress+Template:Keypress go to left tab

Template:Keypress+Template:Keypress go to right tab

Template:Keypress+Template:Keypress move tab to the left

Template:Keypress+Template:Keypress move tab to the right

Template:Keypress+Template:Keypress: 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 this package 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 don't 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're 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'll 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'll 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