User Tools

Site Tools


Terminal Emulators

This has taken me 34 years to finally get right!

EDIT: add a couple of years and now it's kitty on wayland. Notwithstanding this, my journey:

My path to termit (OK, a crap name):

  • xterm in the eighties - it was what we had and life was good
  • rxvt in the nineties - it was lighter when it really counted
  • urxvt/mrxvt in the noughties - it was cooler and I forget why else - it's prettier (no more bitmap fonts)
  • konsole in the (what to call them?) teens - has tabs, menus, search, unlimited scrollback

So, why would I ever stray from konsole?

  • it bloats, often taking up 10% of CPU while dormant
  • it gives up focus when Alt is pressed - and my thumb can't resist the Alt key
  • it refuses to pass C-S-Left/Right to bash and I love to tie that to shell-forward-word to skip over long filenames

I started a discussion with the really cool guys at i3wm and a number of candidates came up including several that were new to me such as lilyterm and termit.

termit just sails past all of the problems with konsole (although the configuration took me a week to get just right). And sensibly, it can map C-Tab and C-S-Tab to next/prev tab - something gnome-terminal, xfce-term, lxterminal etc just cannot do.

For the record I tried heaps including: gnome-terminal tilda lxterminal xfce4-terminal termit sakura roxterm others … ?

Also see this ancient 2004 article which really needs an update: The Grumpy Editor's guide to terminal emulators -

Here's my config (put it into ~/.config/termit/rc.lua):

function notify (url, msg)
    os.execute("notify-send '"..url.."' "..msg)

function handle_url_simple_copy (url)
    -- simply copies the url
    -- requires package xclip

    local url = string.gsub(url,"\n.+$", "")
    os.execute ("echo -n '"..url.."' | xclip -i -selection clipboard &")
    -- notify (url, "copied") - hangs when run with VMWare!

function handle_url_simple_open (url)
    -- simply opens the url
    -- requires package xdg-utils

    local url = string.gsub(url,"\n.+$", "")
    os.execute ("xdg-open '"..url.."' &")
    notify (url, "opened")

function handle_url_zenity (url)
    -- pops up a dialog to allow choice of copying or opening the url
    -- requires package zenity and the termit-zenity-dialog script

    local url = string.gsub(url,"\n.+$", "")
    os.execute("termit-zenity-dialog '"..url.."' &") -- make it async otherwise this termit waits

function handle_url_lgi (url)
    -- pops up a dialog to allow choice of copying or opening the url
    -- also allows editing of the url before copying/opening
    -- requires package lua-lgi and the termit-lgi-dialog script

    local url = string.gsub(url,"\n.+$", "")
    os.execute("termit-lgi-dialog '"..url.."' &") -- make it async otherwise this termit waits

defaults = {}
defaults.windowTitle = 'Termit'
defaults.tabName = 'Terminal'
defaults.encoding = 'UTF-8'
defaults.wordChars = '+-AA-Za-z0-9,./?%&#:_~'
defaults.scrollbackLines = 4096
defaults.font = 'Monospace 10'
defaults.geometry = '80x24'
defaults.hideSingleTab = false
defaults.showScrollbar = true
defaults.fillTabbar = false
defaults.hideMenubar = true
defaults.allowChangingTitle = true
defaults.visibleBell = false
defaults.audibleBell = false
defaults.urgencyOnBell = false
defaults.matches = {['https*://[^ \'\"]+'] = handle_url_simple_copy } -- choose one of the above
defaults.foregroundColor = 'white'
defaults.backgroundColor = 'black'


function get_primary()
    -- os.execute ("xvkbd -text '\\m2' || xdotool click 2")
    os.execute ("xdotool click 2")

function changeTabFontSize(delta)
    tab = tabs[currentTabIndex()]
    setTabFont(string.sub(tab.font, 1, string.find(tab.font, '[0-9.]+$') - 1)..(tab.fontSize + delta))

bindKey('Ctrl-t', nil) -- needed for bash - swap chars
bindKey('CtrlShift-t', openTab)
bindKey('CtrlShift-Tab', prevTab)
bindKey('Ctrl-Tab', nextTab)
bindKey('CtrlShift-f', toggleMenubar)
bindKey('CtrlShift-g', toggleTabbar)
bindKey('CtrlShift-v', paste)
bindKey('CtrlShift-c', copy)
bindKey('Shift-Delete', copy)
bindKey('Ctrl-Insert', copy)
bindKey('Shift-Insert', function() get_primary() end)
bindKey('Ctrl-F1', function () activateTab(1) end)
bindKey('Ctrl-F2', function () activateTab(2) end)
bindKey('Ctrl-F3', function () activateTab(3) end)
bindKey('Ctrl-F4', function () activateTab(4) end)
bindKey('Ctrl-F5', function () activateTab(5) end)
bindKey('Ctrl-F6', function () activateTab(6) end)
bindKey('Ctrl-F7', function () activateTab(7) end)
bindKey('Ctrl-F8', function () activateTab(8) end)
bindKey('Ctrl-F9', function () activateTab(9) end)

bindKey('CtrlShift-equal', function () changeTabFontSize(1) end)
bindKey('Ctrl-equal', function () changeTabFontSize(1) end)
bindKey('Ctrl-minus', function () changeTabFontSize(-1) end)
bindKey('Ctrl-0', function () setTabFont(defaults.font) end)

terminal.txt · Last modified: 2020/10/15 00:05 by admin