Terminals

From miki
Jump to navigation Jump to search

Terminals on Linux

Gnome Terminal

The default terminal on Ubuntu.

Configure cursor type

Use gconftool to configure once for all

gconftool-2 --type string --set /apps/gnome-terminal/profiles/Default/cursor_shape <VALUE>

Or use escape sequence for changing it from application [1]:

echo -ne '\e[0 q'    # reset to profile's setting
echo -ne '\e[1 q'    # blinking block
echo -ne '\e[2 q'    # steady block
echo -ne '\e[3 q'    # blinking underline
echo -ne '\e[4 q'    # steady underline
echo -ne '\e[5 q'    # blinking I-beam
echo -ne '\e[6 q'    # steady I-beam

Gnome Terminator

A multipane terminal emulator based on Gnome Terminal.

Install it with

sudo add-apt-repository ppa:gnome-terminator          # Not needed on Ubuntu Precise (part of Universe repo)
sudo apt-get update
sudo apt-get install terminator

Terminator on GTK3

  • See bug 1030562 (#101) to download package. But you still need to install package dependencies manually.
# Get terminator/gtk3 sources
sudo apt install bzr
bzr branch lp:terminator/gtk3
cd gtk3

# Apply latest patches
sudo apt install bzrtools
bzr patch <(wget -O - https://bugs.launchpad.net/terminator/+bug/1520377/+attachment/4526119/+files/terminator-1520377-stale-tab-title.patch)
bzr patch <(wget -O - https://bugs.launchpad.net/terminator/+bug/1522542/+attachment/4535308/+files/terminator-1522542-rotate.patch)
bzr patch <(wget -O - https://bugs.launchpad.net/terminator/+bug/1520969/+attachment/4633044/+files/terminator-1520969-distribute-evenly-v3.patch)

# Install dependencies
sudo apt build-dep terminator
sudo apt install gir1.2-keybinder-0.0 gir1.2-keybinder-3.0 libkeybinder-3.0-0 build-essential intltool libgtk-3-dev gobject-introspection libgirepository1.0-dev valac terminator
sudo apt install cdbs

# ... and quick fix for python-support
# (a better solution would be to apply https://wiki.debian.org/Python/TransitionToDHPython2)
sudo apt install dh-python
sudo ln -sf dh_python2 /usr/bin/dh_pysupport

# Change COLORTERM to gnome-terminal -- Fix broken vertical mode in neovim
vi terminatorlib/config.py
# Replace 'truecolor' by 'gnome-terminal'

# Change version and build
# debchange --newversion 1.97~ppa3~local --distribution xenial-proposed "gtk3 branch with patches 1520377, 1522542, 1520969"
debchange --newversion 1.97~ppa3~local2 --distribution xenial-proposed "Fix broken vertical mode in neovim"
dpkg-buildpackage -rfakeroot -b -d

# Install
cd ..
sudo dpkg -i terminator_1.97~ppa3~local_all.deb

My default configuration

Tip - Using Terminator for console application

Say we want to run a custom console application with a custom icon. We can use terminator as follows:

terminator -m -p nvim -i /usr/local/icons/neovim.png -u -x nvim
# -m         Maximize
# -p nvim    Select custom profile (see below)
# -i ...     Select custom icon
# -u         Don't use DBus (to avoid terminal appearing in background, see https://bugs.launchpad.net/terminator/+bug/1508531)
# -x nvim    The application to start

We configured the profile as follows. The important settings are scroll_on_keystroke, scrollbar_position and show_titlebar.

  [[nvim]]
    background_color = "#ffffdd"
    cursor_color = "#aaaaaa"
    font = Fantasque Sans Mono 10
    foreground_color = "#000000"
    scroll_on_keystroke = False
    scrollbar_position = hidden
    show_titlebar = False
    use_system_font = False

On Cygwin

  • Copy C:\cygwin\bin\run.exe as C:\cygwin\bin\runpython.exe (wrapper, see man run).
  • Create windows shortcut by duplicating e.g. xterm shortcut and changing command to
C:\cygwin\bin\runpython.exe -p /usr/X11R6/bin /usr/bin/terminator --geometry=1435x860+0+0
There is an icon at /usr/share/icons/hicolors/32x32/apps/terminator.png (convert to .ico with gimp)
  • Add a new user environment variable DISPLAY = 127.0.0.1:0.0
  • Configuration ~/.config/terminator/config:
[global_config]
[keybindings]
  full_screen = <Alt>F11
[profiles]
  [[default]]
    use_system_font = False
    login_shell = True
    foreground_color = "#000000"
    font = Bitstream Vera Sans Mono 9
    background_color = "#ffffdd"
    scrollback_infinite = True
[layouts]
  [[default]]
    [[[child1]]]
      type = Terminal
      parent = window0
    [[[window0]]]
      type = Window
      parent = ""
[plugins]

Xterm

Xterm is the legacy terminal emulator under X. See Xterm.

RXVT / uRXVT

Alacritty

Alacritty is a new GPU-accelerated terminal, touted to be the fastest terminal ever.

Troubleshoot
  • Fixed — Slower than Gnome Terminal / Terminator on Ubuntu with Intel MESA driver (i915). On Vim, jitter in the scrolling.
See Issue #225. Now fixed.

st (simple terminal)

st, aka simple terminal from suckless.org, is a simple terminal implementation for X, that sucks less.

On Ubuntu, install either from package

sudo apt install stterm

Or download the git repository and compile from source.

git clone git://git.suckless.org/st
cd st
make clean install

To configure st, edit config.h and build again. Check also the excellent ArchLinux page on st.

Notty

From Notty project page: notty is a virtual terminal like xterm, gnome-vte, sh, or rxvt. Unlike these programs, notty is not intended to emulate a DEC VT-series physical video terminal, or any other physical device. Instead, notty is an experimental project to bring new features to the command-line which would not have been possible for the physical terminals other terminals emulate.

Terminal features

Terminfo

256-color support

True-color support

Reference:

Cursor type

  • Block vs Caret
  • Blinking vs steady