korterm/README.md
Ivan Cherniy 59457f4fa7 README: packages are signed and published by pkgs from dist/
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-18 16:13:00 +03:00

363 lines
23 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# KorTerm
**A terminal emulator for Linux with GPU rendering, profiles and themes.** It is built on
`alacritty_terminal` for the VT state and GTK 4 with OpenGL for the window, so it feels native
in Cinnamon and stays fast on large output. Themes default to Kornord Dark.
## Features
- **GPU rendering** — glyphs come from a glyph atlas drawn with OpenGL 3.3 in one draw call per
frame. Fonts are picked by family name through fontconfig.
- **Profiles** — each profile sets a command, a working directory, scrollback length, font and
theme. Unset fields inherit the top-level settings. A `Default` profile always exists;
`default_profile` picks the startup profile.
- **Themes** — Kornord Dark (default; the Nord palette) and Kornord Light, Solarized Dark and Light, Dracula and Dracula Light (the Alucard palette), Gruvbox Dark and Light ship built in. The tab strip, side panels and bars take their colours from the GTK theme of the desktop, or from the theme of the default profile (`interface-colors`). `Nord` is the old name of Kornord Dark and still works in `config.yaml`. Your own
themes are YAML files in `~/.config/korterm/themes/`. A user theme with a built-in name replaces it.
- **Selection and clipboard** — drag to select, double-click for a word, Select All, Ctrl+Shift+C to
copy and Ctrl+Shift+V to paste. `copy-on-select` can copy to the clipboard or the primary selection.
Paste uses bracketed paste when the program asks for it.
- **Right-click menu** — Copy, Paste and Select All.
- **Scrollback** — mouse wheel and Shift+PageUp/PageDown. Typing returns to the live screen.
- **Cursor** — block, bar or underline, with optional blinking.
- **Links** — Ctrl+click opens `http` and `https` URLs. Other schemes are never opened.
- **Tabs** — Ctrl+Shift+T opens, Ctrl+Shift+W closes, Ctrl+PageUp/PageDown switch. Drag a tab
to reorder it; double-click a tab to rename it (Enter applies, Escape cancels).
- **Split panes** — Ctrl+Shift+E splits side by side, Ctrl+Shift+O stacks, Ctrl+Shift+X closes the
focused pane. Both split directions have header buttons; repeated splits divide the focused pane
and focus the new one. Drag a divider with the mouse; each pane is sized to its area.
- **Window title** — follows the active local pane's working directory, abbreviating home as `~`.
Switching tabs or panes updates the title without changing tab names. SSH and playback retain
their session title when a local directory would be misleading or unavailable.
- **Rounded window** — 12-pixel corners in normal mode, square corners when maximized or fullscreen.
On X11, transparent corners require a compositing window manager.
- **Font zoom** — Ctrl+plus, Ctrl+minus, Ctrl+0 and Ctrl+wheel change the font size.
- **SSH hosts** (a plugin, off by default) — the header button with the server icon opens a side panel
with the hosts of your `~/.ssh/config`. Each host is a card with its name and `user@host:port`;
groups are colour-coded sections you can collapse. Double-click a host (or press Enter) to connect
in a new tab named after it; right-click for Connect, Edit, Duplicate, Move to group, Copy address
or ssh command and Delete (asks first); right-click a group to add a host to it, rename it, pick its
colour or icon, move it up or down, or delete it. Group icons default to a folder and can be
reset in the icon picker. Hovering a group shows its full name. `+` adds a host,
and dragging a card onto a group moves it;
dropping a card directly on another host's card also joins that card's group (if different) and
takes the position right next to it. Drag the
divider between the panel and the terminal to change the panel's width; it is remembered. Typing `user@host`
in the search field and pressing Enter connects to an address that is not in the list.
Up/Down selects visible hosts without leaving the search field; Enter connects to the selected host.
The panel scrolls to the selection and skips hosts in collapsed groups. Host cards also support Up/Down.
`~/.ssh/config` is the source of truth: the panel edits only the block of the host you change (and
only `HostName`, `User`, `Port`, `IdentityFile` and `ProxyJump`), keeps comments and other keys,
and leaves a copy as `config.korterm.bak` the first time it writes in a run. Changes made to the
file elsewhere show up at once. Hosts that share a `Host a b` line are shown but not editable.
Groups and their colours live in `~/.config/korterm/hosts.yaml`.
Authentication uses `ssh` and `ssh-agent`; optional saved passwords use the storage described below.
Preferences → Plugins (or `ssh-manager: true`)
turns it on; the gear next to it holds the plugin's own settings. A host of the SSH config is
connected to by its name, as if you typed `ssh server`, so everything in its block applies.
**Open SFTP in file manager** in a host's menu opens `sftp://<name>/` in the system's file
manager for such links, or with the command the plugin's settings name (`ssh-file-manager`, e.g. `nautilus --new-window`). The
panel is shown and hidden with **F2** (change or turn it off in the gear or in Shortcuts; F1 shows
About). Note that a function key bound alone no longer reaches programs in the terminal, such as
mc or htop.
A host can also keep a **password** (Password field in its dialog). It goes into the system
keyring (Secret Service: GNOME Keyring, KWallet) when there is one; when there is not, you are
warned and asked before it is written as plain text to `~/.config/korterm/secrets.yaml`.
File permissions restrict access, but programs running as your account can still read the file.
Backups and synchronization can copy plaintext passwords; exclude this file or protect those copies.
KorTerm does not offer plaintext storage when an existing keyring refuses access.
A key on the card marks such hosts. When ssh asks for a password, korterm
types the saved one, once and only into that tab, within 30 seconds of opening it; the host key
question (`yes/no`) and a second prompt after a wrong password are left to you. Tabs opened from
the panel are titled `user@host` and carry a stripe along their bottom edge in the group's colour
(blue-grey for a host without a group). A connection that fails keeps its tab open to show ssh's
own error text instead of closing at once; press any key, or close it as usual, to dismiss it.
- **Quick commands** (a plugin, off by default) — a thin bar under the terminal with a button per
command, as in XShell. A click types the command into the focused pane: a text that ends with a
line break runs, one without is only typed and waits for your Enter. A whole script works too: in
bash, zsh and fish it arrives as one paste, so nothing runs before its last line break. The first
button lists every command with a search. **F3** opens the same searchable list on its own,
whether or not the bar is shown; type to filter, use Up/Down to select a result, then Enter to
send the selected command. Selection scrolls into view without moving focus from search. Right-click a
button for Run, Type without Enter, Edit, Duplicate, Move, Move to group and Delete, or the bar
to add a command or a new group. A **group** gets a distinct button with a folder icon by default;
its menu can change or reset the icon. A click opens a vertically scrollable command popover.
The ordinary vertical mouse wheel scrolls the horizontal bar, without changing popup scrolling.
Hovering shows the full group or command name. Commands and groups retain their mixed order;
deleting a group asks for confirmation and expands its commands in place as ordinary buttons.
The all-commands list caches its rows and search index, preparing their layout before opening.
Search filters existing rows; model changes invalidate the cache without interrupting a drag. The
commands live in `~/.config/korterm/quick-commands.yaml` and every window shows a change at once.
Preferences → Plugins (or `quick-commands: true`) turns it on; its gear edits the list and sets
both keys (F3 for the list; the bar's own show-or-hide key has none at first; also "Quick
commands bar" in the main menu).
- **Session recording** (a plugin, off by default) — a record button in the header with three
switches, *Record this tab* (with its panes), *Record this session* and *Record everything* (every
pane of every window). The button turns red while the focused pane is recorded. Each pane goes to
its own recording, filed under the host it is connected to by ssh, or `korterm`; panes
opened inside a recorded tab or session are recorded from their start.
KorTerm records terminal output, not keystrokes.
A password normally stays absent only when the program does not echo or otherwise print it.
Recordings keep any secrets in output, including tokens, command arguments and file contents.
*Session recordings…* in the record button's menu opens a window listing them, with their
size and status, a way to view one's own output and to delete it. Recordings are kept in
[korecord](https://git.r4ven.me/ivan/korecord)-compatible archives with KorTerm's own index.
KorTerm reads and writes them itself, so `korec` does not need to be installed.
Storage and settings are independent of korec: recordings and their index live in
`~/.local/share/korterm/recordings/`, and recording settings live in
`~/.config/korterm/recordings/config.json` (both respect XDG paths).
`KORTERM_RECORDINGS_DATA_DIR` overrides the recording directory. Old korec files are not
listed, moved, repaired or deleted automatically. *Record everything, always*
(`record-always`) is in the plugin's gear, along with a key for the tab switch. With
encryption enabled in KorTerm's recording configuration, its password must be stored there
or set in `KORTERM_RECORDINGS_PASSWORD`. KorTerm does not read `KORECORD_*` variables.
Encryption protects the completed archive, not the plaintext intermediate file used during recording.
A crash, write error or queue overflow can leave that intermediate file behind.
Backups and synchronization can copy it before encryption; file permissions do not encrypt its contents.
- **Preferences** — right-click, Preferences…: font, profiles with their colour schemes, and behaviour, applied at once.
The Plugins page switches optional features on and off.
Save writes `config.yaml`, keeps the previous file as `config.yaml.bak`, and closes Preferences
after the configuration and autostart entry are saved successfully.
- **Toggle** — `korterm --toggle` shows or hides the primary window; other windows are not touched.
- **Find** — Ctrl+Shift+F opens a search bar above the terminal. It searches the scrollback and
highlights every match; Enter and Shift+Enter (or Ctrl+G and Ctrl+Shift+G from the terminal) move
between them. The `Aa` and `.*` switches make the search case-sensitive or a regular expression.
- **Quit** — `korterm --quit` closes every window and terminal session of the running instance,
without asking. Bind it to a key if you want one-key shutdown.
- **Tray icon** — `tray-icon: true` adds a StatusNotifier icon (click toggles the windows; menu:
Show, Hide, Preferences, About, Quit). Closing a window then hides it instead of quitting.
`autostart: true` writes an XDG autostart entry on Save, and `autostart-hidden: true` uses the
flicker-free `--hidden` startup mode (needs an available tray icon). Without a tray watcher, the
window stays visible.
## Install
### From the package repositories (pkgs.r4ven.me)
Debian, Ubuntu, Linux Mint:
```bash
sudo install -d -m 0755 /etc/apt/keyrings
sudo curl -fsSL https://pkgs.r4ven.me/r4ven-pkgs.asc -o /etc/apt/keyrings/r4ven-pkgs.asc
sudo tee /etc/apt/sources.list.d/r4ven.sources << EOF
Types: deb
URIs: https://pkgs.r4ven.me/deb
Suites: stable
Components: main
Signed-By: /etc/apt/keyrings/r4ven-pkgs.asc
EOF
sudo apt update && sudo apt install korterm
```
Fedora:
```bash
sudo tee /etc/yum.repos.d/r4ven.repo << 'EOF'
[r4ven]
name=r4ven.me packages
baseurl=https://pkgs.r4ven.me/rpm/$basearch
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://pkgs.r4ven.me/r4ven-pkgs.asc
EOF
sudo dnf install korterm
```
Arch Linux (the fingerprint is on [pkgs.r4ven.me](https://pkgs.r4ven.me)):
```bash
curl -fsSL https://pkgs.r4ven.me/r4ven-pkgs.asc | sudo pacman-key --add -
sudo pacman-key --lsign-key <FINGERPRINT>
sudo tee -a /etc/pacman.conf << 'EOF'
[r4ven]
Server = https://pkgs.r4ven.me/arch/$arch
EOF
sudo pacman -Sy korterm
```
The repositories are signed; the usual update command brings the new versions. Details: [ivan/pkgs](https://git.r4ven.me/ivan/pkgs).
### From a release (.deb, .rpm, Arch)
Download the package and `SHA256SUMS` from the
[Releases](https://git.r4ven.me/ivan/korterm/releases) page, then:
```bash
sha256sum -c SHA256SUMS --ignore-missing
sudo apt install ./korterm_<version>_amd64.deb # Debian, Ubuntu, Linux Mint
sudo dnf install ./korterm-<version>-1.x86_64.rpm # Fedora
sudo pacman -U ./korterm-<version>-1-x86_64.pkg.tar.zst # Arch Linux
```
The package is built for amd64 on Ubuntu 24.04 (glibc 2.39). It runs on Ubuntu 24.04 or newer, Debian 13 and
Linux Mint 22. It installs the default font, Hack Nerd Font Mono, and the licence notices in `/usr/share/doc/korterm/`.
### From source
```bash
make install # binary to ~/.local/bin; desktop entry, icons and fonts to ~/.local/share
korterm
```
Building requires stable Rust, a C toolchain, `pkg-config`, and development files for GTK 4.10+, fontconfig, FreeType and OpenGL.
On Linux Mint 22, install `build-essential`, `pkg-config`, `libgtk-4-dev`, `libfontconfig-dev`, `libfreetype-dev` and `libgl-dev`.
Running requires OpenGL 3.3 support.
Tests also require `python3` for recording-format compatibility checks.
The SSH plugin requires `ssh`; saved passwords normally use a Secret Service keyring.
Opening SFTP requires a file manager with SFTP support.
Ensure `~/.local/bin` appears in `PATH` before running `korterm`:
```bash
export PATH="$HOME/.local/bin:$PATH"
command -v korterm
```
Add that export to your shell configuration if needed.
Run `make uninstall` to remove files installed by `make install`.
Use the same `PREFIX` for installation and removal if you override its default.
Removal keeps your configuration and recordings.
To build the `.deb`, `.rpm` and Arch packages with Docker, run `scripts/build-packages.sh` from a clean checkout.
The packages are signed and published by the [pkgs](https://git.r4ven.me/ivan/pkgs) project: push the tag to `public`, then run `make release SRC=../korterm/dist REPO=ivan/korterm TAG=vX.Y.Z` there.
Packages are built for amd64 on Ubuntu 24.04 (glibc 2.39), so they need Ubuntu 24.04, Debian 13 or newer.
The script writes packages to `dist/`.
## Configuration
Settings live in `$XDG_CONFIG_HOME/korterm/config.yaml` (default `~/.config/korterm/config.yaml`).
A missing file means defaults. Unknown keys and invalid values are reported at startup and the
defaults are used.
```yaml
font:
family: JetBrains Mono
size: 13
theme: Kornord Dark # colour scheme for profiles that do not name one
default_profile: Work
profiles:
- name: Work
command: [bash, -l]
working_directory: /home/me/src
scrollback_lines: 20000
theme: Dracula
font:
size: 14
- name: Logs
command: [journalctl, -f]
copy-on-select: clipboard
cursor-style: bar
cursor-style-blink: true
link-url: true
```
| Key | Default | Meaning |
|---|---|---|
| `font.family`, `font.size` | `Hack Nerd Font Mono`, desktop size or `14` | Default font; size is 4–72 points. The `.deb` installs Hack Nerd Font Mono. Without it the system monospace font is used. |
| `font.line-spacing` | `0` | Extra pixels between rows (−10 to 40), split above and below the text. |
| `font.letter-spacing` | `0` | Extra pixels between characters (−5 to 20). |
| `theme` | `Kornord Dark` | Colour scheme for profiles that do not name one. Built-in or user theme name. |
| `adapt-extended-colors` | `false` | Match indexed colours 16–255 to the theme. Profiles inherit this value unless they override it. |
| `default_profile`, `profiles` | first profile | Profiles as above; `working_directory` must be absolute; `scrollback_lines` up to 100000. |
| `copy-on-select` | `off` | `off`, `clipboard` or `primary`. |
| `clipboard-trim-trailing-spaces` | `true` | Remove trailing spaces from each copied line. |
| `paste-confirm` | `false` | Show multi-line pastes in an Advanced Paste dialog first, where they can be edited. |
| `paste-indent` | `keep` | Starting choice in that dialog: `keep`, `tabs-to-spaces` or `spaces-to-tabs`. |
| `paste-tab-width` | `4` | Columns per tab for `paste-indent` (1 to 16). |
| `paste-crlf-to-lf` | `true` | Starting choice in that dialog: convert CRLF and CR to LF. |
| `tab-title` | empty | Tab name template: `{title}`, `{cwd}`, `{cwd-name}`, `{user}`, `{host}`. Empty shows the shell's title. |
| `double-click-empty-tab-bar-new-tab` | `false` | Double-click empty tab-bar space to open a new tab in that group. |
| `middle-click-tab-close` | `false` | Close a tab by middle-clicking anywhere on its tab button. |
| `selection-word-chars` | common separators | Characters that end a word for double-click. |
| `mouse-hide-while-typing` | `true` | Hide the pointer while typing. |
| `cursor-style` | `block` | `block`, `bar` or `underline`. Programs may change it (vim uses a bar in insert mode); this is the shape they start from. |
| `interface-colors` | `gtk` | Where the tab strip, side panels and bars take their colours from: `gtk` (the GTK theme of the desktop, light or dark) or `terminal` (the theme of the default profile). Preferences → General. |
| `cursor-style-blink` | `true` | Blink the cursor. |
| `ssh-manager` | `false` | The SSH hosts plugin: header button and side panel (Preferences → Plugins). |
| `ssh-file-manager` | empty | Command (a program and its options) that opens an `sftp://` address for a host's "Open SFTP in file manager"; empty uses the system's default for such links, or else its default file manager. |
| `quick-commands` | `false` | The quick commands plugin: header button, command list and optional bar (Preferences → Plugins). The commands are in `quick-commands.yaml`. |
| `quick-commands-bar-visible` | `false` | Show the quick commands bar initially in new windows; the header button and F3 list remain available while it is hidden. |
| `session-recording` | `false` | The session recording plugin: the record button in the header (Preferences → Plugins). Turning it off ends every recording. |
| `record-always` | `false` | Record every pane of every window from its start, while session recording is on. |
| `cursor-blink-interval` | `700` | Half period of the blink in milliseconds, 100–2000. |
| `link-url` | `true` | Ctrl+click opens http and https links. |
| `tray-icon` | `false` | Show a tray icon (StatusNotifier). |
| `split-divider-color` | `#88c0d0` | Colour of the divider between panes. |
| `split-divider-width` | `4` | Width of the divider in pixels, 1–16. |
| `scrollbar` | `true` | Show a scrollbar in the pane under the pointer; drag it to scroll the history. |
| `autostart` | `false` | Start KorTerm on login (XDG autostart entry). |
| `autostart-hidden` | `false` | Autostarted KorTerm stays hidden; requires `tray-icon` and `autostart`. |
| `confirm-close` | `true` | Confirm exit when more than one terminal session is active. |
These keys are accepted and validated but have no effect yet: `window-inherit-working-directory`
and `window-inherit-font-size`. They apply once window inheritance is implemented.
The keys of the removed quick terminal mode (`quick-terminal`, `quick-terminal-height`,
`quick-terminal-animation-duration`) are ignored, and the next save drops them from the file.
A user theme file looks like this:
```yaml
name: My Theme
foreground: "#c0c0c0"
background: "#101010"
cursor: "#ffffff"
ansi: # 16 colors: normal 0–7, then bright 8–15
["#000000", "#cc0000", "#00cc00", "#cccc00", "#0000cc", "#cc00cc", "#00cccc", "#cccccc",
"#666666", "#ff0000", "#00ff00", "#ffff00", "#0000ff", "#ff00ff", "#00ffff", "#ffffff"]
```
The colours of a theme can also be set on these optional keys, each `#rrggbb`: `selection-background`,
`selection-foreground`, `search-match`, `search-current`, `scrollbar-track`, `scrollbar-thumb`,
`scrollbar-hot` and `divider`. Without them the palette derives defaults from the theme.
Colours belong to the theme, and each profile picks its theme. In Preferences → Profiles, **Colour
scheme** chooses the theme, and the **Colors of this theme** block edits it. A built-in theme is copied
first ("<name> (custom)"), so the built-in one stays as it is. **Save as new theme** saves the current
colours under a name you choose and gives that copy to the profile. The line under the choice lists the
profiles that use the scheme, because editing a scheme changes all of them.
**Export theme…** and **Import theme…** write and read the same YAML file. An imported theme whose
name is taken becomes "<name> (imported)".
**Match extended palette to theme** adapts indexed colours 16–255; **Default** inherits the top-level
`adapt-extended-colors` value, which defaults to `false`. The colour cube interpolates between the
theme's bright ANSI accents, preserving intermediate shades. Grays follow a separate ramp between
the theme's ANSI black and bright white. ANSI 0–15, explicit RGB and application OSC overrides remain
unchanged. Changes apply to existing tabs before inverse rendering swaps foreground and background.
Older configs had a top-level `colors:` block. On the first start its colours are copied into
"<theme> (migrated)" themes for the profiles that use them, and the block is dropped on the next save.
### Toggle and Wayland
Bind `korterm --toggle` to a key in Cinnamon's keyboard settings (custom shortcut). The primary
window is shown or hidden. On X11 a window shown by `--toggle` comes to the desktop the user is
on. On Wayland the compositor decides where the window appears.
## Development
```bash
make build # release binary
make run # debug build
make check # format check, clippy with warnings as errors, and all tests
make packages # the .deb, .rpm and Arch packages in dist/ (needs Docker)
```
The workspace has six library crates: `korterm-core` (PTY session on `alacritty_terminal`),
`korterm-render` (glyph atlas, scene and OpenGL backend), `korterm-ssh` (reads and patches
`~/.ssh/config`, groups and colours in `hosts.yaml`, the `ssh` command line) and `korterm-ui` (GTK 4 window, input,
settings, themes, mouse and X11 desktop support), `korterm-quick` (quick commands) and
`korterm-record` (recording storage, archives and index). `src/main.rs` only wires them together.
Keyboard shortcuts were not checked in every desktop setup; if a shortcut does not reach the
terminal, the mouse controls (tab strip, split button, right-click menu) do the same job.
## Author
[Ivan Cherniy](https://r4ven.me) — [r4ven.me](https://r4ven.me).
Source: [git.r4ven.me/ivan/korterm](https://git.r4ven.me/ivan/korterm).
## License
GNU General Public License v3.0 or later (GPL-3.0-or-later), see
[LICENSE](LICENSE).