Install Urxvt on FreeBSD
In this tutorial, I explain how we do and edit the URXVT terminal.
rxvt-unicode is a modified clone of the well-known terminal emulator rxvt for storing text in Unicode (either UCS-2 or UCS-4) and for using the correct country setting for input and output. It also supports blending multiple fonts at once, including XFT fonts.
Furthermore, we installed the following extension:
- urxvt-font-size: this is a Perl extension for rxvt-unicode with which we can change the font size in no time with keyboard shortcuts.
We can install the packages as follows:
$: doas pkg install rxvt-unicode urxvt-font-size
We enter the following in our autostart script (e.g., for Openbox: ~/.config/openbox/autostart):
urxvtd -q -f -o
The advantages of an urxvt daemon include a faster creation time for terminal windows and much-saved memory usage.
The disadvantage is a possible impairment of stability – if the main program crashes, all processes in the terminal windows are aborted. For example, since there is no way to react properly to abnormal connection interruptions, the urxvtd instance, including all open windows, is terminated by “xkill”, and resetting/restarting the server.
We can now start the terminal with the command urxvtc
.
Styling
With the following .Xdefaults, we can install a lovely dark theme for our new terminal.
We'll install the hack font first.
$: doas pkg install hack-font
nano .Xdefaults =>
!-------------------------------------------------------------------------------
! Xft settings
!-------------------------------------------------------------------------------
Xft.dpi: 96
Xft.antialias: true
Xft.rgba: rgb
Xft.hinting: true
Xft.hintstyle: hintslight
!-------------------------------------------------------------------------------
! URxvt settings
!-------------------------------------------------------------------------------
URxvt.depth: 256
URxvt.geometry: 90x30
URxvt.transparent: false
URxvt.loginShell: true
URxvt.visualBell: false
URxvt.termName: rxvt-unicode-256color
! Fonts
URxvt*font: xft:Hack:pixelsize=14
URxvt*boldFont: xft:Hack:pixelsize=14
URxvt.letterSpace: -1
! Scrollbar
URxvt.scrollStyle: rxvt
URxvt.scrollBar: false
! Perl extensions
URxvt.perl-ext-common: default,url-select,tabbed,font-size
URxvt.keysym.M-u: perl:url-select:select_next
URxvt.url-select.launcher: firefox -new-tab
URxvt.url-select.underline: true
URxvt.keysym.M-c: perl:clipboard:copy
URxvt.keysym.M-v: perl:clipboard:paste
URxvt.tabbed.tabbar-fg: 2
URxvt.tabbed.tabbar-bg: 0
URxvt.tabbed.tab-fg: 3
URxvt.tabbed.tab-bg: 0
! special
*.foreground: #d2d4de
*.background: #161821
*.cursorColor: #d2d4de
! black
*.color0: #161821
*.color8: #6b7089
! red
*.color1: #e27878
*.color9: #e98989
! green
*.color2: #b4be82
*.color10: #c0ca8e
! yellow
*.color3: #e2a478
*.color11: #e9b189
! blue
*.color4: #84a0c6
*.color12: #91acd1
! magenta
*.color5: #a093c7
*.color13: #ada0d3
! cyan
*.color6: #89b8c2
*.color14: #95c4ce
! white
*.color7: #c6c8d1
*.color15: #d2d4de
Shortcuts
tabs
Shift + Down: New tab Shift + Left: Go to the left tab Shift + Right: Go to the correct tab Ctrl + Left: Move the tab to the left Ctrl + right: Move tab right Ctrl + d: Close tab
font size
Ctrl + +: Drag the font size Ctrl + -: Reduce the font size Ctrl + 0: Reset the font size