Skip to content
miloserdevPublic

About

Dynamic Tiling Manager

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

demo.gif

DTM — Dynamic Tiling Manager

English | 简体中文

DTM is a keyboard-driven, tiled terminal emulator for Linux written in C11. It takes its layout model from Tilix (splits and tabs), its console control model from dwm (Super-key tags, MOD+Shift+N to move clients between desktops), its modal keybindings from Zellij, and its configuration style from Alacritty — with a few extras: an embedded Chromium (CEF) browser, image viewers, a startup greeting animation, and rendering straight to DRM/KMS or the framebuffer without any display server.

Features

  • Panes and tabs: binary split tree, horizontal/vertical splits, zoom, focus cycling, moving panes between tabs (tab.send).
  • dwm-style console mode: when DTM owns the VT, Super+key bindings give a tag/desktop workflow (Super+1..9 select, Super+Shift+1..9 move).
  • Modal keybindings: Zellij-like pane, tab, resize, scroll modes plus a command palette.
  • Universal pane providers: terminal, cef (embedded Chromium, offscreen), browser (legacy CDP provider), picture/image (PNG viewer), dummy, greeting.
  • CEF browser panes: address bar, back/forward/reload, window.open popups open as a new pane beside the browser, proxy and user-agent setting, mouse-wheel tuning. The browser runs on its own thread — a hung page never hangs the terminal.
  • Themes: VSCode dark/light built in, per-color overrides, live config reload, glow, background blur (KDE Wayland), cursor blink/smooth/trail.
  • Greeting screen: animated GIF rendered at startup, dismissed on the first key press. Legacy .aascii animations are still supported (deprecated).
  • Backends: SDL3 (Wayland/X11), direct KMS/DRM, framebuffer — same binary.
  • Recording: DTM_RECORD=out.mp4 records the app's own frames.
  • Robust input: libinput with poll-multiplexed keyboard/pointer/DRM events, coalesced pointer motion, no stuck autorepeat.

Requirements

Linux only. Build tools: CMake ≥ 3.20, a C11 compiler, pkg-config.

Required libraries (pkg-config names):

Library Arch package Used for
sdl3 sdl3 windowing (Wayland/X11), rendering
freetype2 freetype2 glyph rasterization
fontconfig fontconfig system font lookup
libcjson cjson configuration parsing
libpng libpng picture/image panes
libjpeg libjpeg picture/image panes
xkbcommon libxkbcommon keymaps
libinput, libudev libinput, systemd-libs console input
threads glibc browser thread

Optional:

Library Arch package Enables
libdrm libdrm direct KMS/DRM backend (--backend dri)
wayland-client wayland KDE background blur
giflib giflib (no .pc; headers + libgif) greeting GIFs and gif2aascii

Vendored in-tree: CEF C API headers (third_party/cef/include) and args_dispatcher (third_party/args_dispatcher).

Build

cmake -S . -B build
cmake --build build -j
# binary: build/dtm

Run the test suite:

cd build && ctest

CEF browser setup (optional)

Chromium is not bundled. Put a standard CEF binary distribution under cef/ (next to the binary or at the repo root), with this layout:

cef/
  libcef.so
  icudtl.dat
  *.pak, *.bin
  locales/

Paths are configurable in cef.library / cef.resources (see below), or via DTM_CEF_ROOT, DTM_CEF_LIBRARY, DTM_CEF_RESOURCES. Children run unsandboxed by default; set DTM_CEF_SANDBOX=1 if your chrome-sandbox is set up. If the library is missing, cef: panes report an error and the rest of DTM keeps working.

Running

On a desktop (Wayland or X11)

./build/dtm                     # auto backend -> SDL3
./build/dtm -b wayland          # force a driver (sdl|x11|wayland)
./build/dtm -c my-config.json   # alternate config

On a bare TTY (no display server)

sudo ./build/dtm -b dri         # KMS/DRM, needs the VT + DRM master
./build/dtm -b fb               # /dev/fb0 fallback
sudo ./build/dtm --list-displays
sudo ./build/dtm -b dri -d DP-1 -m 2560x1440@144

For libinput you need access to seat0 devices (input group, or logind uaccess while seated locally); DRM master works when DTM runs on the active VT. Exiting restores the VT (KD_TEXT) and the saved CRTC mode.

Backends

Name Aliases Notes
auto SDL3 if WAYLAND_DISPLAY/DISPLAY is set, else DRM if /dev/dri/card* is accessible, else fbdev
sdl x11, wayland, kmsdrm SDL3 window (driver picked by SDL)
dri drm direct KMS/DRM dumb buffers + page flip
fb fbdev /dev/fb0

Command-line flags

Flag Description
-c, --config PATH configuration file
-b, --backend NAME auto, sdl, x11, wayland, kmsdrm, dri, fb
-d, --display NAME DRM connector (DP-1, eDP-1, …, auto)
-D, --device PATH DRM card (/dev/dri/cardN) or framebuffer path
-m, --mode MODE preferred, max or WxH[@R]
-s, --scale VALUE UI/font scale for fb/dri output (0.5–4)
--list-displays list DRM connectors and modes
-h, --help usage

Configuration

JSON, hot-reloaded when the file changes. Search order:

  1. $DTM_CONFIG
  2. $XDG_CONFIG_HOME/dtm/dtm.json
  3. ~/.config/dtm/dtm.json
  4. configs/dtm.json (repository sample)

A complete example lives in configs/dtm.json.

Top level

Key Default Description
backend auto see the backend table
shell $SHELL command for terminal panes; empty = $SHELL, then /bin/sh
term xterm-256color TERM for children
scrollback 10000 history lines per terminal pane
greeting false show the greeting screen at startup
greeting_gif assets/greeting.gif animated GIF for the greeting
greeting_art "" legacy .aascii animation (deprecated)
greeting_speed 10 legacy .aascii speed (frames/s)

cef

Key Default Description
root ./cef CEF distribution root
library cef/libcef.so path to libcef.so
resources cef resources directory (.pak, icudtl.dat, locales/)
toolbar true address/back/forward toolbar
toolbar_height 30 toolbar height in px
popup_panes true window.open opens a pane beside the browser
mouse_wheel_reverse false invert wheel direction
mouse_wheel_step 20 scroll pixels per wheel line
homepage "" URL for cef panes opened without one
user_agent "" override the User-Agent
proxy "" e.g. socks5://127.0.0.1:9050
log_severity warning verbose, info, warning, error, disable
cache_path "" Chromium cache dir; empty = /tmp/dtm-cef-<pid>
background #ffffff page background color

display (DRM/fbdev)

Key Default Description
device auto /dev/dri/cardN
connector auto DP-1, eDP-1, …
mode preferred preferred, max, WxH[@R]
scale 1 UI/font scale

window

Key Default Description
width, height 1200, 760 initial size
title DTM window title
decorations true window decorations
opacity 1.0 whole-window opacity
padding, gap 8, 2 outer padding / pane gap
border_width 2 pane border
tab_bar_height, status_bar_height 30, 24 bar heights
tab_width 240 preferred tab width
tab_marquee true scroll long tab titles
show_tab_bar, show_status_bar, show_view_names true UI visibility
view_name_align center left, center, right
status_animation true animate status text

terminal / ui (fonts)

Key Description
font.family font family (fontconfig pattern)
font.size size in px
font.line_height line-height multiplier
font.weight 100–900

terminal styles pane text; ui styles bars, palette and view names.

theme, colors, effects

Key Description
theme.dark, theme.light theme JSON paths
theme.min_contrast minimum contrast for resolved colors
theme.active dark or light
colors.background, .foreground, .cursor, .selection, .tabbar_background, .border, .border_active, .palette color overrides (hex #rrggbb[aa], palette = 16 colors)
effects.glow, effects.glow_radius cursor/border bloom
effects.blur compositor blur behind the window
effects.cursor_blink, .cursor_blink_rate, .cursor_smooth, .cursor_trail cursor animations

keybindings / tty_keybindings

A list of objects: {"key": "ctrl+shift+p", "action": "command.open"}; add "mode": "tab" for modal bindings (default normal). tty_keybindings are added when DTM owns the console (Super-key, dwm-style).

Actions: tab.new, tab.close, tab.next, tab.prev, tab.select:N, tab.send:N, pane.split_horizontal, pane.split_vertical, pane.close, pane.zoom, pane.next, pane.prev, pane.focus_left|right|up|down, pane.resize_left|right|up|down, command.open, theme.toggle, tabbar.toggle, statusbar.toggle, viewnames.toggle, bars.toggle, clipboard.copy, clipboard.paste, scroll.up|down|page_up|page_down|top|bottom, view.back|forward|reload, mode.pane|tab|resize|scroll, mode.exit, quit.

Commands (palette)

Open with Ctrl+Shift+P (or alt+x, or Super+p on the console). Type a command, Enter to run; help prints the tree.

Command Description
`tab new close
pane split-horizontal [spec], pane split-vertical [spec] split, optional view spec
pane split-image FILE, pane close, pane zoom, `pane next prev, pane focus DIR, pane resize DIR`
`theme dark light
`view tabs status
view change MODULE[:ARG] replace the active view (terminal, dummy, picture, browser, cef[:url])
view navigate URL, `view back forward
`mode pane tab
image FILE, picture FILE open an image tab
browser [URL], cef [URL] open a browser tab
zoom, copy, paste, bars, quit, help misc

Keybindings

Desktop preset (keybindings)

Key Mode Action
alt+x normal command.open
ctrl+shift+p normal command.open
f6 normal theme.toggle
ctrl+shift+b normal tabbar.toggle
ctrl+shift+j normal statusbar.toggle
ctrl+shift+n normal viewnames.toggle
ctrl+shift+t normal tab.new
ctrl+shift+q normal quit
ctrl+shift+c normal clipboard.copy
ctrl+shift+v normal clipboard.paste
ctrl+shift+z normal pane.zoom
ctrl+shift+right normal tab.next
ctrl+shift+left normal tab.prev
ctrl+alt+1 normal tab.send:1
ctrl+alt+2 normal tab.send:2
ctrl+alt+3 normal tab.send:3
ctrl+alt+4 normal tab.send:4
ctrl+alt+5 normal tab.send:5
ctrl+alt+6 normal tab.send:6
ctrl+alt+7 normal tab.send:7
ctrl+alt+8 normal tab.send:8
ctrl+alt+9 normal tab.send:9
alt+shift+left normal view.back
alt+shift+right normal view.forward
alt+shift+r normal view.reload
alt+left normal pane.focus_left
alt+right normal pane.focus_right
alt+up normal pane.focus_up
alt+down normal pane.focus_down
ctrl+tab normal pane.next
ctrl+shift+tab normal pane.prev
alt+pageup normal pane.prev
alt+pagedown normal pane.next
alt+h normal pane.split_horizontal
alt+v normal pane.split_vertical
alt+w normal pane.close
ctrl+p normal mode.pane
ctrl+t normal mode.tab
ctrl+n normal mode.resize
shift+pageup normal scroll.page_up
shift+pagedown normal scroll.page_down
h pane pane.focus_left
alt+x pane command.open
f6 pane theme.toggle
ctrl+shift+b pane tabbar.toggle
ctrl+shift+j pane statusbar.toggle
ctrl+shift+n pane viewnames.toggle
tab pane pane.next
shift+tab pane pane.prev
j pane pane.focus_down
k pane pane.focus_up
l pane pane.focus_right
n pane pane.split_horizontal
v pane pane.split_vertical
x pane pane.close
z pane pane.zoom
r pane mode.resize
t pane mode.tab
s pane mode.scroll
escape pane mode.exit
q pane mode.exit
n tab tab.new
alt+x tab command.open
f6 tab theme.toggle
ctrl+shift+b tab tabbar.toggle
ctrl+shift+j tab statusbar.toggle
ctrl+shift+n tab viewnames.toggle
x tab tab.close
h tab tab.prev
l tab tab.next
1 tab tab.select:1
2 tab tab.select:2
3 tab tab.select:3
4 tab tab.select:4
5 tab tab.select:5
6 tab tab.select:6
7 tab tab.select:7
8 tab tab.select:8
9 tab tab.select:9
shift+1 tab tab.send:1
shift+2 tab tab.send:2
shift+3 tab tab.send:3
shift+4 tab tab.send:4
shift+5 tab tab.send:5
shift+6 tab tab.send:6
shift+7 tab tab.send:7
shift+8 tab tab.send:8
shift+9 tab tab.send:9
escape tab mode.exit
q tab mode.exit
h resize pane.resize_left
alt+x resize command.open
f6 resize theme.toggle
ctrl+shift+b resize tabbar.toggle
ctrl+shift+j resize statusbar.toggle
ctrl+shift+n resize viewnames.toggle
l resize pane.resize_right
k resize pane.resize_up
j resize pane.resize_down
escape resize mode.exit
q resize mode.exit
k scroll scroll.up
alt+x scroll command.open
f6 scroll theme.toggle
ctrl+shift+b scroll tabbar.toggle
ctrl+shift+j scroll statusbar.toggle
ctrl+shift+n scroll viewnames.toggle
j scroll scroll.down
u scroll scroll.page_up
d scroll scroll.page_down
g scroll scroll.top
shift+g scroll scroll.bottom
escape scroll mode.exit
q scroll mode.exit

Console preset (tty_keybindings)

Added on top of the desktop preset when DTM owns the VT:

Key Mode Action
super+return normal pane.zoom
super+shift+return normal tab.new
super+p normal command.open
super+b normal bars.toggle
super+j normal pane.next
super+k normal pane.prev
super+tab normal tab.prev
super+shift+c normal pane.close
super+h normal pane.resize_left
super+l normal pane.resize_right
super+m normal pane.zoom
super+1 normal tab.select:1
super+2 normal tab.select:2
super+3 normal tab.select:3
super+4 normal tab.select:4
super+5 normal tab.select:5
super+6 normal tab.select:6
super+7 normal tab.select:7
super+8 normal tab.select:8
super+9 normal tab.select:9
super+shift+1 normal tab.send:1
super+shift+2 normal tab.send:2
super+shift+3 normal tab.send:3
super+shift+4 normal tab.send:4
super+shift+5 normal tab.send:5
super+shift+6 normal tab.send:6
super+shift+7 normal tab.send:7
super+shift+8 normal tab.send:8
super+shift+9 normal tab.send:9

Edges can be dragged with the mouse to resize panes; dragging a pane moves it, dropping onto another tab moves the pane there.

Views

Open any view with the palette (view change, tab new@SPEC) or the tab.new@<spec> action; SPEC is type or type:argument.

Type Argument Notes
terminal command default; runs shell
cef URL embedded Chromium pane with toolbar
browser URL legacy CDP provider
picture, image file.png image viewer
dummy placeholder
greeting startup animation provider

Recording

DTM_RECORD=out.mp4 ./build/dtm                 # 20 fps default
DTM_RECORD=out.mp4 DTM_RECORD_FPS=30 ./build/dtm
DTM_SCREENSHOT=out.bmp DTM_SCREENSHOT_DELAY_MS=1500 ./build/dtm

Recording works on the SDL backend: frames are read back from the renderer, padded to a constant rate and piped to ffmpeg (H.264, yuv420p). Quit normally and the mp4 is finalized.

Greeting GIFs and the gif2aascii converter

Drop any animated GIF into assets/greeting.gif (or point greeting_gif at your own file). With giflib, DTM also builds build/gif2aascii, which converts GIFs into the legacy textual .aascii format (palettes ascii, blocks, squares, dither):

./build/gif2aascii -w 190 -p blocks in.gif out.aascii

The .aascii player still works but is deprecated in favour of direct GIF rendering.

Environment variables

Variable Description
DTM_CONFIG config path override
DTM_TTY_KEYS force the console keybinding preset
DTM_CEF_ROOT, DTM_CEF_LIBRARY, DTM_CEF_RESOURCES CEF paths
DTM_CEF_SANDBOX 1 enables the Chromium sandbox
DTM_RECORD, DTM_RECORD_FPS frame recording
DTM_SCREENSHOT, DTM_SCREENSHOT_DELAY_MS screenshot then quit
DTM_DRM_DUMP, DTM_DRM_DUMP_DELAY_MS, DTM_FBDEV_DUMP, DTM_FBDEV_DUMP_DELAY_MS dump the console framebuffer
DTM_BROWSER, DTM_BROWSER_ARGS legacy CDP browser binary
DTM_DEMO*, DTM_SELFTEST_* internal test harnesses

Tests

cd build && ctest --output-on-failure

Project layout

src/            core: terminal emulator, layout, config, views registry, CEF glue
backends/       sdl/ (SDL3), drm/ (KMS/DRM), fbdev/, shared software renderer
input/          libinput seat0 integration (poll-multiplexed)
modules/        pane views: terminal, picture, dummy, browser, cef, greeting
include/dtm/  public headers
tools/          gif2aascii
configs/        sample configuration
themes/         sample VSCode themes
assets/         greeting media
third_party/    vendored CEF C API headers, args_dispatcher
docs/           documentation

License

MIT — see LICENSE. Vendored code: CEF C API headers (BSD-style, see third_party/cef), args_dispatcher (GPL-2.0-or-later, same author).

About

Dynamic Tiling Manager

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages