Note: this wiki is no longer maintained. If you have any questions related to this wiki, please post them on the CrunchBang forums.

Translations of this page?:

ADMIN Install and Configure Urxvt

Urxvt is a highly configurable and lightweight terminal emulator, including unicode support and an embedded perl interpreter.

Installation

Urxvt isn't installed in CrunchBang By default, to install:

 sudo apt-get install rxvt-unicode 

for more information on installing applications see here.

Configuration

By default Urxvt looks pretty ugly, to make it look a bit prettier add the following to your ~/.Xdefaults file:

! black
URxvt.color0  : #2E2E34343636
URxvt.color8  : #555557575353
! red
URxvt.color1  : #CCCC00000000
URxvt.color9  : #EFEF29292929
! green
URxvt.color2  : #4E4E9A9A0606
URxvt.color10 : #8A8AE2E23434
! yellow
URxvt.color3  : #C4C4A0A00000
URxvt.color11 : #FCFCE9E94F4F
! blue
URxvt.color4  : #34346565A4A4
URxvt.color12 : #72729F9FCFCF
! magenta
URxvt.color5  : #757550507B7B
URxvt.color13 : #ADAD7F7FA8A8
! cyan
URxvt.color6  : #060698209A9A
URxvt.color14 : #3434E2E2E2E2
! white
URxvt.color7  : #D3D3D7D7CFCF
URxvt.color15 : #EEEEEEEEECEC

URxvt*foreground:White
URxvt*background:Black

! fonts
! run "fc-list" for a list of available fonts
URxvt*font: xft:Monospace:pixelsize=12

URxvt*scrollBar: False
URxvt*scrollTtyOutput: False
URxvt*scrollTtyKeypress: True
URxvt*secondaryScroll: True
URxvt*saveLines: 8000

The colours are APPLICATIONS Terminator defaults, (I just ripped them from ~/.config/terminator/config, assigning them to color0-15 in order).

Running:

fc-list

will give you a list of available fonts.

Note: you may need to run

xrdb -merge ~/.Xdefaults

to reload the .Xdefaults file in implement your changes.

Font Spacing

Urxvt can have problems with the spacings of some fonts (eg Terminus), an option has been introduced in the latest version (9.07), allowing you to manually tweak the spacings, unfortunately this isn't in the repositories, it is however in the Debian sid repos http://packages.debian.org/sid/i386/rxvt-unicode/download. to install the downloaded .deb:

sudo dpkg --force-depends-version -i /path/to/urxvt.deb 

You need to use dpkg as the dependencies include newer versions of things not available in the repos, it works fine with CrunchBang 9.04, so i suspect its an issue of Debian playing safe will dependency versions.

Then you can add the following to your .Xdefaults:

URxvt*letterSpace: -1

Where -1 decreases the spacing by one pixel, but can be adjusted as needed.

Clickable Links

The following allows you to click on links, and load them up in your browser of choice:

URxvt.perl-ext-common : default,matcher
URxvt.urlLauncher     : firefox
URxvt.matcher.button  : 1

True Transparency

To enable true transparency first you need to enable a compositing manager, xcompmgr just happens to be installed by default, this can be enabled from the main menu → Preferences → compositing → enable compositing or alternatively to have it start automatically uncomment the entry in your ~/.config/openbox/autostart.sh file.

then to modify your .Xdefaults file, first change the background line to add the opacity:

URxvt*background:[80]Black

0 = clear, 100 = opaque, this is set at 80.

then add this line also:

URxvt.depth: 32

Save, Exit and restart.

Tabs

Urxvt actually has support for two types of tabs, the first is probably most functional, but being text based, the ugliest. To enable just add the following to .Xdefaults.

URxvt.perl-ext-common : tabbed
URxvt.tabbed.tabbar-fg: 5
URxvt.tabbed.tabbar-bg: 0
URxvt.tabbed.tab-fg:    14
URxvt.tabbed.tab-bg:    0

The colours are the same as those already defined in your .Xdefaults, tabs can be created by pressing <shift>-down or clicking on 'NEW', and can by cycled through using <shift>-left and <shift>-right, or clicking on the relevant tabs.

There is also a script for GTK tabs here Z-Edit VARIOUS rxvt-tabbed [OK?], it doesn't seem to have any keybindings that i can find but you may find it useful. (Note: I think its standard in Arch, and comes with the source file, just not Debian or Ubuntu, so you may already have this installed)

Urxvt Daemon

It is possible to set up Urxvt so that a single Daemon runs, and individual client windows connect to it, (urxvtd and urxvtc), the advantage of this is reduced memory usage, although a crash would affect all windows.

You can have the daemon start automatically at startup by adding the following to your ~/.config/openbox/autostart.sh file, (see DESKTOP Autostart applications when openbox starts for more info).

 urxvtd -q -o -f

Or save the below script as 'urxvtc', this will ensure that the urxvt daemon is running when you launch a urxvt client, (see ADMIN Installing Scripts for info on installing scripts).

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

Then you can just use the command urxvtc instead of urxvt to take advantage of the urxvt daemon.

Or finally, use:

urxvtcd

This basically does the same as the above script, it starts the daemon if needed).

Quake like terminal

Urxvt does already have a script for a quake like (pop down) terminal:

URxvt.perl-ext-common : quake

unfortunately the key that its bound to becomes unusable for anything else (even when using a modifier key), to get around this we can use Openbox's keybindings to avoid this limitation.

First the script to maximise/minimise the window, There 2 to choose from:

#!/bin/bash

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

This one is borrowed from the Arch Wiki, but I find this has a noticeable lag, so instead I use:

#!/bin/sh
# inspired by http://wiki.archlinux.org/index.php/Rxvt-unicode#Improved_Kuake-like_behavior_in_Openbox

if [ -e "/tmp/urxvtq-wid" ]; then
  wid=$( cat /tmp/urxvtq-wid )
 
  if [ -e "/tmp/urxvtq" ]; then 
    xdotool windowunmap $wid    
    rm /tmp/urxvtq
  else                          
    xdotool windowmap $wid
    xdotool windowfocus $wid         
    touch /tmp/urxvtq
  fi
else                            
  urxvtc -name urxvtq -geometry 80x28 #this defines the size of the window
  wid=$(xdotool search --name urxvtq | head -n 1 )
  xdotool windowfocus $wid
  xdotool windowactivate $wid
  touch /tmp/urxvtq
  echo $wid > /tmp/urxvtq-wid
fi

This is much quicker, although it does have the downside of requiring you to manually remove /tmp/urxvtq-wid if the terminal is closed completely.

Save one of the above scripts to a file called urxvtq, and make it executable:

chmod +x /path/to/urxvtq

see this page for more details ADMIN Installing Scripts.

(Note: both the above scripts make use of the Urxvt Daemon, if you don't want to use this replace all instances of 'urxvtc' with 'urxvt'.)

To configure the key bindings, add the following to your ~/.config/openbox/rc.xml: Add this to the <keyboard> section, (see DESKTOP Configuring Keybindings for more info)

<keybind key="F12">
  <action name="Execute">
    <execute>/path/to/urxvtq</execute>
  </action>
</keybind>

and this at the end, to the <applications> section, (see applications for more info)

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

Then type:

openbox --reconfigure

to reload openbox's configuration files, done.

Replacing Terminator with Urxvt

First we need to change the keybindings in ~/.config/openbox/rc.xml, see the DESKTOP Configuring Keybindings page for details.

We need to replace all instances of 'APPLICATIONS Terminator' with 'urxvt' (or urxvtc) and 'Terminator' with 'Urxvt', you can do this by hand or use your text editors search and replace feature, most editors can do this. For VARIOUS Leafpad and Z-Obsolete VARIOUS Gedit [OBSOLETE/NEEDS EDITING?] go to 'Search' on the top level menu, and then 'replace'.

Next we need to edit the Openbox menu configuration file, see DESKTOP Configuring the Openbox Menu for details.

And again replace all occurrences of 'terminator' with 'urxvt'.

(Note: terminator has an -e and an -x flag for executing commands, urxvt only has the -e flag, so replace the -x flag as well)

You will then need to reconfigure Openbox, right click on your desktop and select:

Preferences → Openbox Config → Reconfigure

or in the terminal:

 openbox --reconfigure

Links

See also: Man pages - urxvt (1 & 7), urxvtc, urxvtd, urxvtcd, urxvtperl.

 
urxvt.txt · Last modified: 2012/05/25 17:17 by machinebacon
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Share Alike 3.0 Unported

Powered by DokuWiki. Hosted by Linode.
Copyright © 2010 CrunchBang Linux.
Proudly powered by Debian GNU/Linux.
Debian is a registered trademark of Software in the Public Interest, Inc.