rxvt 是一款相當受歡迎的終端機程式:佔用資源少、啟動速度快,在輕量級桌面環境裡特別好用。本文以 Debian 系列為例,說明如何安裝能正確顯示中文的 rxvt,並提供一份可直接套用的個人設定檔範例。
Debian 的軟體庫裡有多個 rxvt 相關套件,可以先用 apt-cache search rxvt 查詢,大致分為三類:
第一種既然無法顯示中文,這裡就不討論。以下分別說明 rxvt-ml 與 rxvt-unicode 的安裝方式。
使用前請先把 GNOME 或 KDE 桌面的中文環境設定好(包含 locale 與中文輸入法,本文以 fcitx 為例),rxvt 裡才可能正常顯示中文並呼叫輸入法。
apt-get install rxvt-ml
安裝完成後,/usr/bin 底下會產生多個程式,各自對應不同的語言編碼環境:
接著把 locale 設為 zh_CN.GB2312(設定方式請參考 GNOME 或 KDE 的 locale 設定),重新登入 X 工作階段讓設定生效,之後就能用 crxvt-gb 開出中文終端機了。
rxvt-unicode 的設定寫在 $HOME/.Xdefaults(新版亦可放 $HOME/.Xresources,修改後用 xrdb -merge 載入)。以下是一份完整的實用範例:
!! $HOME/.Xdefaults Rxvt.preeditType: root !! 視窗大小與標題 Rxvt.geometry: 80x25 Rxvt.title: hutaow-rxvt !! 輸入法設定 Rxvt.inputMethod: fcitx !! 透明度設定 !Rxvt.transparent: true !Rxvt.shading: 110 !Rxvt.tintColor: grey !Rxvt.inheritPixmap: false !! 擴充功能 Rxvt.perl-ext-common: default, matcher, fullscreen !! URL 操作 Rxvt.urlLauncher: /usr/bin/chromium Rxvt.matcher.button: 1 !! 分頁設定 !Rxvt.perl-ext-common: ..., tabbed, ... !Rxvt.tabbed.tabbar-fg: 2 !Rxvt.tabbed.tabbar-bg: 0 !Rxvt.tabbed.tab-fg: 3 !Rxvt.tabbed.tab-bg: 0 !Rxvt.tabbed.new-button: false !Rxvt.tabbed.autohide: true !RXvt.tabbed.reopen-on-close: no !Rxvt.keysym.Control-t: perl:tabbedex:new_tab !Rxvt.keysym.Control-Tab: perl:tabbedex:next_tab !Rxvt.keysym.Control-Shift-Tab: perl:tabbedex:prev_tab !Rxvt.keysym.Control-Shift-Left: perl:tabbedex:move_tab_left !Rxvt.keysym.Control-Shift-Right: perl:tabbedex:move_tab_right !Rxvt.keysym.Control-Shift-R: perl:tabbedex:rename_tab !! 全螢幕模式 !Rxvt.perl-ext-common: ..., fullscreen, ... Rxvt.keysym.F11: perl:fullscreen:switch !! 捲軸設定 Rxvt.scrollBar: true Rxvt.scrollBar_right: true Rxvt.scrollBar_floating: false Rxvt.scrollstyle: plain !! 捲動行為 Rxvt.mouseWheelScrollPage: false Rxvt.scrollTtyOutput: false Rxvt.scrollWithBuffer: true Rxvt.scrollTtyKeypress: true !! 游標閃爍 Rxvt.cursorBlink: true !! 回捲緩衝行數 Rxvt.saveLines: 5000 !! 邊框 Rxvt.borderLess: false !! 字型 Rxvt.dpi: 96 Rxvt.*font: xft:Terminus,xft:WenQuanYi Bitmap Song !! 色彩 Rxvt.depth: 32 Rxvt.background: #2C2C2C Rxvt.foreground: 7 Rxvt.colorBD: 7 Rxvt.colorUL: 7 !! 基本色 Rxvt.color0: #3F3F3F Rxvt.color8: #709080 Rxvt.color1: #705050 Rxvt.color9: #DCA3A3 Rxvt.color2: #60B48A Rxvt.color10: #72D5A3 Rxvt.color3: #DFAF8F Rxvt.color11: #F0DFAF Rxvt.color4: #9AB8D7 Rxvt.color12: #94BFF3 Rxvt.color5: #DC8CC3 Rxvt.color13: #EC93D3 Rxvt.color6: #8CD0D3 Rxvt.color14: #93E0E3 Rxvt.color7: #DCDCDC Rxvt.color15: #FFFFFF
套用後的實際外觀如下:

如果只為了解決中文問題,rxvt-ml 加上正確的 locale 就足夠;若你會大量處理多語言文字、需要 Unicode 與分頁、透明度等進階功能,rxvt-unicode 會更合適。修改 .Xdefaults 後記得重新載入或重開終端機,設定才會生效。