A GTK4 terminal emulator for MidnightBSD, written in Rust. It provides tabs, color themes, selectable ANSI palettes, Unicode support, and OSC 52 remote copy/paste.
- Tabs: open, close, rename, reorder, and switch tabs. Tab titles follow the title the shell or program sets (OSC 0/2) unless you set a custom one.
- Terminal emulation: choose
$TERMper tab:xterm-256color(default),xterm,xterm-color,vt100, orvt220. Supports 256-color and 24-bit color, the alternate screen, scroll regions, DEC line drawing, and bracketed paste. - Unicode: wide (CJK) characters and combining marks.
- Color themes: Midnight Dark (default), Solarized Dark, Daylight Light, VT100 Green, Amber, Novel, and Ocean.
- ANSI palettes: keep each theme's tuned palette or swap in MidnightBSD Console, Tango, XTerm, Linux Console, Rxvt, Solarized, or Pastel. The Preferences panel warns when a palette has colors that are hard to read on the current background.
- OSC 52 clipboard: programs on remote hosts (for example inside
sshortmux) can copy to, and optionally read from, your local clipboard. - Scrollback: configurable length, mouse wheel and Shift+PageUp/PageDown.
- Rust 1.85 or newer (the crate uses the 2024 edition)
- GTK 4.10 or newer, plus Pango and Cairo
pkg-config(orpkgconf)
On MidnightBSD:
mport install rust gtk4 pkgconfOn other systems, install your distribution's Rust toolchain (or use rustup) and its GTK 4 development package.
git clone https://github.com/MidnightBSD/mterm.git
cd mterm
cargo build --releaseThe binary is written to target/release/mterm. To install it for your user:
cargo install --path .This places mterm in ~/.cargo/bin.
data/org.midnightbsd.mterm.desktop adds Midnight Terminal to desktop
application menus (under System). It runs mterm from your PATH. Install
the desktop entry and icon system-wide:
install -d /usr/local/share/applications /usr/local/share/icons/hicolor/256x256/apps
install -m 644 data/org.midnightbsd.mterm.desktop /usr/local/share/applications/
install -m 644 data/icons/hicolor/256x256/apps/org.midnightbsd.mterm.png \
/usr/local/share/icons/hicolor/256x256/apps/
update-desktop-database /usr/local/share/applicationsor for just your user:
data_home="${XDG_DATA_HOME:-$HOME/.local/share}"
install -d "$data_home/applications" "$data_home/icons/hicolor/256x256/apps"
install -m 644 data/org.midnightbsd.mterm.desktop "$data_home/applications/"
install -m 644 data/icons/hicolor/256x256/apps/org.midnightbsd.mterm.png \
"$data_home/icons/hicolor/256x256/apps/"Run the tests with:
cargo testStart it with mterm. It launches your login shell from $SHELL, or
/bin/sh if that is unset. Shells see TERM set to the selected emulation,
COLORTERM=truecolor for color-capable emulations, and TERM_PROGRAM=mterm.
| Action | Shortcut |
|---|---|
| New tab | Ctrl+Shift+T |
| Close tab | Ctrl+Shift+W |
| Copy | Ctrl+Shift+C |
| Paste | Ctrl+Shift+V |
| Paste primary selection | Shift+Insert, or middle-click |
| Rename tab | Ctrl+Shift+R, or double-click the tab |
| Previous / next tab | Ctrl+PageUp / Ctrl+PageDown |
| Go to tab 1–9 | Alt+1 … Alt+9 |
| Scroll back / forward | Shift+PageUp / Shift+PageDown, or the mouse wheel |
Selecting text with the mouse copies it to the primary selection.
Open Edit → Preferences & Profiles to change the emulation, font, colors, scrollback length, OSC 52 permissions, and ANSI palette. Click a color preset, optionally adjust it, then Apply & Save Profile.
Settings are saved to ~/.config/mterm/config.toml and used for new tabs.
When a remote program sends an OSC 52 sequence, mterm puts the text on your local clipboard. Both copying (write) and clipboard queries (read) are enabled by default; turn either off in Preferences. Terminal → OSC 52 Remote Clipboard has a short guide and a live test.
For tmux, enable clipboard passthrough in ~/.tmux.conf:
set -g set-clipboard on
- Renderer: mterm uses GTK's Cairo renderer by default. To try the GL
renderer, run
GSK_RENDERER=gl mterm. - IBus on GTK 4.24: the IBus GTK4 input-method module in IBus 1.5.34
and earlier recurses infinitely when used with GTK 4.24, crashing any GTK4
application that has a text field. MidnightBSD's
textproc/ibusport carries a fix (MidnightBSD/mports#3595). On an unpatched system, start mterm withGTK_IM_MODULE=gtk-im-context-simpleas a workaround.
BSD 2-Clause. See LICENSE.