Commit Graph

23 Commits

Author SHA1 Message Date
4cc33cf62c Fix test expectation: maximize restore returns pre-snap geometry
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-15 20:15:48 +02:00
ca13abc9b7 Reliable letter-based default keybinds + kitty keyboard protocol
alt+tab is grabbed by desktop WMs and alt+arrows are re-encoded or
swallowed by several terminals, leaking plain arrow keys into the
focused window. Primary defaults are now letter chords which every
terminal delivers via ESC-prefix: alt+w (switcher), alt+h/alt+l
(snap), alt+m (maximize). The alt+tab/arrow variants stay as extra
bindings, and standalone/client now enable the kitty keyboard
protocol (DISAMBIGUATE_ESCAPE_CODES) when the terminal supports it
so even those are delivered unambiguously (Konsole 23.08+, kitty,
foot, wezterm, ghostty). 34/34 integration checks.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-15 20:15:17 +02:00
8296081557 Ship default config/panels/themes with the app: --init, XDG discovery, build/CI bundling
- tui-wm --init [DIR] writes an embedded default config.toml,
  panels/topbar.toml and themes/{dark,light}.toml (default target
  ~/.config/tui-wm, existing files untouched)
- Config discovery: ./config.toml wins, otherwise ~/.config/tui-wm/
  is used (process switches working dir there so panels/themes/saves/
  hot-reload all resolve consistently); spawned PTYs still start in
  the user's original working directory
- VS Code build tasks copy themes/ into builds/, dist/ sample configs
  refreshed with all new keys and the settings gear
- CI release now also uploads tui-wm-config.tar.gz (config + panels +
  themes) alongside the binaries

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-15 20:12:13 +02:00
35eb33b9a1 Fix SGR mouse release button + reflow wrapped lines on resize
- SGR (1006) release events now carry the same button number as the
  press ('m' suffix marks release); the legacy 'button 3 = release'
  is only used for X10/UTF8 encodings. ncurses apps (htop etc.) could
  not pair press+release before, so clicks were ignored while scroll
  (press-only wheel events) worked
- Each window keeps its recent raw PTY output (capped at 512 KB); on
  resize the history is replayed into a fresh parser at the new width
  so long lines re-wrap correctly instead of keeping old break points
- Integration: release-button and reflow checks, 33/33 passing

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-15 20:09:45 +02:00
c9a4a8fc21 Built-in settings dialog opened from a panel gear button
- New spawn_settings action + '≡ Inställningar' button in the default
  panel (≡ instead of ⚙ which has ambiguous character width): opens a
  singleton settings window
- Rows: theme (cycles built-in + themes/*.toml), panel (cycles
  panels/*.toml), shadow and scrollbar toggles — keyboard (arrows/
  Enter/Esc) and mouse (click selects, click again activates)
- Shows where config.toml, themes/ and panels/ live
- Changes apply immediately and persist to config.toml via toml_edit;
  the hot-reload watcher picks up the file writes for panels
- README and --help updated with switcher/snap/copy-mode/theme docs
- Integration suite: 30/30 (gear click, dialog opens, shadow toggle
  persisted to config.toml)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-15 19:48:04 +02:00
b1424da4fb Copy-mode with scrollback search + config hot-reload
- alt+c enters copy-mode on the focused terminal: arrows/PgUp/PgDn/
  Home/End scroll the history, / searches (matches highlighted in the
  view), n/N jump between hits, q/Esc exits back to the bottom.
  Status line shows position and key help
- config.toml, panel files and the theme file are watched (1s mtime
  poll): edits reload theme/panels/keybinds live without restarting —
  windows and focus are untouched
- Integration suite runs the daemon in an isolated config dir and
  covers copy-mode search and panel hot-reload — 27/27 passing

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-15 19:43:57 +02:00
b85345be99 Alt+Tab window switcher (MRU), snap/maximize, panel separators
- window_switcher action: overlay listing windows in most-recently-used
  order; Tab/arrows cycle, Enter confirms, Esc cancels. Bound to
  alt+tab with alt+w as fallback for terminals that swallow alt+tab
- snap_left/snap_right actions (alt+left/alt+right) tile the focused
  window to half the content area; dragging a window to the screen
  edge snaps it too
- maximize action (alt+up) toggles maximize/restore, double-click on
  the title bar does the same; restore returns the pre-snap geometry
- Panel: separator between focus dot and buttons, separators between
  right-docked status widgets, and item widths now use display width
  (fixes rects for åäö/wide labels)
- Integration suite: 23 checks, all passing

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-15 19:40:28 +02:00
1c7999de09 Themes as standalone config files + configurable shadow + dim unfocused + resize content-loss fix
- Theme is now a runtime struct loaded from its own TOML file
  (theme = "themes/dark.toml" in config.toml, like panels), all
  fields optional with built-in defaults; ships themes/dark.toml and
  themes/light.toml
- shadow = true/false in config.toml, shadow_color per theme
- dim_unfocused (per theme): unfocused window content is dimmed
- BUGFIX: resizing a window no longer erases its content and history —
  the vt100 parser was recreated on every resize; now uses
  screen_mut().set_size() which preserves the grid and scrollback
- New integration check: window content survives mouse resize (20/20)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-15 19:35:15 +02:00
71952ab90b Polish window frames: inset title chip, ✕ close button, drop shadow
- Title rendered as a chip inset in the border (┤ titel ├), accent
  colored when focused, dimmed when not
- Close button restyled to ┤✕├ matching the frame
- Subtle drop shadow below/right of windows (darkened cells, content
  underneath stays visible; skipped when a background image is active)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-15 19:19:21 +02:00
373294e2b9 Fix frozen client on ctrl+q: send bye instead of half-closing
Dropping the client's channel sender never closed the socket (the
server's reader thread keeps the connection open), so the client froze
waiting for frames. The server now sends a bye message; the client
exits cleanly on it and its socket close lets the server clean up.
Messages from already-disconnected clients are ignored. Verified
end-to-end with the real client in a PTY (exits 0, daemon survives).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-15 19:08:04 +02:00
db18c42481 Add --help, terminal scrollback + scrollbar, run-dialog fix, client-safe exit, true rounded corners
- -h/--help prints a full usage overview (modes, config keys, keys, mouse)
- Run dialog now executes the typed command directly in the new window
  (previously it spawned the default shell and typed the command into
  it, which showed up as just an empty terminal)
- Virtual terminals get vt100 scrollback (config scrollback_lines,
  default 1000): mouse wheel scrolls history when the app doesn't
  capture the mouse, arrow-key fallback on the alternate screen, any
  keypress jumps back to the bottom; optional scrollbar on the right
  border (show_scrollbar) plus configurable default_window_size
- Exit triggered from a connected display client (ctrl+q / panel
  button) now only disconnects that client — the daemon/standalone
  session and its programs keep running
- Windows now paint the border zone in the desktop background color so
  rounded corners actually look rounded instead of a filled square
  with an inner rounded frame; popup dialogs rounded too
- Integration suite extended to 19 checks (scrollback, run dialog,
  client-safe exit) — all passing

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-15 18:58:45 +02:00
9cebeae716 Introduce central theme module; rounded borders and consistent styling
All colors/styles for windows, panel, dropdown and desktop now live in
src/theme.rs — restyle the whole WM from one file. Windows and menus
use rounded borders; hover/focus states share one accent style.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-15 09:39:39 +02:00
6aee7ce00a Fix wide-char (emoji/CJK) column drift through the whole render chain
Wide characters shifted everything after them one column to the right:

- render.rs: vt100's empty wide-continuation cell was padded to a
  space, making wide chars occupy 2+1 columns — skip it entirely
- ipc.rs buffer_to_ansi: same bug for daemon frames — skip cells
  covered by a preceding wide symbol (unicode-width)
- app.rs: clamp virtual terminals to >= 2 columns (vt100 0.16 has a
  subtraction underflow panic on wide chars in a 1-col grid) and give
  content_area a sane 80x24 default so windows spawned before the
  first layout pass aren't degenerate
- main.rs: use try_send for display frames so one slow/stalled client
  can no longer freeze the whole WM
- integration test: new end-to-end check that emoji do not shift the
  row, plus fix a false match against the window title

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-15 09:33:06 +02:00
5ca8eb4647 Apply cargo clippy --fix cleanups
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-14 19:51:44 +02:00
f0bed7a14e Full remote input parity: forward mouse and structured key events over IPC
- New key_event/mouse_event client messages (crossterm serde) that run
  through the complete WM event handling on the server — remote clients
  get window focus, drag/resize and mouse forwarding into virtual
  terminals (SGR/UTF-8/X10) identical to standalone mode
- tui-wm -c now forwards mouse events; previously only keyboard worked
  remotely
- IPC unit tests + end-to-end integration test (tests/integration.py):
  daemon, frames, click/scroll SGR forwarding, popups, TUI-FM in a
  window — 12/12 passing
- Document the new messages in SOCKET_API.md

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-14 19:50:27 +02:00
75aa7033a4 Add Gitea Actions release workflow + combined VS Code build task
CI on push to master/main: cargo test, native arm64 build on the Pi5
runner, cross-compiled x64 build, rolling 'latest' release with both
binaries and checksums.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-14 19:44:35 +02:00
59b909efb8 Cross-platform IPC via interprocess + Windows support fixes
- Replace Unix-socket-only server/client with interprocess local sockets:
  unchanged unix domain socket on Linux (SOCKET_API compatible),
  named pipes on Windows
- Run command lines with arguments via sh -c / cmd /C in the PTY
- Wire RunProgram args into the spawned command
- Make libc a unix-only dependency
- Skip Kitty background image on Windows (protocol unsupported)
- Drop dead pixel-size query code in kitty_gfx
- Reject left/right panel positions at config parse instead of silently
  ignoring them

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-14 19:38:56 +02:00
b8d6a18a2e Upgrade TUI stack: ratatui 0.30, crossterm 0.29, portable-pty 0.9, vt100 0.16
- Capture OSC 0/2 window title in scan_osc_sequences since vt100 0.16
  no longer exposes Screen::title()
- Remove committed build artifacts (testapps/mouse-test/target) and
  extend .gitignore

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-14 19:31:41 +02:00
339ad9530e Implement Kitty graphics protocol for background image rendering
- Added `kitty_gfx` module to handle loading, scaling, and displaying background images using the Kitty graphics protocol.
- Integrated background image handling into the main application loop, allowing dynamic updates based on configuration.
- Enhanced terminal rendering to support transparent backgrounds when a Kitty image is active.
- Updated IPC server to manage client connections and messages, including handling background image settings.
- Modified `PtyTerminal` to accept additional environment variables during shell spawning.
- Improved rendering logic to support popup dialogs and terminal background color customization.
2026-03-29 04:28:31 +02:00
3a9e292088 Add build output dependency file for mouse-test application
Add standard menu fore keybinds
2026-03-28 03:18:41 +01:00
Björn Blomberg
4440ad79bd feat: add configuration management and panel rendering
- Introduced a new `Config` struct for loading application configuration from a TOML file.
- Added support for keybindings and panel configurations, including status widgets.
- Implemented `PtyTerminal` for handling pseudo-terminal interactions.
- Created a rendering module to manage the display of application windows, panels, and dropdowns.
- Refactored the main application loop to utilize the new configuration and rendering logic.
- Removed legacy code related to event handling and rendering from `main.rs`.
2026-03-27 17:01:06 +01:00
Björn Blomberg
d7c70baf35 Add initial implementation of TUI-WM with README, build tasks, and configuration files 2026-03-27 14:52:50 +01:00
f50ffa04de Initial commit 2026-03-27 13:09:20 +01:00