urxvt

tuesday, 6 january 2015

after having used gnome-terminal, terminator, xfce4-terminal, roxterm, lxterm, sakura and a host of xterm variants, I have finally settled on URxvt. I had toyed superficially with it over the years but never got it working to my liking—largely due to laziness and the seductive ease other terminal emulators provided for font management and window transparency.

Configuring the standard pop-up scratchpad for various tiling window managers often entailed using different terminal emulators to obtain the behaviour required—some didn’t allow geometry control, others, ease of window identication (such as, setting the WM_CLASS), etc.

Finally, I decided to give URxvt a more serious look. Having done so, I wonder how I ever overlooked the fine grained control one has over the
display and the daemon mode it can be run in providing the smallest memory footprint—especially given the number of CLI (text based) applications I run.

It took installing the “patched” version of URxvt to end my terminal emulator hunt, allowing proper display of the UTF-8 font glyphs in my ZSH prompt (most important! :-) Prior to that, XFT fonts were improperly spaced and I was not fond of the default monospaced bitmapped font. If you don’t have need for special UTF-8 characters, the “letterSpace -1” setting should suffice for correcting most XFT font spacing with a vanilla URxvt install.

basic .Xresources

there are a plethora of .Xresources that can be defined for URxvt, but these suffice for my purposes..

! Settings URxvt*buffered: true ! double buffer for xtf URxvt*hold: false ! kill window on shell exit URxvt*loginShell: true ! to load shell profiles URxvt*print-pipe: cat > $HOME/tmp/$(echo urxvt.dump.$(date +'%s')) URxvt*saveLines: 9999 ! non-tmux window scroll back ! Text URxvt*colorUL: yellow URxvt*font: xft:Inconsolata-dz:size=12 URxvt*internalBorder: 6 ! pixels from frame edge ! URxvt*letterSpace: -1 ! xft adjustment (for vanilla urxvt) URxvt*lineSpace: 4 ! pixels between lines for added readability URxvt*underlineColor: yellow ! UI URxvt*fading: 30 ! % brightness reduction on focus loss URxvt*mapAlert: true ! de-iconify on bell alert URxvt*scrollBar: false ! maximize usable line width URxvt*shading: 40 ! darken background transparency 60% URxvt*transparent: true URxvt*visualBell: true ! blink window on bell ! Scrolling URxvt*scrollTtyKeypress: true ! scroll to bottom on keypress URxvt*scrollTtyOutput: false ! do not scroll to bottom on output URxvt*scrollWithBuffer: false ! do not use scrollback buffer URxvt*skipScroll: true ! favour scroll speed over listing all lines ! Enable left mouse click url launcher URxvt*matcher.button: 1 URxvt*perl-ext: URxvt*perl-ext-common: default,matcher URxvt*url-launcher: luakit

xterm keymaps

of course, it wasn’t just font management that kept dissuading me from using URxvt every time I poked at it. Its default keymappings were sufficiently different from standard XTerm which was problematic for some applications.

This table from the web solved this serious dilemma..

! Act more like XTerm :-) URxvt*termName: xterm-256color ! Normal URxvt*keysym.Home: \033OH URxvt*keysym.End: \033OF URxvt*keysym.F1: \033OP URxvt*keysym.F2: \033OQ URxvt*keysym.F3: \033OR URxvt*keysym.F4: \033OS ! Shift ! paste conflict ! URxvt*keysym.S-Insert: \033[2;2~ URxvt*keysym.S-Delete: \033[3;2~ URxvt*keysym.S-Home: \033[1;2H URxvt*keysym.S-End: \033[1;2F ! scrolling conflict ! URxvt*keysym.S-Page_Up: \033[5;2~ ! URxvt*keysym.S-Page_Down: \033[6;2~ URxvt*keysym.S-F1: \033[1;2P URxvt*keysym.S-F2: \033[1;2Q URxvt*keysym.S-F3: \033[1;2R URxvt*keysym.S-F4: \033[1;2S URxvt*keysym.S-F5: \033[15;2~ URxvt*keysym.S-F6: \033[17;2~ URxvt*keysym.S-F7: \033[18;2~ URxvt*keysym.S-F8: \033[19;2~ URxvt*keysym.S-F9: \033[20;2~ URxvt*keysym.S-F10: \033[21;2~ URxvt*keysym.S-F11: \033[23;2~ URxvt*keysym.S-F12: \033[24;2~ ! Tab navigation conflict (only when using tabs) URxvt*keysym.S-Up: \033[1;2A URxvt*keysym.S-Down: \033[1;2B URxvt*keysym.S-Right: \033[1;2C URxvt*keysym.S-Left: \033[1;2D ! Alt URxvt*keysym.M-Insert: \033[2;3~ URxvt*keysym.M-Delete: \033[3;3~ URxvt*keysym.M-Home: \033[1;3H URxvt*keysym.M-End: \033[1;3F URxvt*keysym.M-Page_Up: \033[5;3~ URxvt*keysym.M-Page_Down: \033[6;3~ URxvt*keysym.M-F1: \033[1;3P URxvt*keysym.M-F2: \033[1;3Q URxvt*keysym.M-F3: \033[1;3R URxvt*keysym.M-F4: \033[1;3S URxvt*keysym.M-F5: \033[15;3~ URxvt*keysym.M-F6: \033[17;3~ URxvt*keysym.M-F7: \033[18;3~ URxvt*keysym.M-F8: \033[19;3~ URxvt*keysym.M-F9: \033[20;3~ URxvt*keysym.M-F10: \033[21;3~ URxvt*keysym.M-F11: \033[23;3~ URxvt*keysym.M-F12: \033[24;3~ URxvt*keysym.M-Up: \033[1;3A URxvt*keysym.M-Down: \033[1;3B URxvt*keysym.M-Right: \033[1;3C URxvt*keysym.M-Left: \033[1;3D ! Shift+Alt URxvt*keysym.S-M-F1: \033[1;4P URxvt*keysym.S-M-F2: \033[1;4Q URxvt*keysym.S-M-F3: \033[1;4R URxvt*keysym.S-M-F4: \033[1;4S URxvt*keysym.S-M-F5: \033[15;4~ URxvt*keysym.S-M-F6: \033[17;4~ URxvt*keysym.S-M-F7: \033[18;4~ URxvt*keysym.S-M-F8: \033[19;4~ URxvt*keysym.S-M-F9: \033[20;4~ URxvt*keysym.S-M-F10: \033[21;4~ URxvt*keysym.S-M-F11: \033[23;4~ URxvt*keysym.S-M-F12: \033[24;4~ URxvt*keysym.S-M-Insert: \033[2;4~ URxvt*keysym.S-M-Delete: \033[3;4~ URxvt*keysym.S-M-Home: \033[1;4H URxvt*keysym.S-M-End: \033[1;4F URxvt*keysym.S-M-Page_Up: \033[5;4~ URxvt*keysym.S-M-Page_Down: \033[6;4~ URxvt*keysym.S-M-Up: \033[1;4A URxvt*keysym.S-M-Down: \033[1;4B URxvt*keysym.S-M-Right: \033[1;4C URxvt*keysym.S-M-Left: \033[1;4D ! Control URxvt*keysym.C-F1: \033[1;5P URxvt*keysym.C-F2: \033[1;5Q URxvt*keysym.C-F3: \033[1;5R URxvt*keysym.C-F4: \033[1;5S URxvt*keysym.C-F5: \033[15;5~ URxvt*keysym.C-F6: \033[17;5~ URxvt*keysym.C-F7: \033[18;5~ URxvt*keysym.C-F8: \033[19;5~ URxvt*keysym.C-F9: \033[20;5~ URxvt*keysym.C-F10: \033[21;5~ URxvt*keysym.C-F11: \033[23;5~ URxvt*keysym.C-F12: \033[24;5~ URxvt*keysym.C-Insert: \033[2;5~ URxvt*keysym.C-Delete: \033[3;5~ URxvt*keysym.C-Home: \033[1;5H URxvt*keysym.C-End: \033[1;5F URxvt*keysym.C-Page_Up: \033[5;5~ URxvt*keysym.C-Page_Down: \033[6;5~ URxvt*keysym.C-Up: \033[1;5A URxvt*keysym.C-Down: \033[1;5B URxvt*keysym.C-Right: \033[1;5C URxvt*keysym.C-Left: \033[1;5D ! Shift+Control URxvt*keysym.S-C-F1: \033[1;6P URxvt*keysym.S-C-F2: \033[1;6Q URxvt*keysym.S-C-F3: \033[1;6R URxvt*keysym.S-C-F4: \033[1;6S URxvt*keysym.S-C-F5: \033[15;6~ URxvt*keysym.S-C-F6: \033[17;6~ URxvt*keysym.S-C-F7: \033[18;6~ URxvt*keysym.S-C-F8: \033[19;6~ URxvt*keysym.S-C-F9: \033[20;6~ URxvt*keysym.S-C-F10: \033[21;6~ URxvt*keysym.S-C-F11: \033[23;6~ URxvt*keysym.S-C-F12: \033[24;6~ URxvt*keysym.S-C-Insert: \033[2;6~ URxvt*keysym.S-C-Delete: \033[3;6~ URxvt*keysym.S-C-Home: \033[1;6H URxvt*keysym.S-C-End: \033[1;6F URxvt*keysym.S-C-Page_Up: \033[5;6~ URxvt*keysym.S-C-Page_Down: \033[6;6~ URxvt*keysym.S-C-Up: \033[1;6A URxvt*keysym.S-C-Down: \033[1;6B URxvt*keysym.S-C-Right: \033[1;6C URxvt*keysym.S-C-Left: \033[1;6D ! Alt+Control URxvt*keysym.M-C-F1: \033[1;7P URxvt*keysym.M-C-F2: \033[1;7Q URxvt*keysym.M-C-F3: \033[1;7R URxvt*keysym.M-C-F4: \033[1;7S URxvt*keysym.M-C-F5: \033[15;7~ URxvt*keysym.M-C-F6: \033[17;7~ URxvt*keysym.M-C-F7: \033[18;7~ URxvt*keysym.M-C-F8: \033[19;7~ URxvt*keysym.M-C-F9: \033[20;7~ URxvt*keysym.M-C-F10: \033[21;7~ URxvt*keysym.M-C-F11: \033[23;7~ URxvt*keysym.M-C-F12: \033[24;7~ URxvt*keysym.M-C-Insert: \033[2;7~ URxvt*keysym.M-C-Delete: \033[3;7~ URxvt*keysym.M-C-Home: \033[1;7H URxvt*keysym.M-C-End: \033[1;7F URxvt*keysym.M-C-Page_Up: \033[5;7~ URxvt*keysym.M-C-Page_Down: \033[6;7~ URxvt*keysym.M-C-Up: \033[1;7A URxvt*keysym.M-C-Down: \033[1;7B URxvt*keysym.M-C-Right: \033[1;7C URxvt*keysym.M-C-Left: \033[1;7D ! Shift+Alt+Control URxvt*keysym.S-M-C-F1: \033[1;8P URxvt*keysym.S-M-C-F2: \033[1;8Q URxvt*keysym.S-M-C-F3: \033[1;8R URxvt*keysym.S-M-C-F4: \033[1;8S URxvt*keysym.S-M-C-F5: \033[15;8~ URxvt*keysym.S-M-C-F6: \033[17;8~ URxvt*keysym.S-M-C-F7: \033[18;8~ URxvt*keysym.S-M-C-F8: \033[19;8~ URxvt*keysym.S-M-C-F9: \033[20;8~ URxvt*keysym.S-M-C-F10: \033[21;8~ URxvt*keysym.S-M-C-F11: \033[23;8~ URxvt*keysym.S-M-C-F12: \033[24;8~ URxvt*keysym.S-M-C-Insert: \033[2;8~ URxvt*keysym.S-M-C-Delete: \033[3;8~ URxvt*keysym.S-M-C-Home: \033[1;8H URxvt*keysym.S-M-C-End: \033[1;8F URxvt*keysym.S-M-C-Page_Up: \033[5;8~ URxvt*keysym.S-M-C-Page_Down: \033[6;8~ URxvt*keysym.S-M-C-Up: \033[1;8A URxvt*keysym.S-M-C-Down: \033[1;8B URxvt*keysym.S-M-C-Right: \033[1;8C URxvt*keysym.S-M-C-Left: \033[1;8D

colour theme

finally, of course, theming URxvt with a colour pallet that suits your desktop is mandatory!

! color scheme URxvt*background: [90]#131d24 URxvt*foreground: #eeeeee URxvt*cursorColor: #eeeeee ! black URxvt.color0: #101010 URxvt.color8: #565656 ! red URxvt.color1: #bd4a4a URxvt.color9: #cc6666 ! green URxvt.color2: #778800 URxvt.color10: #88aa22 ! yellow URxvt.color3: #e8ae5b URxvt.color11: #ffd965 ! blue URxvt.color4: #3a526b URxvt.color12: #66aabb ! magenta URxvt.color5: #ff5879 URxvt.color13: #f26b9e ! cyan URxvt.color6: #72ad8c URxvt.color14: #9fe3bc ! white URxvt.color7: #fdf6e3 URxvt.color15: #c3c2c5

reload .Xresources

changes made to your ~/.Xresources file can be reloaded in your current X11 session with..

xrdb -merge ~/.Xresources

caveat

a caveat of running URxvt in client/server mode is that, if the daemon dies, all existing terminal clients will be lost—however, I have not experienced any such failures. A simple URxvt wrapper script automatically launches the server daemon if it is not already running..

#!/bin/sh export SHELL=/usr/bin/zsh urxvtc $@ if [ $? -eq 2 ]; then urxvtd -q -o -f urxvtc $@ fi

»»  mpd and pulseaudio

comment ?