Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
436480248a
|
||
|
|
4068784f66
|
||
|
|
9729d24605
|
||
|
|
2f58a0670e
|
||
|
|
1bf420ce41
|
||
|
|
a5dbfbcbae
|
||
|
|
2af45cbfb9
|
||
|
|
3e30f95543
|
||
|
|
6c610fdc6e
|
||
|
|
8bc94edf8d
|
||
|
|
741e48bc4a
|
||
|
|
c25ca92921
|
||
|
|
1faf8ca0be
|
||
|
|
aae7fba6a9
|
||
|
|
d8ebadea2d
|
||
|
|
340c7a92ea
|
||
|
|
2e9ed4de75
|
||
|
|
194c7bb9d5
|
No files matched your search
@@ -30,10 +30,10 @@ ELYTerminal. A terminal on GPUI and Ely components. `PRD.md` says what it does;
|
||||
## Layout
|
||||
|
||||
- `build.rs`: on Windows, the icon into the executable as resource 1, through `assets/icons/elyterminal.rc`. `.cargo/config.toml`: Windows builds carry the C runtime. `rust-toolchain.toml`: the toolchain rustup installs.
|
||||
- `src/main.rs`: start. `src/lib.rs`: the modules, public so tests and examples reach them. `src/app.rs`: fonts, settings, integration, then the main window. `src/menus.rs`: the menu bar, the keys of Quit, the font's size and Minimize, and what they do. `src/blur.rs`: what the window shows of the desktop, from the opacity and blur settings, set as they change; `blur/macos` gives gpui's NSVisualEffectView a material that blurs; `blur/wayland` asks a Wayland compositor for blur behind the window's surface through `ext_background_effect_v1`; `blur/x11` names the window's pane in `_KDE_NET_WM_BLUR_BEHIND_REGION`. `src/workspace.rs`: the window's content, Ely's `ColumnShell` with the sessions, terminal and right columns, their toggles, the right column's Git and Files switch, the title, and the sessions' lifecycle. `src/sessions.rs`: a session and its row. `src/files.rs`: the Files panel, the shown session's folder as Ely's `Tree` with Git's marks. `src/git.rs`: git through its command line: Files' marks, and the Git panel's status, stage, unstage, discard, commit and log; `src/git/diff.rs` reads git's diff into Ely's stretches. `src/git/panel.rs`: the Git panel's state and actions; `src/git/panel/view.rs`: how it draws.
|
||||
- `src/main.rs`: start. `src/lib.rs`: the modules, public so tests and examples reach them. `src/app.rs`: fonts, settings, integration, then the main window, at the size the settings keep, which it keeps as it settles. `src/menus.rs`: the menu bar, the keys of Quit, the font's size and Minimize, and what they do. `src/blur.rs`: what the window shows of the desktop, from the opacity and blur settings, set as they change; `blur/macos` gives gpui's NSVisualEffectView a material that blurs; `blur/wayland` asks a Wayland compositor for blur behind the window's surface through `ext_background_effect_v1`; `blur/x11` names the window's pane in `_KDE_NET_WM_BLUR_BEHIND_REGION`. `src/workspace.rs`: the window's content, Ely's `ColumnShell` with the sessions, terminal and right columns, their toggles, the right column's Git and Files switch, the title, and the sessions' lifecycle. `src/sessions.rs`: a session and its row. `src/files.rs`: the Files panel, the shown session's folder as Ely's `Tree` with Git's marks. `src/git.rs`: git through its command line: Files' marks, and the Git panel's status, stage, unstage, discard, commit and log; `src/git/diff.rs` reads git's diff into Ely's stretches. `src/git/panel.rs`: the Git panel's state and actions; `src/git/panel/view.rs`: how it draws.
|
||||
- `src/settings`: the model, its ranges, and `SettingsStore`, the global that loads, checks and saves `settings.json`; `window` is the settings window, `window/appearance` its Appearance page, `window/terminal` its Terminal page. `tests/fonts.rs` brings its own main: gpui builds its Mac platform only on the main thread.
|
||||
- `src/themes`: built-in terminal themes, the chrome palette each maps to, and `apply`, which dresses the app for the system's appearance.
|
||||
- `src/term`: the terminal engine. `pty` starts a program through alacritty's event loop; `tap` wraps the pty so its reader scans OSC 7 and the mouse modes before the parser. `unix` starts the program itself, so a failed `chdir` fails the start; Windows uses alacritty's ConPTY. `shell` writes the integration scripts at start and builds each shell's launch. `frame` reads the grid into styled rows, `boxes` turns box drawing, block elements and powerline arrows into rects and polygons (`boxes/outline` strokes curves and diagonals into polygons), `ink` resolves colors, `paint` draws rows, decorations and the cursor, `view` is the entity: pty events, metrics, blink, resize. `zoom` holds the points Bigger and Smaller add to the Size setting, unsaved. `keys` turns key events into bytes, the kitty protocol and, in `keys/legacy`, xterm's encoding, with no gpui types; `input` is the view's key listeners, the bindings that keep Tab and F6 from Ely's focus moves, and its IME handler; `mac` reads the Option side and repeat flag of AppKit's current event, keeps held keys repeating, and hands Command key-ups to the focused view. `mouse` encodes mouse reports, with no gpui types; `links` finds the link at a cell; `pointer` is the view's mouse listeners: selection, reports, wheel, links, copy and paste. `find` is the find box: Ely's `FindWidget`, and Ely's `find_all` over the grid's shown text.
|
||||
- `src/themes`: built-in terminal themes, the chrome palette each maps to, and `apply`, which dresses the app for the system's appearance; `omarchy`, on Linux, wears Omarchy 4's current theme and follows its switches.
|
||||
- `src/term`: the terminal engine. `pty` starts a program through alacritty's event loop; `tap` wraps the pty so its reader scans OSC 7 and the mouse modes before the parser; `herdr` follows herdr's focused pane through herdr's socket while herdr's client leads the pty's foreground. `unix` starts the program itself, so a failed `chdir` fails the start; Windows uses alacritty's ConPTY. `shell` writes the integration scripts at start and builds each shell's launch. `frame` reads the grid into styled rows, `boxes` turns box drawing, block elements and powerline arrows into rects and polygons (`boxes/outline` strokes curves and diagonals into polygons), `ink` resolves colors, `paint` draws rows, decorations and the cursor, `view` is the entity: pty events, metrics, blink, resize. `zoom` holds the points Bigger and Smaller add to the Size setting, unsaved. `keys` turns key events into bytes, the kitty protocol and, in `keys/legacy`, xterm's encoding, with no gpui types; `input` is the view's key listeners, the bindings that keep Tab and F6 from Ely's focus moves, and its IME handler; `mac` reads the Option side and repeat flag of AppKit's current event, keeps held keys repeating, and hands Command key-ups to the focused view. `mouse` encodes mouse reports, with no gpui types; `links` finds the link at a cell; `pointer` is the view's mouse listeners: selection, reports, wheel, links, copy and paste. `find` is the find box: Ely's `FindWidget`, and Ely's `find_all` over the grid's shown text.
|
||||
- `assets/shell-integration`: ELYTerminal's own scripts (not Ghostty's, which are GPL): zsh through `ZDOTDIR`, bash through `--rcfile`, fish through `XDG_DATA_DIRS`, PowerShell through `-NoExit -Command`. Each prompt sends OSC 7 and, except in fish, whose `fish_title` stays, a title.
|
||||
- `assets/fonts`: JetBrains Mono 2.304's bold and italic faces (OFL; Ely bundles regular), and Nerd Fonts 3.5.1's JetBrains Mono NF Mono Regular, which draws icons a font lacks.
|
||||
- `assets/themes`: Ghostty theme files copied verbatim from iTerm2-Color-Schemes (MIT, its `LICENSE` beside them).
|
||||
@@ -90,3 +90,7 @@ ELYTerminal. A terminal on GPUI and Ely components. `PRD.md` says what it does;
|
||||
- 2026-10-15: the Linux tarball builds on Debian 12, in `rust:1.95.0-bookworm`: a binary asks for the glibc symbol versions it was linked against, so it is linked against an old glibc, not the builder's. `scripts/linux-tar.sh` prints the glibc its build asks for, and the README names it: 2.35 for v0.1.0, which runs on Ubuntu 22.04.
|
||||
- 2026-10-15: on Windows gpui answers the system's hit test from the last frame: under the pointer, a `WindowControlArea::Drag` hitbox that nothing occludes makes it the caption, and Windows keeps the press, so no click reaches the app. In v0.1.0 every title bar control was dead so. Ely now occludes the drag region under its window buttons, which then answer as close, maximize and minimize, and under each column header's item row, whose controls get plain presses; the row stays the scroll container, and its title is a drag region of its own.
|
||||
- 2026-10-15: a release's macOS disk image comes from the Release workflow, dispatched once the draft holds the Windows and Linux builds. It runs on `macos-signing`, the Mac mini's runner in the owner's login session, whose keychain holds the Developer ID identity; at the owner's choice that runner moved from AgentCompany alone to the owner's level, so every repository reaches it. The job reads the App Store Connect key from the owner's user-level secrets `APPLE_API_ISSUER`, `APPLE_API_KEY_ID` and `APPLE_API_KEY_P8`, writes the .p8 into the runner's temp folder for notarytool alone, and puts the stapled image on the draft through `scripts/release-asset.sh` with the job's own token. One notarization covers the image and the app inside it; the image carries the ticket, and the app copied out finds its own online on its first open.
|
||||
- 2026-10-15: on Omarchy 4 (Linux) ELYTerminal follows the system's theme. Omarchy renders the current theme's `colors.toml` through its own resolver into `~/.local/state/omarchy/current/theme/ghostty.conf`, under `$HOME` whatever `XDG_STATE_HOME` says, so ELYTerminal reads that file and wears what Ghostty wears there: its color lines go through the strict parser the bundled themes use, and the rest, such as the glass block, pass by. Omarchy writes no `cursor-text`, so the background stands in, as in Ghostty and Omarchy's kitty template. ELYTerminal reads the file twice a second, since Omarchy signals only Alacritty, kitty and Ghostty, by name, and wears it whenever its text changes and parses; a check that fails is logged once while it lasts and tried again, so a file made readable again is worn though nothing else about it changed. The Omarchy theme is the default unless that file is surely absent, so a folder that cannot be read makes a fresh install wear it and the start name the error; another pick stops following. At start a missing file means no Omarchy unless the settings wear it, a file that cannot be read stops the start, and one that does not parse stops it only when worn, else it is logged and no Omarchy card shows. While running, a missing file is a switch in progress, and any other failure keeps the last theme. Omarchy 3's `~/.config/omarchy/current` gets no shim.
|
||||
- 2026-10-16: on Hyprland 0.56 a window blurs only while Hyprland's own `decoration:blur:enabled` is on: its `shouldBlur` reads that option first, then the window's `no_blur`, RGBX and opaque rules, then the blur region a surface sets through `ext_background_effect_v1`, which Hyprland offers with the blur capability whatever the option says. Omarchy 4.0.4's default `looknfeel.lua` turns the option off, so on Omarchy no window blurs until the user turns it on; ELYTerminal leaves the compositor's settings alone. On the owner's Omarchy the log named `ext_background_effect_v1` and the pane's region, and the wallpaper behind the window blurred with the option on and showed sharp with it off.
|
||||
- 2026-10-16: herdr 0.9 keeps its panes' OSC 7 and writes only a title, notifications, OSC 52 and bells to the terminal it runs in, so no terminal hears a folder from inside it; herdr's server knows each pane's `cwd`, the folder its shell reported, else the shell's own. On macOS and Linux each session asks twice a second which process group leads its pty's foreground (`tcgetpgrp` on a copy of the master) and what executable that group's leader runs: an exec keeps the group and swaps the executable, so `exec herdr` from a shell is a new program, and one that did not read is tried again; on Linux the ` (deleted)` mark an update leaves on a running executable is set aside. When that executable is `herdr` and its arguments start herdr's terminal client (no command, `session attach NAME` or `client`), ELYTerminal reads the client's arguments and variables (`/proc` on Linux; `KERN_PROCARGS2` on macOS, which hides only the variables of Apple's own programs) and finds its socket as herdr 0.9 does: `--session NAME`, then `HERDR_SOCKET_PATH`, then `HERDR_SESSION`, under `$XDG_CONFIG_HOME/herdr`, else `~/.config/herdr`; a relative socket lies in the client's folder, as herdr reads it (`/proc/PID/cwd`; `proc_pidinfo` on macOS). It asks that socket for `session.snapshot` twice a second, a connection each, since herdr closes one after its reply, and reports the focused pane's `cwd` as the session's folder when it changes and again each time herdr takes the foreground. Focus belongs to herdr's server, so clients of one server follow one focus; a client of another machine's server (`--remote`, `--machine`) is logged, not followed. A failure is logged once while it lasts. Windows has none of this: there herdr is a beta on named pipes.
|
||||
- 2026-10-16: the main window opens at the size it was left at, which the owner asked for on macOS, Windows and Linux: `window_width` and `window_height` in the settings hold the size gpui's `window_bounds` gives 0.5 s after the bounds settle, saved through `SettingsStore::update`, which writes only a change, so a drag saves once and a move saves nothing. A maximized, full-screen or hidden window keeps the size from before; its state and size are read once they settle, since X11 marks a window maximized after its new size, gpui's X11 window then gives a maximized window's own size, and it calls a maximized window unmaximized while minimized. A window that shows again, uncovered, restored or back on its screen, is read again, so a size it took just before it hid is kept; a size it takes in the half second before it closes, or before it hides until the app quits, is lost. The window is no smaller than 100 by 100, the least the settings keep, or a smaller size the platform allows could not be kept. The window opens centered at whole points, since macOS grows a window by a point on a side whose edge falls on a half point; its place is not kept, and a kept side past the primary display's visible area shrinks to it, logged. A size outside 100 to 16384 stops the start, as any value out of range does.
|
||||
Generated
+1
-1
@@ -1747,7 +1747,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "elyterminal"
|
||||
version = "0.1.1"
|
||||
version = "0.1.2"
|
||||
dependencies = [
|
||||
"alacritty_terminal",
|
||||
"anyhow",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "elyterminal"
|
||||
version = "0.1.1"
|
||||
version = "0.1.2"
|
||||
edition = "2024"
|
||||
rust-version = "1.95"
|
||||
license = "MIT"
|
||||
|
||||
@@ -20,7 +20,7 @@ Chapters run in build order. `TASKS.md` follows them line by line.
|
||||
- `alacritty_terminal` 0.26 for the grid, the parser and the pseudo-terminal, as Ely uses it.
|
||||
- Logs through `log` to stderr, `RUST_LOG` sets the level. No log setting in the app.
|
||||
- CI on Gitea Actions: macOS builds, tests and lints; Ubuntu and Windows build and test.
|
||||
- Private repo `ELYTerminal` on git.zacharyzhang.com. No credential in any file or commit.
|
||||
- Repo `ELYTerminal` on git.zacharyzhang.com, private until v0.1.1, public since. No credential in any file or commit.
|
||||
|
||||
## 3. Settings model and storage
|
||||
|
||||
@@ -36,6 +36,7 @@ Chapters run in build order. `TASKS.md` follows them line by line.
|
||||
- A theme holds background, foreground, cursor, cursor text, selection background and foreground, and the 16 ANSI colors. Values come from the theme's upstream files (iTerm2-Color-Schemes' Ghostty export, or Ely's palette).
|
||||
- A theme maps onto Ely's `Palette` through `Theme::set_palette`, so panels, inputs and lists wear the theme.
|
||||
- Dark mode: one theme, or a second theme for when the system is dark.
|
||||
- On Omarchy 4 (Linux), an Omarchy theme wears Omarchy's current theme and changes with each switch. It is the default where Omarchy runs; picking another theme stops following.
|
||||
|
||||
## 5. Terminal engine
|
||||
|
||||
@@ -43,6 +44,7 @@ Ghostty is the bar for what the terminal does. ELYTerminal owns its engine on `a
|
||||
|
||||
- PTY: alacritty's `tty` and event loop. The pty is wrapped so its reader passes bytes through an OSC 7 scanner. The scanner reports the working directory.
|
||||
- Shell integration for zsh, bash, fish and PowerShell, injected at launch as Ghostty does: each prompt sends OSC 7 and a title. A shell without integration reports nothing, and the panels say so.
|
||||
- Inside herdr, which keeps its panes' OSC 7, the session's folder is that of herdr's focused pane, read from herdr's socket while herdr's client runs in the foreground, on macOS and Linux.
|
||||
- Grid: colors (named, 256, truecolor, OSC 4/10/11/12), bold, dim, italic, underline (single, double, curly, dotted, dashed), strikethrough, inverse, hidden, wide characters, combining marks.
|
||||
- Box drawing (U+2500–U+257F), block elements (U+2580–U+259F) and powerline shapes (U+E0B0–U+E0B7) painted as geometry, so lines and segments join across cells.
|
||||
- Fonts: JetBrains Mono by default, any installed font by choice; Nerd Font icons the font lacks come from a bundled Nerd Font.
|
||||
@@ -59,6 +61,7 @@ Ghostty is the bar for what the terminal does. ELYTerminal owns its engine on `a
|
||||
|
||||
- Ely's `ColumnShell`: sessions column, terminal column, right column. The window opens with blur when the setting is on.
|
||||
- The sessions column and the right column toggle, each by a button at its end of the title bar or by key, and keep their state in settings, so the window opens as it was left.
|
||||
- The window opens at the size it was left at, on macOS, Windows and Linux: the size is kept in settings once it settles; a maximized or full-screen window keeps the size from before; a kept size past the screen shrinks to it; the window is no smaller than 100 by 100, the least the settings keep.
|
||||
- The title shows the active session's title, and no other text.
|
||||
- The pointer over the terminal is the arrow.
|
||||
- The title bar is transparent, as Ghostty's: the window's background, opacity and blur run under it, so it wears the terminal's color.
|
||||
@@ -92,7 +95,7 @@ Ghostty is the bar for what the terminal does. ELYTerminal owns its engine on `a
|
||||
Cmd-, opens it; on Windows and Linux, which have no menu bar, so does a gear in the title bar. Categories on the left, rows on the right, each side scrolling on its own, Ely's components. Changes apply at once to every session and save.
|
||||
|
||||
- Appearance
|
||||
- Theme: a grid of previews.
|
||||
- Theme: a grid of previews; on Omarchy, the Omarchy theme first.
|
||||
- Separate dark theme: a switch; when on, a second grid for dark mode.
|
||||
- Font family: a list of installed fonts. Font size. Line height. Ligatures.
|
||||
- Cursor: style (block, bar, underline, hollow), blink, with a live preview.
|
||||
@@ -110,7 +113,7 @@ Cmd-, opens it; on Windows and Linux, which have no menu bar, so does a gear in
|
||||
|
||||
- macOS: gpui's `WindowBackgroundAppearance::Blurred` (NSVisualEffectView).
|
||||
- Windows: gpui's `Blurred` (acrylic accent).
|
||||
- Wayland: gpui's `Blurred` speaks `org_kde_kwin_blur`; ELYTerminal adds `ext_background_effect_v1` on the window's surface, which GNOME 51 and Plasma 6.7 support.
|
||||
- Wayland: gpui's `Blurred` speaks `org_kde_kwin_blur`; ELYTerminal adds `ext_background_effect_v1` on the window's surface, which GNOME 51, Plasma 6.7 and Hyprland support. Hyprland honors it only while its own blur is on, which Omarchy 4.0.4 turns off.
|
||||
- X11: ELYTerminal sets `_KDE_NET_WM_BLUR_BEHIND_REGION` (CARDINAL, 32) on the window, as Ghostty does; removes it when blur turns off.
|
||||
- A compositor with neither protocol shows transparency without blur. The app logs which path it took.
|
||||
|
||||
|
||||
@@ -44,11 +44,11 @@ The app writes its log to stderr. `RUST_LOG=elyterminal=debug` writes more; `tra
|
||||
- The terminal runs on `alacritty_terminal`: 256 colors and truecolor, bold, dim, italic, five underline styles, wide characters and combining marks. Box drawing, block elements and powerline shapes are drawn as geometry, so lines join across cells. Keys follow xterm and the kitty keyboard protocol; input methods compose at the cursor; programs can track the mouse; pastes are bracketed when a program asks; OSC 8 and plain links open with the link press below; find searches the scrollback.
|
||||
- Shell integration for zsh, bash, fish and PowerShell: each prompt reports its folder and title.
|
||||
- Sessions: new, close and switch. A bell marks a hidden session's row and makes no sound.
|
||||
- A button at each end of the title bar hides or shows its side column; the window opens as it was left. On Windows and Linux a gear beside the right one opens Settings.
|
||||
- Files shows the session's folder as a tree with Git's marks.
|
||||
- A button at each end of the title bar hides or shows its side column; the window opens as it was left, at the size it was left at. On Windows and Linux a gear beside the right one opens Settings.
|
||||
- Files shows the session's folder as a tree with Git's marks. Inside herdr, on macOS and Linux, the folder is that of herdr's focused pane.
|
||||
- Git shows the branch, stages, unstages, discards, commits, lists recent commits and opens diffs, all through the `git` command line.
|
||||
- Themes: Ely Dark, Ely Light, Catppuccin Mocha, Macchiato, Frappé and Latte, Tokyo Night, Dracula, Nord, Gruvbox Dark, Rosé Pine, Solarized Light, One Light and Kanagawa Wave. A second theme can take over while the system is dark.
|
||||
- Background opacity and blur: NSVisualEffectView on macOS, acrylic on Windows, `ext_background_effect_v1` or `org_kde_kwin_blur` on Wayland, `_KDE_NET_WM_BLUR_BEHIND_REGION` on X11, which KWin reads.
|
||||
- Themes: Ely Dark, Ely Light, Catppuccin Mocha, Macchiato, Frappé and Latte, Tokyo Night, Dracula, Nord, Gruvbox Dark, Rosé Pine, Solarized Light, One Light and Kanagawa Wave. A second theme can take over while the system is dark. On Omarchy 4, an Omarchy theme follows the system's theme as it switches, and is the default there.
|
||||
- Background opacity and blur: NSVisualEffectView on macOS, acrylic on Windows, `ext_background_effect_v1` or `org_kde_kwin_blur` on Wayland, `_KDE_NET_WM_BLUR_BEHIND_REGION` on X11, which KWin reads. Blur shows only while the opacity is under 100%. Hyprland blurs only while its own `decoration:blur:enabled` is on, and Omarchy 4.0.4 turns it off; to turn it on there, add `hl.config({ decoration = { blur = { enabled = true } } })` to `~/.config/hypr/looknfeel.lua`.
|
||||
|
||||
## Keys
|
||||
|
||||
|
||||
@@ -71,4 +71,15 @@ Progress truth. Top to bottom, one at a time. A task is ticked only after its co
|
||||
|
||||
## 16. Fixes from the owner's first run
|
||||
|
||||
- [ ] T26 On Windows every title bar control takes its press, Ely's window buttons too: in Ely, window buttons and header items occlude the drag region; the Git and Files switch moves below the title bar, centered; on Windows and Linux a gear in the title bar opens Settings; on Windows Ctrl-V pastes, as in Windows Terminal; the pointer over the terminal is the arrow; the settings window drops General, whose Shell and Start in lead Terminal, which lists every shortcut, and its categories and page scroll apart; the release's macOS disk image signed with Developer ID and notarized on the signing runner; release v0.1.1 with the three builds.
|
||||
- [x] T26 On Windows every title bar control takes its press, Ely's window buttons too: in Ely, window buttons and header items occlude the drag region; the Git and Files switch moves below the title bar, centered; on Windows and Linux a gear in the title bar opens Settings; on Windows Ctrl-V pastes, as in Windows Terminal; the pointer over the terminal is the arrow; the settings window drops General, whose Shell and Start in lead Terminal, which lists every shortcut, and its categories and page scroll apart; the release's macOS disk image signed with Developer ID and notarized on the signing runner; release v0.1.1 with the three builds.
|
||||
|
||||
## 17. Omarchy
|
||||
|
||||
- [x] T27 On Omarchy 4, an Omarchy theme wears the system's current theme and follows each switch, the default there; the v0.1.1 Linux tarball rebuilt with it, in place of the old one on the release.
|
||||
- [x] T28 Blur on Hyprland, which the owner found absent on Omarchy: Hyprland blurs behind a window only while its own `decoration:blur:enabled` is on, which Omarchy 4.0.4 turns off; the PRD, README, AGENTS.md, the acceptance table and the release notes say so, and how to turn it on.
|
||||
|
||||
## 18. herdr
|
||||
|
||||
- [x] T29 Inside herdr the right column follows herdr's focused pane, which the owner found frozen: herdr keeps its panes' OSC 7, so on macOS and Linux ELYTerminal reads the folder from herdr's socket while herdr's client runs in the session's foreground.
|
||||
- [x] T30 The main window opens at the size it was left at, on macOS, Windows and Linux, which the owner asked for: the size is kept in the settings.
|
||||
- [ ] T31 Release v0.1.2 with T29 and T30: version 0.1.2; the macOS disk image, the Windows zip and the Linux tarball, each from its script; the notes say it fixes herdr compatibility and keeps the window's size.
|
||||
+90
-6
@@ -1,10 +1,10 @@
|
||||
use std::borrow::Cow;
|
||||
use std::{borrow::Cow, cell::RefCell, rc::Rc, time::Duration};
|
||||
|
||||
use anyhow::Context as _;
|
||||
use ely_gpui_component::theme::ActiveTheme;
|
||||
use gpui::{
|
||||
App, AppContext, Bounds, TitlebarOptions, WindowBounds, WindowDecorations, WindowHandle,
|
||||
WindowOptions, px, size,
|
||||
App, AppContext, Bounds, Context, Pixels, Size, Task, TitlebarOptions, Window, WindowBounds,
|
||||
WindowDecorations, WindowHandle, WindowOptions, px, size,
|
||||
};
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
@@ -17,6 +17,9 @@ use crate::{
|
||||
workspace::{self, TITLE, Workspace},
|
||||
};
|
||||
|
||||
/// How long the window's size holds before it is kept, so a drag saves once.
|
||||
const SETTLE: Duration = Duration::from_millis(500);
|
||||
|
||||
/// The id the macOS bundle and Linux desktop entry share.
|
||||
pub const APP_ID: &str = "com.zacharyzhang.elyterminal";
|
||||
|
||||
@@ -64,6 +67,8 @@ pub fn start(cx: &mut App) -> anyhow::Result<()> {
|
||||
mac::repeat_held_keys();
|
||||
mac::deliver_command_key_ups()?;
|
||||
}
|
||||
#[cfg(target_os = "linux")]
|
||||
themes::omarchy::start(cx)?;
|
||||
themes::apply(cx);
|
||||
let chosen = |settings: &settings::Settings| {
|
||||
let theme = (settings.theme.clone(), settings.dark_theme.clone());
|
||||
@@ -83,10 +88,16 @@ pub fn start(cx: &mut App) -> anyhow::Result<()> {
|
||||
|
||||
/// Opens the main window running `launch`.
|
||||
pub fn open(launch: Launch, cx: &mut App) -> anyhow::Result<WindowHandle<Workspace>> {
|
||||
let bounds = Bounds::centered(None, size(px(1200.0), px(760.0)), cx);
|
||||
let kept = opening_size(cx);
|
||||
// macOS grows a window by a point on a side whose edge falls on a half point.
|
||||
let centered = Bounds::centered(None, kept, cx);
|
||||
let bounds = Bounds::new(centered.origin.map(|at| at.round()), kept);
|
||||
let background = blur::appearance(SettingsStore::get(cx));
|
||||
let least = px(*settings::WINDOW.start());
|
||||
let options = WindowOptions {
|
||||
window_bounds: Some(WindowBounds::Windowed(bounds)),
|
||||
// No smaller than the settings keep.
|
||||
window_min_size: Some(size(least, least)),
|
||||
titlebar: Some(TitlebarOptions {
|
||||
title: Some(TITLE.into()),
|
||||
appears_transparent: true,
|
||||
@@ -103,11 +114,84 @@ pub fn open(launch: Launch, cx: &mut App) -> anyhow::Result<WindowHandle<Workspa
|
||||
window
|
||||
.observe_window_appearance(|_, cx| themes::apply(cx))
|
||||
.detach();
|
||||
cx.new(|cx| Workspace::new(pty, events, launch, window, cx))
|
||||
cx.new(|cx| {
|
||||
keep_size(window, cx);
|
||||
Workspace::new(pty, events, launch, window, cx)
|
||||
})
|
||||
})?;
|
||||
log::info!(
|
||||
"app: main window open, blur: {background:?} on {}",
|
||||
"app: main window open at {} by {}, blur: {background:?} on {}",
|
||||
f32::from(kept.width),
|
||||
f32::from(kept.height),
|
||||
std::env::consts::OS
|
||||
);
|
||||
Ok(window)
|
||||
}
|
||||
|
||||
/// The kept size, within the primary display's visible area where that is known.
|
||||
fn opening_size(cx: &App) -> Size<Pixels> {
|
||||
let settings = SettingsStore::get(cx);
|
||||
let room = cx
|
||||
.primary_display()
|
||||
.map(|display| display.visible_bounds().size);
|
||||
let fit = |want: f32, side: Option<Pixels>| match side.map(f32::from) {
|
||||
Some(side) if side > 0.0 && want > side => {
|
||||
log::info!(
|
||||
"app: a kept side of {want} px passes the screen's {side}; the window takes {side}"
|
||||
);
|
||||
px(side)
|
||||
}
|
||||
_ => px(want),
|
||||
};
|
||||
size(
|
||||
fit(settings.window_width, room.map(|area| area.width)),
|
||||
fit(settings.window_height, room.map(|area| area.height)),
|
||||
)
|
||||
}
|
||||
|
||||
/// Keeps the window's size in the settings once it settles; maximized, full screen or hidden, the size before stays.
|
||||
fn keep_size(window: &mut Window, cx: &mut Context<Workspace>) {
|
||||
let settling: Rc<RefCell<Option<Task<()>>>> = Rc::default();
|
||||
let settle = move |window: &mut Window, cx: &mut Context<Workspace>| {
|
||||
let task = cx.spawn_in(window, async move |_, cx| {
|
||||
cx.background_executor().timer(SETTLE).await;
|
||||
// Read once settled: X11 marks a window maximized late, and unmaximized while hidden.
|
||||
let kept = cx.update(|window, cx| {
|
||||
if !window.is_visible() || window.is_maximized() || window.is_fullscreen() {
|
||||
log::debug!(
|
||||
"app: the window is hidden, maximized or full screen; its kept size stays"
|
||||
);
|
||||
return Ok(());
|
||||
}
|
||||
let area = window.window_bounds().get_bounds().size;
|
||||
let (width, height) = (
|
||||
f32::from(area.width).round(),
|
||||
f32::from(area.height).round(),
|
||||
);
|
||||
SettingsStore::update(cx, |settings| {
|
||||
settings.window_width = width;
|
||||
settings.window_height = height;
|
||||
})
|
||||
.with_context(|| {
|
||||
format!("app: the window's size, {width} by {height}, is not kept")
|
||||
})
|
||||
});
|
||||
match kept {
|
||||
Ok(Ok(())) => {}
|
||||
Ok(Err(error)) => log::error!("{error:#}"),
|
||||
Err(_) => log::debug!("app: the window closed before its size settled"),
|
||||
}
|
||||
});
|
||||
settling.replace(Some(task));
|
||||
};
|
||||
let shown = settle.clone();
|
||||
cx.observe_window_bounds(window, move |_, window, cx| settle(window, cx))
|
||||
.detach();
|
||||
// A size skipped while the window hid is read again once it shows.
|
||||
cx.observe_window_visibility(window, move |_, visibility, window, cx| {
|
||||
if visibility.is_visible() {
|
||||
shown(window, cx);
|
||||
}
|
||||
})
|
||||
.detach();
|
||||
}
|
||||
+19
-5
@@ -75,6 +75,9 @@ pub struct Settings {
|
||||
pub show_sessions: bool,
|
||||
pub show_panel: bool,
|
||||
pub panel: PanelTab,
|
||||
/// The main window's size, unmaximized, in pixels.
|
||||
pub window_width: f32,
|
||||
pub window_height: f32,
|
||||
}
|
||||
|
||||
impl Default for Settings {
|
||||
@@ -82,7 +85,7 @@ impl Default for Settings {
|
||||
Self {
|
||||
shell: String::new(),
|
||||
start_in: StartIn::Home,
|
||||
theme: "catppuccin-mocha".into(),
|
||||
theme: themes::default_id().into(),
|
||||
dark_theme: None,
|
||||
font_family: "JetBrains Mono".into(),
|
||||
font_size: 13.0,
|
||||
@@ -100,6 +103,8 @@ impl Default for Settings {
|
||||
show_sessions: true,
|
||||
show_panel: true,
|
||||
panel: PanelTab::Git,
|
||||
window_width: 1200.0,
|
||||
window_height: 760.0,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -109,6 +114,7 @@ pub const LINE_HEIGHT: RangeInclusive<f32> = 1.0..=2.0;
|
||||
pub const OPACITY: RangeInclusive<f32> = 0.3..=1.0;
|
||||
pub const PADDING: RangeInclusive<f32> = 0.0..=64.0;
|
||||
pub const SCROLLBACK: RangeInclusive<u32> = 0..=100_000;
|
||||
pub const WINDOW: RangeInclusive<f32> = 100.0..=16384.0;
|
||||
|
||||
impl Settings {
|
||||
/// Every value inside its range, every theme built in; the error names the field.
|
||||
@@ -119,15 +125,14 @@ impl Settings {
|
||||
within("padding_x", self.padding_x, &PADDING)?;
|
||||
within("padding_y", self.padding_y, &PADDING)?;
|
||||
within("scrollback", self.scrollback, &SCROLLBACK)?;
|
||||
within("window_width", self.window_width, &WINDOW)?;
|
||||
within("window_height", self.window_height, &WINDOW)?;
|
||||
for (field, id) in [
|
||||
("theme", Some(&self.theme)),
|
||||
("dark_theme", self.dark_theme.as_ref()),
|
||||
] {
|
||||
if let Some(id) = id {
|
||||
anyhow::ensure!(
|
||||
themes::find(id).is_some(),
|
||||
"{field} is {id:?}, no built-in theme"
|
||||
);
|
||||
anyhow::ensure!(themes::known(id), "{field} is {id:?}, no built-in theme");
|
||||
}
|
||||
}
|
||||
anyhow::ensure!(!self.font_family.is_empty(), "font_family is empty");
|
||||
@@ -228,6 +233,15 @@ mod tests {
|
||||
error.to_string(),
|
||||
"scrollback is 100001, outside 0 to 100000"
|
||||
);
|
||||
let settings = Settings {
|
||||
window_width: 50.0,
|
||||
..Settings::default()
|
||||
};
|
||||
let error = settings.validate().expect_err("too narrow");
|
||||
assert_eq!(
|
||||
error.to_string(),
|
||||
"window_width is 50, outside 100 to 16384"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -103,7 +103,7 @@ impl SettingsWindow {
|
||||
settings.cursor_style,
|
||||
|settings, style| settings.cursor_style = style,
|
||||
);
|
||||
let active = themes::active(settings, window.appearance());
|
||||
let active = themes::active(settings, window.appearance(), cx);
|
||||
let lit = self.lit || !settings.cursor_blink;
|
||||
let cursor = SettingsSection::new("Cursor")
|
||||
.row(SettingsRow::new("Style").control(style))
|
||||
@@ -113,7 +113,7 @@ impl SettingsWindow {
|
||||
settings.cursor_blink,
|
||||
|settings, on| settings.cursor_blink = on,
|
||||
)))
|
||||
.row(SettingsRow::new("Preview").control(prompt(settings, active, lit, cx)));
|
||||
.row(SettingsRow::new("Preview").control(prompt(settings, &active, lit, cx)));
|
||||
let opacity = percent(settings.background_opacity);
|
||||
let slider = Slider::new("background_opacity", opacity)
|
||||
.range(percent(*OPACITY.start()), percent(*OPACITY.end()))
|
||||
@@ -207,7 +207,7 @@ fn fraction(percent: f64) -> f32 {
|
||||
(percent / 100.) as f32
|
||||
}
|
||||
|
||||
/// Every built-in theme as a card over its preview; `dark` picks the one a dark system wears.
|
||||
/// Omarchy's theme where followed, then every built-in, as cards; `dark` picks the dark system's.
|
||||
fn grid(
|
||||
this: &Entity<SettingsWindow>,
|
||||
title: Option<&'static str>,
|
||||
@@ -222,7 +222,8 @@ fn grid(
|
||||
} else {
|
||||
("theme", Some(settings.theme.as_str()))
|
||||
};
|
||||
let cards = themes::all().iter().map(|each| {
|
||||
let omarchy = cx.try_global::<themes::Omarchy>().map(|omarchy| &omarchy.0);
|
||||
let cards = omarchy.into_iter().chain(themes::all()).map(|each| {
|
||||
let (id, this) = (each.id, this.clone());
|
||||
let key = SharedString::from(format!("{field}-{id}"));
|
||||
RadioCard::new(key, chosen == Some(id), each.name)
|
||||
|
||||
@@ -0,0 +1,482 @@
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
ffi::{OsStr, OsString},
|
||||
io::{self, BufRead, BufReader, Write},
|
||||
os::unix::{ffi::OsStringExt, net::UnixStream},
|
||||
path::{Path, PathBuf},
|
||||
time::Duration,
|
||||
};
|
||||
|
||||
use anyhow::Context as _;
|
||||
use gpui::{Context, Task};
|
||||
use serde::Deserialize;
|
||||
|
||||
use super::view::{TerminalEvent, TerminalView};
|
||||
|
||||
/// How often the session's foreground program is checked.
|
||||
const CHECK: Duration = Duration::from_millis(500);
|
||||
|
||||
/// How long herdr may take to answer.
|
||||
const WAIT: Duration = Duration::from_secs(1);
|
||||
|
||||
/// The socket request for herdr's session: its focus and its panes' folders.
|
||||
const SNAPSHOT: &[u8] = b"{\"id\":\"elyterminal\",\"method\":\"session.snapshot\",\"params\":{}}\n";
|
||||
|
||||
/// A program's arguments, and its variables as the kernel holds them.
|
||||
type Invocation = (Vec<String>, HashMap<String, OsString>);
|
||||
|
||||
/// Follows the pane herdr's server has focused while herdr's client runs in the foreground.
|
||||
pub fn follow(cx: &mut Context<TerminalView>) -> Task<()> {
|
||||
cx.spawn(async move |view, cx| {
|
||||
let mut seen: Option<(i32, Option<PathBuf>)> = None;
|
||||
let (mut socket, mut shown, mut retry, mut failed) = (None, None, false, String::new());
|
||||
loop {
|
||||
cx.background_executor().timer(CHECK).await;
|
||||
let Ok((pid, group)) = view.update(cx, |view, _| (view.pty.pid, view.pty.foreground()))
|
||||
else {
|
||||
break;
|
||||
};
|
||||
let group = match group {
|
||||
Ok(group) => Some(group),
|
||||
Err(error) => {
|
||||
if seen.is_some() {
|
||||
log::debug!("terminal {pid}: its foreground does not read: {error}");
|
||||
}
|
||||
None
|
||||
}
|
||||
};
|
||||
// An exec keeps the group and swaps the program, so the two name the foreground.
|
||||
let program = match group {
|
||||
Some(group) => {
|
||||
let exe = cx
|
||||
.background_executor()
|
||||
.spawn(async move { path(group).ok() })
|
||||
.await;
|
||||
Some((group, exe))
|
||||
}
|
||||
None => None,
|
||||
};
|
||||
if program != seen {
|
||||
if let Some((group, None)) = &program {
|
||||
log::debug!(
|
||||
"terminal {pid}: process {group}, another user's or gone, does not read"
|
||||
);
|
||||
}
|
||||
seen = program.clone();
|
||||
shown = None;
|
||||
retry = true;
|
||||
failed.clear();
|
||||
if socket.take().is_some() {
|
||||
log::info!("terminal {pid}: herdr left the foreground");
|
||||
}
|
||||
}
|
||||
if retry {
|
||||
let found = match program {
|
||||
Some((group, Some(exe)))
|
||||
if exe.file_name().is_some_and(|name| name == "herdr") =>
|
||||
{
|
||||
cx.background_executor()
|
||||
.spawn(async move { client(group) })
|
||||
.await
|
||||
}
|
||||
_ => Ok(None),
|
||||
};
|
||||
retry = found.is_err();
|
||||
socket = found.unwrap_or_else(|error| {
|
||||
failure(&mut failed, pid, &error);
|
||||
None
|
||||
});
|
||||
if let Some(socket) = &socket {
|
||||
log::info!(
|
||||
"terminal {pid}: herdr runs here, its server at {}",
|
||||
socket.display()
|
||||
);
|
||||
}
|
||||
}
|
||||
let Some(path) = socket.clone() else {
|
||||
continue;
|
||||
};
|
||||
match cx
|
||||
.background_executor()
|
||||
.spawn(async move { folder(&path) })
|
||||
.await
|
||||
{
|
||||
Ok(Some(folder)) if shown.as_ref() != Some(&folder) => {
|
||||
failed.clear();
|
||||
let report = folder.clone();
|
||||
// herdr may have left while it answered; the shell's own report then stands.
|
||||
let Ok(still) = view.update(cx, |view, cx| {
|
||||
let still = view.pty.foreground().ok() == group;
|
||||
if still {
|
||||
cx.emit(TerminalEvent::Folder(report));
|
||||
}
|
||||
still
|
||||
}) else {
|
||||
break;
|
||||
};
|
||||
if still {
|
||||
log::info!(
|
||||
"terminal {pid}: herdr's focused pane is in {}",
|
||||
folder.display()
|
||||
);
|
||||
shown = Some(folder);
|
||||
}
|
||||
}
|
||||
Ok(_) => failed.clear(),
|
||||
Err(error) => failure(&mut failed, pid, &error),
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/// Logs `error` once while it lasts; a server not up yet is no error.
|
||||
fn failure(failed: &mut String, pid: u32, error: &anyhow::Error) {
|
||||
let text = format!("{error:#}");
|
||||
if text != *failed {
|
||||
let level = if starting(error) {
|
||||
log::Level::Info
|
||||
} else {
|
||||
log::Level::Error
|
||||
};
|
||||
log::log!(level, "terminal {pid}: {text}; the panel keeps its folder");
|
||||
*failed = text;
|
||||
}
|
||||
}
|
||||
|
||||
/// herdr's client runs before its server listens: no socket yet, or none answering.
|
||||
fn starting(error: &anyhow::Error) -> bool {
|
||||
error.downcast_ref::<io::Error>().is_some_and(|error| {
|
||||
matches!(
|
||||
error.kind(),
|
||||
io::ErrorKind::NotFound | io::ErrorKind::ConnectionRefused
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
/// The socket of the herdr server whose terminal client leads process group `group`, if it is one.
|
||||
fn client(group: i32) -> anyhow::Result<Option<PathBuf>> {
|
||||
let (args, env) =
|
||||
launch(group).with_context(|| format!("herdr: process {group} does not read"))?;
|
||||
let Some(socket) = follows(&args, &env)? else {
|
||||
return Ok(None);
|
||||
};
|
||||
if socket.is_absolute() {
|
||||
return Ok(Some(socket));
|
||||
}
|
||||
// herdr reads a relative socket from its client's folder.
|
||||
let folder =
|
||||
cwd(group).with_context(|| format!("herdr: process {group}'s folder does not read"))?;
|
||||
Ok(Some(folder.join(socket)))
|
||||
}
|
||||
|
||||
/// The socket a herdr process with `args` and `env` shows, if it is herdr's terminal client.
|
||||
pub(super) fn follows(
|
||||
args: &[String],
|
||||
env: &HashMap<String, OsString>,
|
||||
) -> anyhow::Result<Option<PathBuf>> {
|
||||
if !attaches(args) {
|
||||
return Ok(None);
|
||||
}
|
||||
let remote = |arg: &String| {
|
||||
["--remote", "--machine"]
|
||||
.iter()
|
||||
.any(|flag| arg == flag || arg.starts_with(&format!("{flag}=")))
|
||||
};
|
||||
anyhow::ensure!(
|
||||
!args.iter().any(remote),
|
||||
"herdr: its client shows another machine's server, whose folders cannot show here"
|
||||
);
|
||||
socket(args, env).map(Some)
|
||||
}
|
||||
|
||||
/// Whether `args` start herdr's terminal client, not one of its commands.
|
||||
fn attaches(args: &[String]) -> bool {
|
||||
let mut rest = args.iter().skip(1);
|
||||
while let Some(arg) = rest.next() {
|
||||
match arg.as_str() {
|
||||
"--session" | "--remote" | "--machine" | "--remote-keybindings" => {
|
||||
rest.next();
|
||||
}
|
||||
"--version" | "-V" | "--help" | "-h" | "--default-config" | "--skill" => return false,
|
||||
"client" => return true,
|
||||
"session" => return rest.next().is_some_and(|next| next == "attach"),
|
||||
flag if flag.starts_with('-') => {}
|
||||
_ => return false,
|
||||
}
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
/// The socket herdr 0.9's client finds: a named session, `HERDR_SOCKET_PATH`, `HERDR_SESSION`, the default.
|
||||
fn socket(args: &[String], env: &HashMap<String, OsString>) -> anyhow::Result<PathBuf> {
|
||||
let dir = match (env.get("XDG_CONFIG_HOME"), env.get("HOME")) {
|
||||
(Some(config), _) => PathBuf::from(config).join("herdr"),
|
||||
(None, Some(home)) => PathBuf::from(home).join(".config/herdr"),
|
||||
(None, None) => anyhow::bail!("herdr: its client has no HOME"),
|
||||
};
|
||||
let named = |name: &OsStr| {
|
||||
if name == "default" {
|
||||
dir.join("herdr.sock")
|
||||
} else {
|
||||
dir.join("sessions").join(name).join("herdr.sock")
|
||||
}
|
||||
};
|
||||
if let Some(name) = session(args) {
|
||||
return Ok(named(OsStr::new(&name)));
|
||||
}
|
||||
if let Some(path) = env.get("HERDR_SOCKET_PATH") {
|
||||
return Ok(PathBuf::from(path));
|
||||
}
|
||||
Ok(env
|
||||
.get("HERDR_SESSION")
|
||||
.map_or_else(|| dir.join("herdr.sock"), |name| named(name)))
|
||||
}
|
||||
|
||||
/// The session `session attach NAME`, `--session NAME` or `--session=NAME` names, as herdr reads it.
|
||||
fn session(args: &[String]) -> Option<String> {
|
||||
if let [_, noun, verb, name] = args
|
||||
&& noun == "session"
|
||||
&& verb == "attach"
|
||||
{
|
||||
return Some(name.clone());
|
||||
}
|
||||
let mut named = None;
|
||||
let mut rest = args.iter().skip(1);
|
||||
while let Some(arg) = rest.next() {
|
||||
if arg == "--" {
|
||||
break;
|
||||
}
|
||||
if arg == "--session" {
|
||||
named = rest.next().cloned();
|
||||
} else if let Some(name) = arg.strip_prefix("--session=") {
|
||||
named = Some(name.to_owned());
|
||||
}
|
||||
}
|
||||
named
|
||||
}
|
||||
|
||||
/// The folder of the pane herdr's server has focused; none while it has none or knows none.
|
||||
fn folder(socket: &Path) -> anyhow::Result<Option<PathBuf>> {
|
||||
let ask = || -> io::Result<String> {
|
||||
let mut stream = UnixStream::connect(socket)?;
|
||||
stream.set_read_timeout(Some(WAIT))?;
|
||||
stream.set_write_timeout(Some(WAIT))?;
|
||||
stream.write_all(SNAPSHOT)?;
|
||||
let mut reply = String::new();
|
||||
BufReader::new(stream).read_line(&mut reply)?;
|
||||
Ok(reply)
|
||||
};
|
||||
let reply = ask().with_context(|| format!("herdr: asking {}", socket.display()))?;
|
||||
focused(&reply).with_context(|| format!("herdr: {}", socket.display()))
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct Reply {
|
||||
result: Option<Snapshot>,
|
||||
error: Option<Failure>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct Snapshot {
|
||||
snapshot: Session,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct Session {
|
||||
focused_pane_id: Option<String>,
|
||||
panes: Vec<Pane>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct Pane {
|
||||
pane_id: String,
|
||||
cwd: Option<PathBuf>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct Failure {
|
||||
code: String,
|
||||
message: String,
|
||||
}
|
||||
|
||||
/// The focused pane's folder in herdr's `session.snapshot` reply.
|
||||
pub(super) fn focused(reply: &str) -> anyhow::Result<Option<PathBuf>> {
|
||||
let reply: Reply = serde_json::from_str(reply).context("its reply does not parse")?;
|
||||
if let Some(Failure { code, message }) = reply.error {
|
||||
anyhow::bail!("{code}: {message}");
|
||||
}
|
||||
let session = reply.result.context("its reply holds no result")?.snapshot;
|
||||
let Some(id) = session.focused_pane_id else {
|
||||
return Ok(None);
|
||||
};
|
||||
let pane = session
|
||||
.panes
|
||||
.into_iter()
|
||||
.find(|pane| pane.pane_id == id)
|
||||
.with_context(|| format!("its focused pane {id} is not among its panes"))?;
|
||||
if let Some(cwd) = &pane.cwd {
|
||||
anyhow::ensure!(
|
||||
cwd.is_absolute(),
|
||||
"pane {id}'s folder {} is relative",
|
||||
cwd.display()
|
||||
);
|
||||
}
|
||||
Ok(pane.cwd)
|
||||
}
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
fn path(pid: i32) -> io::Result<PathBuf> {
|
||||
std::fs::read_link(format!("/proc/{pid}/exe")).map(installed)
|
||||
}
|
||||
|
||||
/// The path of an executable the kernel marks ` (deleted)`, as an update that replaced it leaves it.
|
||||
#[cfg(target_os = "linux")]
|
||||
pub(super) fn installed(path: PathBuf) -> PathBuf {
|
||||
use std::os::unix::ffi::OsStrExt;
|
||||
match path.as_os_str().as_bytes().strip_suffix(b" (deleted)") {
|
||||
Some(kept) => PathBuf::from(OsStr::from_bytes(kept)),
|
||||
None => path,
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
fn launch(pid: i32) -> io::Result<Invocation> {
|
||||
let read = |name: &str| std::fs::read(format!("/proc/{pid}/{name}"));
|
||||
let (args, env) = (read("cmdline")?, read("environ")?);
|
||||
let args = strings(&args).map(lossy).collect();
|
||||
let env = strings(&env).filter_map(variable).collect();
|
||||
Ok((args, env))
|
||||
}
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
fn cwd(pid: i32) -> io::Result<PathBuf> {
|
||||
std::fs::read_link(format!("/proc/{pid}/cwd"))
|
||||
}
|
||||
|
||||
/// Each NUL-ended string in `bytes`.
|
||||
#[cfg(target_os = "linux")]
|
||||
fn strings(bytes: &[u8]) -> impl Iterator<Item = &[u8]> {
|
||||
bytes
|
||||
.strip_suffix(b"\0")
|
||||
.unwrap_or(bytes)
|
||||
.split(|byte| *byte == 0)
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
fn path(pid: i32) -> io::Result<PathBuf> {
|
||||
let mut buffer = vec![0u8; libc::PROC_PIDPATHINFO_MAXSIZE as usize];
|
||||
// SAFETY: the buffer holds the size given.
|
||||
let length =
|
||||
unsafe { libc::proc_pidpath(pid, buffer.as_mut_ptr().cast(), buffer.len() as u32) };
|
||||
if length <= 0 {
|
||||
return Err(io::Error::last_os_error());
|
||||
}
|
||||
buffer.truncate(length as usize);
|
||||
Ok(PathBuf::from(OsString::from_vec(buffer)))
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
fn launch(pid: i32) -> io::Result<Invocation> {
|
||||
let mut name = [libc::CTL_KERN, libc::KERN_PROCARGS2, pid];
|
||||
let mut ask = |buffer: &mut Vec<u8>| {
|
||||
let mut size = buffer.len();
|
||||
let into = if buffer.is_empty() {
|
||||
std::ptr::null_mut()
|
||||
} else {
|
||||
buffer.as_mut_ptr().cast()
|
||||
};
|
||||
// SAFETY: `into` holds `size` bytes, or is null to ask for the size.
|
||||
let done = unsafe {
|
||||
libc::sysctl(
|
||||
name.as_mut_ptr(),
|
||||
3,
|
||||
into,
|
||||
&mut size,
|
||||
std::ptr::null_mut(),
|
||||
0,
|
||||
)
|
||||
};
|
||||
if done != 0 {
|
||||
return Err(io::Error::last_os_error());
|
||||
}
|
||||
Ok(size)
|
||||
};
|
||||
let mut buffer = Vec::new();
|
||||
let size = ask(&mut buffer)?;
|
||||
buffer.resize(size, 0);
|
||||
let size = ask(&mut buffer)?;
|
||||
buffer.truncate(size);
|
||||
procargs(&buffer)
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
fn cwd(pid: i32) -> io::Result<PathBuf> {
|
||||
// SAFETY: the struct is plain C data, valid zeroed.
|
||||
let mut info: libc::proc_vnodepathinfo = unsafe { std::mem::zeroed() };
|
||||
let size = std::mem::size_of::<libc::proc_vnodepathinfo>() as libc::c_int;
|
||||
// SAFETY: `info` holds the size given.
|
||||
let read = unsafe {
|
||||
libc::proc_pidinfo(
|
||||
pid,
|
||||
libc::PROC_PIDVNODEPATHINFO,
|
||||
0,
|
||||
(&raw mut info).cast(),
|
||||
size,
|
||||
)
|
||||
};
|
||||
if read <= 0 {
|
||||
return Err(io::Error::last_os_error());
|
||||
}
|
||||
if read != size {
|
||||
return Err(io::Error::other(format!(
|
||||
"proc_pidinfo read {read} of {size} bytes"
|
||||
)));
|
||||
}
|
||||
let path = info
|
||||
.pvi_cdir
|
||||
.vip_path
|
||||
.iter()
|
||||
.flatten()
|
||||
.map(|byte| *byte as u8);
|
||||
Ok(PathBuf::from(OsString::from_vec(
|
||||
path.take_while(|byte| *byte != 0).collect(),
|
||||
)))
|
||||
}
|
||||
|
||||
/// `KERN_PROCARGS2`'s layout: argc, the program's path, NUL padding, the arguments, the variables.
|
||||
#[cfg(target_os = "macos")]
|
||||
pub(super) fn procargs(buffer: &[u8]) -> io::Result<Invocation> {
|
||||
let invalid =
|
||||
|what: &str| io::Error::new(io::ErrorKind::InvalidData, format!("KERN_PROCARGS2 {what}"));
|
||||
let (count, rest) = buffer
|
||||
.split_first_chunk::<4>()
|
||||
.ok_or_else(|| invalid("holds no argument count"))?;
|
||||
let count = usize::try_from(i32::from_ne_bytes(*count))
|
||||
.map_err(|_| invalid("holds a negative argument count"))?;
|
||||
let mut parts = rest
|
||||
.split(|byte| *byte == 0)
|
||||
.skip(1)
|
||||
.skip_while(|part| part.is_empty());
|
||||
let args = parts.by_ref().take(count).map(lossy).collect();
|
||||
let env = parts
|
||||
.take_while(|part| !part.is_empty())
|
||||
.filter_map(variable)
|
||||
.collect();
|
||||
Ok((args, env))
|
||||
}
|
||||
|
||||
fn lossy(bytes: &[u8]) -> String {
|
||||
String::from_utf8_lossy(bytes).into_owned()
|
||||
}
|
||||
|
||||
/// A `NAME=value` variable; its value keeps its bytes.
|
||||
fn variable(pair: &[u8]) -> Option<(String, OsString)> {
|
||||
let at = pair.iter().position(|byte| *byte == b'=')?;
|
||||
Some((
|
||||
lossy(&pair[..at]),
|
||||
OsString::from_vec(pair[at + 1..].to_vec()),
|
||||
))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
@@ -0,0 +1,164 @@
|
||||
use std::{fs, os::unix::net::UnixListener};
|
||||
|
||||
use super::*;
|
||||
|
||||
fn args(words: &str) -> Vec<String> {
|
||||
words.split(' ').map(str::to_owned).collect()
|
||||
}
|
||||
|
||||
fn env(pairs: &[(&str, &str)]) -> HashMap<String, OsString> {
|
||||
pairs
|
||||
.iter()
|
||||
.map(|(name, value)| ((*name).to_owned(), OsString::from(value)))
|
||||
.collect()
|
||||
}
|
||||
|
||||
fn found(words: &str, env: &HashMap<String, OsString>) -> PathBuf {
|
||||
follows(&args(words), env)
|
||||
.expect("a local client")
|
||||
.expect("herdr's client")
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_client_finds_its_server_as_herdr_does() {
|
||||
let home = env(&[("HOME", "/h")]);
|
||||
let default = PathBuf::from("/h/.config/herdr/herdr.sock");
|
||||
let work = PathBuf::from("/h/.config/herdr/sessions/work/herdr.sock");
|
||||
assert_eq!(found("herdr", &home), default);
|
||||
assert_eq!(found("herdr client", &home), default);
|
||||
assert_eq!(found("herdr --session work", &home), work);
|
||||
assert_eq!(found("herdr --session=work", &home), work);
|
||||
assert_eq!(found("herdr session attach work", &home), work);
|
||||
assert_eq!(found("herdr --session default", &home), default);
|
||||
let config = env(&[("HOME", "/h"), ("XDG_CONFIG_HOME", "/x")]);
|
||||
assert_eq!(
|
||||
found("herdr", &config),
|
||||
PathBuf::from("/x/herdr/herdr.sock")
|
||||
);
|
||||
let socket = env(&[("HOME", "/h"), ("HERDR_SOCKET_PATH", "/s.sock")]);
|
||||
assert_eq!(found("herdr", &socket), PathBuf::from("/s.sock"));
|
||||
assert_eq!(found("herdr --session work", &socket), work);
|
||||
let relative = env(&[("HOME", "/h"), ("HERDR_SOCKET_PATH", "herdr.sock")]);
|
||||
assert_eq!(found("herdr", &relative), PathBuf::from("herdr.sock"));
|
||||
let named = env(&[("HOME", "/h"), ("HERDR_SESSION", "work")]);
|
||||
assert_eq!(found("herdr", &named), work);
|
||||
assert!(follows(&args("herdr"), &env(&[])).is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn only_herdr_s_terminal_client_is_followed() {
|
||||
let home = env(&[("HOME", "/h")]);
|
||||
for words in [
|
||||
"herdr pane list",
|
||||
"herdr api snapshot",
|
||||
"herdr server",
|
||||
"herdr session list",
|
||||
"herdr --version",
|
||||
"herdr --session work status",
|
||||
] {
|
||||
assert_eq!(follows(&args(words), &home).expect(words), None, "{words}");
|
||||
}
|
||||
for words in ["herdr --remote box", "herdr --remote=box --session work"] {
|
||||
let error = follows(&args(words), &home).expect_err(words);
|
||||
assert!(error.to_string().contains("another machine"), "{error}");
|
||||
}
|
||||
}
|
||||
|
||||
fn reply(focused_pane: &str, cwd: &str) -> String {
|
||||
format!(
|
||||
r#"{{"id":"elyterminal","result":{{"type":"session_snapshot","snapshot":{{"version":"0.9.5","protocol":22,"focused_pane_id":{focused_pane},"workspaces":[],"tabs":[],"panes":[{{"pane_id":"w1:p1","cwd":"/a","focused":false}},{{"pane_id":"w1:p2","cwd":{cwd},"focused":true}}],"layouts":[],"agents":[]}}}}}}"#
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_focused_pane_s_folder_comes_from_herdr_s_snapshot() {
|
||||
let read = |focused_pane: &str, cwd: &str| focused(&reply(focused_pane, cwd));
|
||||
assert_eq!(
|
||||
read(r#""w1:p2""#, r#""/srv/b""#).expect("a folder"),
|
||||
Some("/srv/b".into())
|
||||
);
|
||||
assert_eq!(read("null", r#""/srv/b""#).expect("no focus"), None);
|
||||
assert_eq!(read(r#""w1:p2""#, "null").expect("no folder"), None);
|
||||
let error = read(r#""w1:p9""#, r#""/b""#).expect_err("a lost pane");
|
||||
assert!(error.to_string().contains("w1:p9"), "{error}");
|
||||
let error = read(r#""w1:p2""#, r#""b""#).expect_err("a relative folder");
|
||||
assert!(error.to_string().contains("relative"), "{error}");
|
||||
let failed =
|
||||
r#"{"id":"elyterminal","error":{"code":"invalid_request","message":"no such method"}}"#;
|
||||
let error = focused(failed).expect_err("an error");
|
||||
assert_eq!(error.to_string(), "invalid_request: no such method");
|
||||
assert!(focused("").is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn herdr_answers_over_its_socket() {
|
||||
let dir = std::env::temp_dir().join(format!("elyterminal-herdr-{}", std::process::id()));
|
||||
if dir.exists() {
|
||||
fs::remove_dir_all(&dir).expect("a stale test folder goes");
|
||||
}
|
||||
fs::create_dir_all(&dir).expect("a test folder");
|
||||
let socket = dir.join("herdr.sock");
|
||||
let listener = UnixListener::bind(&socket).expect("a socket");
|
||||
let answer = reply(r#""w1:p2""#, r#""/srv""#);
|
||||
let server = std::thread::spawn(move || {
|
||||
let (stream, _) = listener.accept().expect("a client");
|
||||
let mut request = String::new();
|
||||
BufReader::new(&stream)
|
||||
.read_line(&mut request)
|
||||
.expect("a request");
|
||||
(&stream)
|
||||
.write_all(format!("{answer}\n").as_bytes())
|
||||
.expect("a reply");
|
||||
request
|
||||
});
|
||||
assert_eq!(folder(&socket).expect("an answer"), Some("/srv".into()));
|
||||
assert_eq!(server.join().expect("the server").as_bytes(), SNAPSHOT);
|
||||
fs::remove_dir_all(&dir).expect("the test folder goes");
|
||||
let error = folder(&socket).expect_err("no server");
|
||||
assert!(format!("{error:#}").contains("asking"), "{error:#}");
|
||||
assert!(starting(&error), "{error:#}");
|
||||
assert!(!starting(&focused("").expect_err("no reply")));
|
||||
}
|
||||
|
||||
/// macOS hides the variables of its own programs, such as `/bin/sleep`, so the test reads itself.
|
||||
#[test]
|
||||
fn a_process_reads_with_its_path_arguments_variables_and_folder() {
|
||||
let pid = std::process::id() as i32;
|
||||
let read = path(pid).expect("its path");
|
||||
let (args, env) = launch(pid).expect("its arguments");
|
||||
let exe = std::env::current_exe().expect("this test's path");
|
||||
assert_eq!(fs::canonicalize(read).ok(), fs::canonicalize(exe).ok());
|
||||
assert_eq!(args, std::env::args().collect::<Vec<_>>());
|
||||
assert_eq!(env.get("HOME"), std::env::var_os("HOME").as_ref());
|
||||
let folder = std::env::current_dir().expect("this test's folder");
|
||||
assert_eq!(
|
||||
fs::canonicalize(cwd(pid).expect("its folder")).ok(),
|
||||
fs::canonicalize(folder).ok()
|
||||
);
|
||||
}
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
#[test]
|
||||
fn an_updated_herdr_still_names_itself() {
|
||||
let deleted = PathBuf::from("/home/u/.local/bin/herdr (deleted)");
|
||||
assert_eq!(
|
||||
installed(deleted),
|
||||
PathBuf::from("/home/u/.local/bin/herdr")
|
||||
);
|
||||
assert_eq!(
|
||||
installed("/usr/bin/herdr".into()),
|
||||
PathBuf::from("/usr/bin/herdr")
|
||||
);
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
#[test]
|
||||
fn macos_lays_out_the_arguments_after_the_program_s_path() {
|
||||
let mut buffer = 2i32.to_ne_bytes().to_vec();
|
||||
buffer.extend_from_slice(b"/usr/local/bin/herdr\0\0\0\0herdr\0\0HOME=/h\0X=a=b\0\0\0");
|
||||
let (args, env) = procargs(&buffer).expect("it parses");
|
||||
assert_eq!(args, ["herdr", ""]);
|
||||
assert_eq!(env.get("HOME"), Some(&OsString::from("/h")));
|
||||
assert_eq!(env.get("X"), Some(&OsString::from("a=b")));
|
||||
assert!(procargs(&[1, 0]).is_err());
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
mod boxes;
|
||||
mod find;
|
||||
pub mod frame;
|
||||
#[cfg(unix)]
|
||||
mod herdr;
|
||||
pub mod ink;
|
||||
pub mod input;
|
||||
pub mod keys;
|
||||
|
||||
+33
-3
@@ -56,7 +56,7 @@ pub struct Pty {
|
||||
pub term: Arc<FairMutex<Term<Listener>>>,
|
||||
pub pid: u32,
|
||||
notifier: Notifier,
|
||||
#[cfg(all(test, unix))]
|
||||
#[cfg(unix)]
|
||||
master: std::fs::File,
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ pub fn spawn(
|
||||
)
|
||||
})?;
|
||||
let pid = child_id(&raw)?;
|
||||
#[cfg(all(test, unix))]
|
||||
#[cfg(unix)]
|
||||
let master = raw
|
||||
.master()
|
||||
.map_err(|error| anyhow::anyhow!("pty {pid}: no copy of the master: {error}"))?;
|
||||
@@ -141,7 +141,7 @@ pub fn spawn(
|
||||
term,
|
||||
pid,
|
||||
notifier,
|
||||
#[cfg(all(test, unix))]
|
||||
#[cfg(unix)]
|
||||
master,
|
||||
},
|
||||
events,
|
||||
@@ -184,6 +184,15 @@ impl Pty {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
impl Pty {
|
||||
/// The process group the program runs in the foreground.
|
||||
pub fn foreground(&self) -> std::io::Result<i32> {
|
||||
let group = rustix_openpty::rustix::termios::tcgetpgrp(&self.master)?;
|
||||
Ok(group.as_raw_nonzero().get())
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(all(test, unix))]
|
||||
impl Pty {
|
||||
/// Whether the program reads raw keys, canonical mode off.
|
||||
@@ -305,6 +314,27 @@ mod tests {
|
||||
assert_eq!(ran.text, "x");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_foreground_is_the_program_s_own_group() {
|
||||
let launch = Launch {
|
||||
program: Some(("/bin/sh".into(), vec!["-c".into(), "exec sleep 30".into()])),
|
||||
cwd: std::env::temp_dir(),
|
||||
env: Vec::new(),
|
||||
reports: false,
|
||||
};
|
||||
let (pty, _events) =
|
||||
spawn(&launch, (20, 4), (8, 16), config(&Settings::default())).expect("sh starts");
|
||||
let deadline = std::time::Instant::now() + std::time::Duration::from_secs(5);
|
||||
while pty.foreground().ok() != Some(pty.pid as i32) {
|
||||
assert!(
|
||||
std::time::Instant::now() < deadline,
|
||||
"{:?}",
|
||||
pty.foreground()
|
||||
);
|
||||
std::thread::sleep(std::time::Duration::from_millis(10));
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_size_past_the_kernel_is_one_size_for_grid_and_program() {
|
||||
let ran = run("stty size", (9000, 8));
|
||||
|
||||
+1
-2
@@ -45,8 +45,7 @@ impl Pty {
|
||||
self.child.id()
|
||||
}
|
||||
|
||||
/// A copy of the master; tests read its modes.
|
||||
#[cfg(test)]
|
||||
/// A copy of the master, which reads the foreground and, in tests, the modes.
|
||||
pub fn master(&self) -> io::Result<File> {
|
||||
self.file.try_clone()
|
||||
}
|
||||
|
||||
+8
-4
@@ -73,6 +73,8 @@ pub struct TerminalView {
|
||||
shown: bool,
|
||||
_events: Task<()>,
|
||||
_blink: Task<()>,
|
||||
#[cfg(unix)]
|
||||
_herdr: Task<()>,
|
||||
_focus: [Subscription; 3],
|
||||
_settings: Subscription,
|
||||
_zoom: Subscription,
|
||||
@@ -117,6 +119,8 @@ impl TerminalView {
|
||||
shown: true,
|
||||
_events: Self::pump(events, cx),
|
||||
_blink: Self::blink(cx),
|
||||
#[cfg(unix)]
|
||||
_herdr: super::herdr::follow(cx),
|
||||
_settings: cx.observe_global::<SettingsStore>(|view, cx| {
|
||||
view.pty
|
||||
.term
|
||||
@@ -243,9 +247,9 @@ impl TerminalView {
|
||||
self.pty.pid
|
||||
),
|
||||
Event::ColorRequest(index, reply) => {
|
||||
let theme = themes::active(SettingsStore::get(cx), cx.window_appearance());
|
||||
let theme = themes::active(SettingsStore::get(cx), cx.window_appearance(), cx);
|
||||
let term = self.pty.term.lock();
|
||||
let rgb = Ink::new(theme, term.colors()).query(index, term.colors());
|
||||
let rgb = Ink::new(&theme, term.colors()).query(index, term.colors());
|
||||
drop(term);
|
||||
self.pty.write(reply(rgb).into_bytes());
|
||||
}
|
||||
@@ -322,9 +326,9 @@ fn look(settings: &Settings, points: f32, ink: &Ink, window: &Window) -> anyhow:
|
||||
impl Render for TerminalView {
|
||||
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||
let settings = SettingsStore::get(cx).clone();
|
||||
let theme = themes::active(&settings, window.appearance());
|
||||
let theme = themes::active(&settings, window.appearance(), cx);
|
||||
let term = self.pty.term.lock();
|
||||
let ink = Ink::new(theme, term.colors());
|
||||
let ink = Ink::new(&theme, term.colors());
|
||||
let lit = self.finder.as_ref().map_or_else(Vec::new, |finder| {
|
||||
finder.lit(&term, cx.theme().colors.warning)
|
||||
});
|
||||
|
||||
@@ -76,14 +76,14 @@ pub fn palette(theme: &TerminalTheme, opacity: f32) -> Palette {
|
||||
/// Dresses the app in the theme the settings choose for the system's appearance.
|
||||
pub fn apply(cx: &mut App) {
|
||||
let settings = SettingsStore::get(cx);
|
||||
let theme = active(settings, cx.window_appearance());
|
||||
let theme = active(settings, cx.window_appearance(), cx);
|
||||
let opacity = settings.background_opacity;
|
||||
let mode = if theme.is_dark() {
|
||||
Mode::Dark
|
||||
} else {
|
||||
Mode::Light
|
||||
};
|
||||
Theme::set_palette(mode, Some(palette(theme, opacity)), cx);
|
||||
Theme::set_palette(mode, Some(palette(&theme, opacity)), cx);
|
||||
Theme::set_mode_now(mode, cx);
|
||||
log::info!("theme: {} in {mode:?}, glass at {opacity}", theme.id);
|
||||
}
|
||||
+39
-5
@@ -1,10 +1,12 @@
|
||||
mod chrome;
|
||||
#[cfg(target_os = "linux")]
|
||||
pub mod omarchy;
|
||||
|
||||
use std::sync::LazyLock;
|
||||
|
||||
use anyhow::Context as _;
|
||||
use ely_gpui_component::theme::Palette;
|
||||
use gpui::{Hsla, Rgba, WindowAppearance};
|
||||
use gpui::{App, Global, Hsla, Rgba, WindowAppearance};
|
||||
|
||||
pub use chrome::{apply, palette};
|
||||
|
||||
@@ -32,6 +34,14 @@ impl TerminalTheme {
|
||||
}
|
||||
}
|
||||
|
||||
/// The settings' name for Omarchy's theme, on Linux.
|
||||
pub const OMARCHY: &str = "omarchy";
|
||||
|
||||
/// Omarchy's current theme, while ELYTerminal follows it.
|
||||
pub struct Omarchy(pub TerminalTheme);
|
||||
|
||||
impl Global for Omarchy {}
|
||||
|
||||
/// Upstream Ghostty files from iTerm2-Color-Schemes: id, shown name, text.
|
||||
const FILES: [(&str, &str, &str); 12] = [
|
||||
(
|
||||
@@ -112,17 +122,41 @@ pub fn find(id: &str) -> Option<&'static TerminalTheme> {
|
||||
all().iter().find(|theme| theme.id == id)
|
||||
}
|
||||
|
||||
/// A theme the settings may name: built in, or Omarchy's on Linux.
|
||||
pub fn known(id: &str) -> bool {
|
||||
find(id).is_some() || (cfg!(target_os = "linux") && id == OMARCHY)
|
||||
}
|
||||
|
||||
/// A fresh install wears Omarchy's theme unless its file is surely absent.
|
||||
pub fn default_id() -> &'static str {
|
||||
#[cfg(target_os = "linux")]
|
||||
if omarchy::path().is_some_and(|path| !matches!(path.try_exists(), Ok(false))) {
|
||||
return OMARCHY;
|
||||
}
|
||||
"catppuccin-mocha"
|
||||
}
|
||||
|
||||
/// The theme the settings choose under the system's appearance.
|
||||
pub fn active(settings: &Settings, appearance: WindowAppearance) -> &'static TerminalTheme {
|
||||
pub fn chosen(settings: &Settings, appearance: WindowAppearance) -> &str {
|
||||
let dark = matches!(
|
||||
appearance,
|
||||
WindowAppearance::Dark | WindowAppearance::VibrantDark
|
||||
);
|
||||
let id = match (&settings.dark_theme, dark) {
|
||||
match (&settings.dark_theme, dark) {
|
||||
(Some(id), true) => id,
|
||||
_ => &settings.theme,
|
||||
};
|
||||
find(id).unwrap_or_else(|| panic!("settings name theme {id}, which validation admits"))
|
||||
}
|
||||
}
|
||||
|
||||
/// The chosen theme's colors; Omarchy's come from its global.
|
||||
pub fn active(settings: &Settings, appearance: WindowAppearance, cx: &App) -> TerminalTheme {
|
||||
let id = chosen(settings, appearance);
|
||||
if id == OMARCHY {
|
||||
return cx.global::<Omarchy>().0.clone();
|
||||
}
|
||||
find(id)
|
||||
.unwrap_or_else(|| panic!("settings name theme {id}, which validation admits"))
|
||||
.clone()
|
||||
}
|
||||
|
||||
fn ely(id: &'static str, name: &'static str, palette: Palette) -> TerminalTheme {
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
use std::{
|
||||
fs,
|
||||
io::{self, ErrorKind},
|
||||
path::{Path, PathBuf},
|
||||
time::Duration,
|
||||
};
|
||||
|
||||
use anyhow::Context as _;
|
||||
use gpui::App;
|
||||
|
||||
use super::{OMARCHY, Omarchy, TerminalTheme, apply, parse};
|
||||
use crate::settings::SettingsStore;
|
||||
|
||||
/// How often Omarchy's theme file is read for a switch.
|
||||
const CHECK: Duration = Duration::from_millis(500);
|
||||
|
||||
/// A Ghostty theme file's keys; Omarchy's other lines pass by.
|
||||
const COLORS: [&str; 7] = [
|
||||
"palette",
|
||||
"background",
|
||||
"foreground",
|
||||
"cursor-color",
|
||||
"cursor-text",
|
||||
"selection-background",
|
||||
"selection-foreground",
|
||||
];
|
||||
|
||||
/// Omarchy 4's current theme for Ghostty, under $HOME whatever XDG_STATE_HOME says.
|
||||
pub fn path() -> Option<PathBuf> {
|
||||
dirs::home_dir().map(|home| home.join(".local/state/omarchy/current/theme/ghostty.conf"))
|
||||
}
|
||||
|
||||
/// Follows Omarchy's theme; an unreadable file, or a bad one worn, stops the start.
|
||||
pub fn start(cx: &mut App) -> anyhow::Result<()> {
|
||||
let settings = SettingsStore::get(cx);
|
||||
let worn = settings.theme == OMARCHY || settings.dark_theme.as_deref() == Some(OMARCHY);
|
||||
let path = path().context("omarchy: no home folder")?;
|
||||
match read(&path) {
|
||||
Ok((text, theme)) => {
|
||||
log::info!("omarchy: the theme follows {}", path.display());
|
||||
cx.set_global(Omarchy(theme));
|
||||
watch(path, text, cx);
|
||||
Ok(())
|
||||
}
|
||||
Err(error) if worn => Err(error.context("settings wear the Omarchy theme")),
|
||||
Err(error) if missing(&error) => {
|
||||
log::info!("omarchy: none at {}", path.display());
|
||||
Ok(())
|
||||
}
|
||||
Err(error) if error.is::<io::Error>() => Err(error),
|
||||
Err(error) => {
|
||||
log::error!("{error:#}; no Omarchy theme to follow");
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Omarchy signals only Alacritty, kitty and Ghostty, so this reads the file.
|
||||
fn watch(path: PathBuf, mut shown: String, cx: &mut App) {
|
||||
cx.spawn(async move |cx| {
|
||||
let mut failed = String::new();
|
||||
loop {
|
||||
cx.background_executor().timer(CHECK).await;
|
||||
match check(&path, &shown) {
|
||||
Ok(None) => failed.clear(),
|
||||
Ok(Some((text, theme))) => {
|
||||
shown = text;
|
||||
failed.clear();
|
||||
cx.update(|cx| {
|
||||
log::info!("omarchy: the theme changed");
|
||||
cx.set_global(Omarchy(theme));
|
||||
apply(cx);
|
||||
});
|
||||
}
|
||||
Err(error) => {
|
||||
let error = format!("{error:#}");
|
||||
if error != failed {
|
||||
log::error!("{error}; the last Omarchy theme stays");
|
||||
failed = error;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
.detach();
|
||||
}
|
||||
|
||||
/// The file's theme when its text is not `shown`'s; none while unchanged.
|
||||
pub(super) fn check(path: &Path, shown: &str) -> anyhow::Result<Option<(String, TerminalTheme)>> {
|
||||
match read(path) {
|
||||
Ok((text, _)) if text == shown => Ok(None),
|
||||
// Gone mid-switch: the next check finds the new folder.
|
||||
Err(error) if missing(&error) => Ok(None),
|
||||
next => next.map(Some),
|
||||
}
|
||||
}
|
||||
|
||||
fn read(path: &Path) -> anyhow::Result<(String, TerminalTheme)> {
|
||||
let text =
|
||||
fs::read_to_string(path).with_context(|| format!("omarchy: reading {}", path.display()))?;
|
||||
let theme = colors(&text).with_context(|| format!("omarchy: {}", path.display()))?;
|
||||
Ok((text, theme))
|
||||
}
|
||||
|
||||
fn missing(error: &anyhow::Error) -> bool {
|
||||
error
|
||||
.downcast_ref::<io::Error>()
|
||||
.is_some_and(|error| error.kind() == ErrorKind::NotFound)
|
||||
}
|
||||
|
||||
/// Omarchy writes no cursor-text; the background stands in, as Ghostty's default.
|
||||
pub(super) fn colors(text: &str) -> anyhow::Result<TerminalTheme> {
|
||||
let key = |line: &str| {
|
||||
line.split_once('=')
|
||||
.map_or("", |(key, _)| key.trim())
|
||||
.to_owned()
|
||||
};
|
||||
let mut lines: Vec<&str> = text
|
||||
.lines()
|
||||
.filter(|line| COLORS.contains(&key(line).as_str()))
|
||||
.collect();
|
||||
let background = lines
|
||||
.iter()
|
||||
.find(|line| key(line) == "background")
|
||||
.and_then(|line| line.split_once('='))
|
||||
.map(|(_, value)| format!("cursor-text = {}", value.trim()));
|
||||
if !lines.iter().any(|line| key(line) == "cursor-text") {
|
||||
lines.extend(background.as_deref());
|
||||
}
|
||||
parse(OMARCHY, "Omarchy", &lines.join("\n"))
|
||||
}
|
||||
+87
-6
@@ -86,6 +86,90 @@ fn a_missing_key_or_bad_color_names_it() {
|
||||
assert!(parse("x", "X", "palette = 16=#000000").is_err());
|
||||
}
|
||||
|
||||
/// Omarchy 4 renders Tokyo Night so; glass mode appends the last four lines.
|
||||
#[cfg(target_os = "linux")]
|
||||
fn tokyo_night() -> String {
|
||||
[
|
||||
"background = #1a1b26",
|
||||
"foreground = #a9b1d6",
|
||||
"cursor-color = #c0caf5",
|
||||
"selection-background = #292e42",
|
||||
"selection-foreground = #c0caf5",
|
||||
"",
|
||||
"palette = 0=#1a1b26",
|
||||
"palette = 1=#f7768e",
|
||||
"palette = 2=#9ece6a",
|
||||
"palette = 3=#e0af68",
|
||||
"palette = 4=#7aa2f7",
|
||||
"palette = 5=#ad8ee6",
|
||||
"palette = 6=#449dab",
|
||||
"palette = 7=#a9b1d6",
|
||||
"palette = 8=#414868",
|
||||
"palette = 9=#ff7a93",
|
||||
"palette = 10=#b9f27c",
|
||||
"palette = 11=#ff9e64",
|
||||
"palette = 12=#7da6ff",
|
||||
"palette = 13=#bb9af7",
|
||||
"palette = 14=#0db9d7",
|
||||
"palette = 15=#c0caf5",
|
||||
"# omarchy-glass begin",
|
||||
"background-opacity = 0.65",
|
||||
"gtk-custom-css = /usr/share/omarchy/default/gtk/glass.css",
|
||||
"# omarchy-glass end",
|
||||
]
|
||||
.join("\n")
|
||||
}
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
#[test]
|
||||
fn omarchys_ghostty_conf_reads_without_its_glass() {
|
||||
let rendered = tokyo_night();
|
||||
let theme = omarchy::colors(&rendered).expect("Omarchy's file reads");
|
||||
assert_eq!(theme.id, OMARCHY);
|
||||
assert_eq!(theme.background, rgb(0x1a1b26));
|
||||
assert_eq!(theme.cursor, rgb(0xc0caf5));
|
||||
assert_eq!(theme.cursor_text, theme.background, "Ghostty's default");
|
||||
assert_eq!(theme.ansi[8], rgb(0x414868));
|
||||
let cut = rendered.replace("palette = 7=#a9b1d6\n", "");
|
||||
assert_eq!(
|
||||
omarchy::colors(&cut).expect_err("no 7").to_string(),
|
||||
"no palette 7"
|
||||
);
|
||||
}
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
#[test]
|
||||
fn omarchys_file_is_worn_again_once_it_reads() {
|
||||
use std::{fs, os::unix::fs::PermissionsExt};
|
||||
let folder = std::env::temp_dir().join(format!("elyterminal-omarchy-{}", std::process::id()));
|
||||
if folder.exists() {
|
||||
fs::remove_dir_all(&folder).expect("a stale test folder goes");
|
||||
}
|
||||
fs::create_dir_all(&folder).expect("a test folder");
|
||||
let path = folder.join("ghostty.conf");
|
||||
let text = tokyo_night();
|
||||
fs::write(&path, &text).expect("a theme");
|
||||
assert!(omarchy::check(&path, &text).expect("reads").is_none());
|
||||
fs::set_permissions(&path, fs::Permissions::from_mode(0o000)).expect("000");
|
||||
// Root reads any mode.
|
||||
if unsafe { libc::geteuid() } != 0 {
|
||||
let error = omarchy::check(&path, "").expect_err("unreadable");
|
||||
assert!(
|
||||
format!("{error:#}").contains("Permission denied"),
|
||||
"{error:#}"
|
||||
);
|
||||
}
|
||||
fs::set_permissions(&path, fs::Permissions::from_mode(0o644)).expect("644");
|
||||
let (shown, theme) = omarchy::check(&path, "").expect("reads").expect("a theme");
|
||||
assert_eq!((shown, theme.background), (text, rgb(0x1a1b26)));
|
||||
fs::remove_dir_all(&folder).expect("the test folder goes");
|
||||
assert!(
|
||||
omarchy::check(&path, "")
|
||||
.expect("gone mid-switch")
|
||||
.is_none()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_dark_theme_wins_only_in_dark_mode() {
|
||||
let settings = Settings {
|
||||
@@ -94,21 +178,18 @@ fn the_dark_theme_wins_only_in_dark_mode() {
|
||||
..Settings::default()
|
||||
};
|
||||
assert_eq!(
|
||||
active(&settings, WindowAppearance::Light).id,
|
||||
chosen(&settings, WindowAppearance::Light),
|
||||
"catppuccin-latte"
|
||||
);
|
||||
assert_eq!(
|
||||
active(&settings, WindowAppearance::VibrantDark).id,
|
||||
chosen(&settings, WindowAppearance::VibrantDark),
|
||||
"catppuccin-mocha"
|
||||
);
|
||||
let single = Settings {
|
||||
dark_theme: None,
|
||||
..settings
|
||||
};
|
||||
assert_eq!(
|
||||
active(&single, WindowAppearance::Dark).id,
|
||||
"catppuccin-latte"
|
||||
);
|
||||
assert_eq!(chosen(&single, WindowAppearance::Dark), "catppuccin-latte");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
+22
-13
@@ -2,14 +2,14 @@
|
||||
|
||||
`PRD.md` line by line, as of T23. Status: **Pass** when a test, a run or a review shows it; **Partial** when part of it was shown; **Open** when nothing has shown it yet. Reviews are in `tasks/reviews.md`; tests are named by module (`cargo test -- MODULE`).
|
||||
|
||||
What no check reached: no one has looked at the window on Windows, which CI builds and tests; no real KWin or Wayland desktop drew the blur. On 2026-10-15 macOS gave `shot` the window's ground alone, for old and new builds alike, while the terminal it ran under lacked Screen Recording (`CGPreflightScreenCaptureAccess` false); that day's macOS checks read the app's log.
|
||||
What no check reached: no one has looked at the window on Windows, which CI builds and tests; no real KWin drew the blur; of Wayland desktops, only Hyprland, on the owner's Omarchy, has drawn it. On 2026-10-15 macOS gave `shot` the window's ground alone, for old and new builds alike, while the terminal it ran under lacked Screen Recording (`CGPreflightScreenCaptureAccess` false); that day's macOS checks read the app's log.
|
||||
|
||||
## 1. Product
|
||||
|
||||
| PRD line | Task | Evidence | Status |
|
||||
|---|---|---|---|
|
||||
| One window: sessions left, terminal middle, Git or Files right | T11 | T11 review; a real X11 window shows the terminal and the right column | Pass |
|
||||
| Every setting has a control in the settings window | T16–T18 | 17 of the 20 fields have a row; `show_sessions`, `show_panel` and `panel` are the main window's toggles and switch, which §6 keeps in the file | Pass |
|
||||
| Every setting has a control in the settings window | T16–T18, T30 | 17 of the 22 fields have a row; `show_sessions`, `show_panel` and `panel` are the main window's toggles and switch, and `window_width` and `window_height` its size, which §6 keeps in the file | Pass |
|
||||
| Silent: no sound, bell, notification, update check, telemetry, tip or onboarding | T10, T12 | a bell is logged and marks a hidden row; the code holds no network call or notification | Pass |
|
||||
| Clean: no subtitle, tagline, logging option, status bar or badge without state | T11–T18 | reviews of the layout and settings tasks | Pass |
|
||||
| Built-in themes, each with a preview, Catppuccin among them; a theme colors terminal and chrome | T03, T17 | `themes::tests`; T17 review | Pass |
|
||||
@@ -24,7 +24,7 @@ What no check reached: no one has looked at the window on Windows, which CI buil
|
||||
| `alacritty_terminal` 0.26 | T04 | `=0.26.0` | Pass |
|
||||
| Logs through `log` to stderr, `RUST_LOG` sets the level, no log setting | T01 | `src/main.rs`; no such field in `Settings` | Pass |
|
||||
| CI on Gitea Actions: macOS builds, tests and lints; Ubuntu and Windows build and test | T01, T23 | `.github/workflows/ci.yml`; run 926 on `65bb4d3`, see the CI notes | Pass |
|
||||
| Private repo; no credential in any file or commit | T01 | T22's review scanned the tree and its 398 reachable objects: 0 hits; T23's scans for the Gitea token and the runners' SSH details: 0 hits | Pass |
|
||||
| The repo, private until v0.1.1 and public since; no credential in any file or commit | T01, T26 | T22's review scanned the tree and its 398 reachable objects: 0 hits; T23's scans for the Gitea token and the runners' SSH details: 0 hits; before the owner made it public, a scan of all 91 commits' contents and messages found no token, SSH password, gateway, port, SSH user or private key | Pass |
|
||||
|
||||
## 3. Settings model and storage
|
||||
|
||||
@@ -43,6 +43,7 @@ What no check reached: no one has looked at the window on Windows, which CI buil
|
||||
| Background, foreground, cursor, cursor text, selection, 16 ANSI from upstream | T03 | `themes::tests` | Pass |
|
||||
| A theme maps onto Ely's `Palette` through `Theme::set_palette` | T03, T19 | `the_chrome_wears_the_theme` | Pass |
|
||||
| One theme, or a second for dark mode | T17 | T17 review | Pass |
|
||||
| On Omarchy 4, an Omarchy theme wears the current theme and follows each switch; the default there; another pick stops following | T27 | `omarchys_ghostty_conf_reads_without_its_glass`, `omarchys_file_is_worn_again_once_it_reads`; on X11, as a user, with Omarchy v4.0.4's own renderer staging and swapping the folder as `omarchy-theme-set` does: with no theme saved the window wore Omarchy's, and through all 22 of its themes the terminal's ground matched each background within 1.5 s; Omarchy's glass lines changed nothing; a file without palette 7 was logged and the last theme stayed; a file swapped in unreadable was worn once made readable, its stamp unchanged; a folder unreadable for 2 s kept the theme; each failure was logged once while it lasted; a picked Catppuccin Mocha stayed through a switch, and with it worn a bad Omarchy file was logged and the start went on; with Omarchy's folder unreadable the start stopped, a theme saved or not, and with settings wearing it and no Omarchy too, each naming the file and the error; the first release build, on the owner's Omarchy 4.0.4 under Hyprland 0.56.2, wore the live theme, sepia-night, which is none of Omarchy's 22, and the release build from `aae7fba`, under Xvfb on Debian 13 with that theme's folder, painted its background | Pass |
|
||||
|
||||
## 5. Terminal engine
|
||||
|
||||
@@ -50,6 +51,7 @@ What no check reached: no one has looked at the window on Windows, which CI buil
|
||||
|---|---|---|---|
|
||||
| PTY through alacritty's event loop; OSC 7 scanned on the reader | T04 | `term::pty`, `term::tap` tests; round 3 failed at the cap, its fix stands on a red-green test | Pass |
|
||||
| Shell integration for zsh, bash, fish, PowerShell; a shell without it reports nothing and the panels say so | T05 | `term::shell` tests on macOS and Linux | Pass |
|
||||
| Inside herdr, the folder of herdr's focused pane, read from its socket, on macOS and Linux | T29 | `term::herdr` tests: the socket found as herdr 0.9 finds it, only the terminal client followed and a remote one refused, the snapshot read, a socket round trip, a process's path, arguments and variables; `the_foreground_is_the_program_s_own_group`; on X11 with herdr 0.9.5 run in the session: its start showed the focused pane's folder, a cd in the pane moved the panel, the focus moved to a pane in `/etc` and back moved it each time, and the client's end gave the panel back to bash's report, then `exec herdr` from that bash, with `HERDR_SOCKET_PATH` relative to its folder, was followed through the socket there; on macOS under `shot`, herdr 0.9.5 as the program and again by `exec` from `sh` with a relative socket, its pane's cd moved the panel | Pass |
|
||||
| Colors, styles, five underlines, wide characters, combining marks | T06 | `term::frame`, `term::ink`, `term::paint` tests | Pass |
|
||||
| Box drawing, blocks and powerline shapes as geometry | T07 | `term::boxes` tests | Pass |
|
||||
| JetBrains Mono, any installed font, Nerd Font icons | T06, T17 | `tests/fonts.rs` | Pass |
|
||||
@@ -68,10 +70,11 @@ What no check reached: no one has looked at the window on Windows, which CI buil
|
||||
|---|---|---|---|
|
||||
| `ColumnShell` with three columns; blur when the setting is on | T11, T19 | `shot` names a `BlurredView` under the window | Pass |
|
||||
| Columns toggle and keep their state | T11, T23 | a click on each title bar button hid its column and saved it, and a restart opened the window with both hidden (147 columns against 87); Cmd-B with the app active; Ctrl-Shift-B on a real X11 window | Pass |
|
||||
| The window opens at the size it was left at; maximized or full screen, the size before stays; a kept size past the screen shrinks to it | T30 | `a_value_out_of_range_names_its_field`; on X11 under xfwm4: the first start opened at 1200 by 760 and wrote nothing; a resize to 900 by 600 was kept with one write; maximized by xfwm4's Alt+F10 the window spanned the 1400 by 900 screen while the file kept 900 by 600, and restored it was 900 by 600 again; maximized, minimized and restored, the file kept 900 by 600; resized to 950 by 650 and minimized at once, the file kept 900 by 600 while minimized and 950 by 650 once restored; the next start opened at 950 by 650 and wrote nothing; `WM_NORMAL_HINTS` names a 100 by 100 minimum, and a resize to 900 by 50 held at 900 by 100, kept so; a kept 3000 by 2000 opened at 1400 by 900, logged; on macOS, through gpui's own window: a kept 900 by 600 opened at 900 by 600, where a centered edge on a half point had grown it to 601, and a move wrote nothing; a resize to 923 by 617, covered by an opaque window within 150 ms and uncovered, was kept once shown, and the next start opened at 923 by 617; zoomed, minimized, restored, full screen and back, the file kept 923 by 617; a 100 by 100 window was kept; a kept 5000 by 4000 opened at the visible 1920 by 1113, logged; a drag on macOS and any run on Windows not yet shown | Partial |
|
||||
| The title shows the session's title, nothing else | T11 | log: "the title is", per session shown | Pass |
|
||||
| The pointer over the terminal is the arrow | T26 | the terminal sets no pointer, so gpui's arrow shows; on X11 with the pointer over the grid, gpui asked for no I-beam ("text"), which it had asked for, and failed to load under Xvfb, before | Pass |
|
||||
| The title bar is transparent | T11, T19 | T19 review | Pass |
|
||||
| Every title bar control takes its press, Ely's window buttons on Windows and Linux too | T26 | Ely `cdc5ce8`: `window_controls_occlude_what_lies_under` (each style; before, the box under Windows' caption buttons took the press), `a_wobbling_press_on_a_slot_moves_no_window` (before, the window moved), `a_wobbling_press_on_a_column_title_moves_the_window`; on the owner's PC, window messages asked the app for Windows' hit test along the title bar: v0.1.0 answered caption from end to end, T26's build answers client over the toggles and +, caption over the titles, min, max and close over Ely's buttons, and a press on close closed the app; the owner has not yet clicked it | Partial |
|
||||
| Every title bar control takes its press, Ely's window buttons on Windows and Linux too | T26 | Ely `cdc5ce8`: `window_controls_occlude_what_lies_under` (each style; before, the box under Windows' caption buttons took the press), `a_wobbling_press_on_a_slot_moves_no_window` (before, the window moved), `a_wobbling_press_on_a_column_title_moves_the_window`; on the owner's PC, window messages asked the app for Windows' hit test along the title bar: v0.1.0 answered caption from end to end, T26's build answers client over the toggles and +, caption over the titles, min, max and close over Ely's buttons, and a press on close closed the app; the owner, given v0.1.1's build and these controls to click, reported it works on Windows | Pass |
|
||||
|
||||
## 7. Sessions panel
|
||||
|
||||
@@ -107,9 +110,10 @@ What no check reached: no one has looked at the window on Windows, which CI buil
|
||||
| PRD line | Task | Evidence | Status |
|
||||
|---|---|---|---|
|
||||
| Cmd-, opens it; categories left, rows right, each scrolling on its own; changes apply at once and save | T16, T26 | T16 review; on X11, eight wheel notches over the Terminal page carried it down to its Edit and View shortcuts while the category column and both headers stayed | Pass |
|
||||
| On Windows and Linux, a gear in the title bar opens it too | T26 | on X11 under Xvfb with xfwm4, xdotool's click on the gear, just inside the right toggle, opened the 900×640 Settings window ("settings: the window opens"), after a click on + opened a session; sent through `App::dispatch_action`, the same click had opened nothing; the owner has not yet clicked it on Windows | Partial |
|
||||
| On Windows and Linux, a gear in the title bar opens it too | T26 | on X11 under Xvfb with xfwm4, xdotool's click on the gear, just inside the right toggle, opened the 900×640 Settings window ("settings: the window opens"), after a click on + opened a session; sent through `App::dispatch_action`, the same click had opened nothing; the owner, given v0.1.1's build and the gear to click, reported it works on Windows | Pass |
|
||||
| Terminal: Shell, Start in | T16, T26 | `settings::tests`; the General page is gone, and a capture on X11 shows its two rows leading Terminal | Pass |
|
||||
| Appearance: theme grids, dark theme, font, size, line height, ligatures, cursor and preview, opacity, blur, padding | T17 | T17 review | Pass |
|
||||
| On Omarchy, the Omarchy theme first in the grid | T27 | on X11 with Omarchy's theme folder, the Omarchy card leads the grid, chosen, over a preview in its colors | Pass |
|
||||
| Terminal: scrollback, Option as Alt (macOS), copy on select | T18 | T18 review | Pass |
|
||||
| Terminal: every shortcut, with a search | T26 | read from the keymap, the bindings that apply in the main window's terminal; on X11 the list showed this platform's keys (Ctrl+Shift+T, Alt+1 and on), and typing "paste" left Edit's Paste, Ctrl+Shift+V | Pass |
|
||||
|
||||
@@ -118,8 +122,8 @@ What no check reached: no one has looked at the window on Windows, which CI buil
|
||||
| PRD line | Task | Evidence | Status |
|
||||
|---|---|---|---|
|
||||
| macOS: `Blurred` (NSVisualEffectView) | T19, T23 | `shot` reads `BlurredView, blur 30` off the view's backdrop layer; the owner saw the desktop blur | Pass |
|
||||
| Windows: `Blurred` (acrylic) | T19 | the same gpui call; CI builds and tests on Windows, but no one has seen the window | Partial |
|
||||
| Wayland: `ext_background_effect_v1` beside gpui's `org_kde_kwin_blur` | T20 | `blur::wayland` tests on a `wayland-server` compositor; no real compositor | Partial |
|
||||
| Windows: `Blurred` (acrylic) | T19 | the same gpui call; on 2026-10-15 the owner saw the window blur on Windows | Pass |
|
||||
| Wayland: `ext_background_effect_v1` beside gpui's `org_kde_kwin_blur` | T20, T28 | `blur::wayland` tests on a `wayland-server` compositor; on the owner's Omarchy 4.0.4, Hyprland 0.56.2 took `ext_background_effect_v1` from a T27 release build: the log named it and the pane's region, and the wallpaper behind the window blurred while Hyprland's blur was on and showed sharp while it was off; Plasma and GNOME not run | Partial |
|
||||
| X11: `_KDE_NET_WM_BLUR_BEHIND_REGION`, removed when blur turns off | T21 | `blur::x11` test on Xvfb; the property on a real xfwm4 window; KWin not run | Partial |
|
||||
| Neither protocol: transparency without blur; the log names the path | T20, T21 | the log lines in `src/blur` | Pass |
|
||||
|
||||
@@ -129,7 +133,7 @@ What no check reached: no one has looked at the window on Windows, which CI buil
|
||||
|---|---|---|---|
|
||||
| The macOS menu bar | T22 | `shot` lists every item with its key | Pass |
|
||||
| The same shortcuts off macOS, Ctrl-Shift where they collide | T22 | xdotool on a real X11 window: select all, size, toggle, find, quit | Pass |
|
||||
| On Windows Ctrl-V pastes too, as in Windows Terminal | T26 | the binding is Windows' alone; on a real X11 window, with a command on the clipboard through xclip, Ctrl-Shift-V pasted its 33 characters and the shell ran it, and Ctrl-V pasted nothing, as Linux keeps it for programs; the owner has not yet pressed Ctrl-V on Windows | Partial |
|
||||
| On Windows Ctrl-V pastes too, as in Windows Terminal | T26 | the binding is Windows' alone; on a real X11 window, with a command on the clipboard through xclip, Ctrl-Shift-V pasted its 33 characters and the shell ran it, and Ctrl-V pasted nothing, as Linux keeps it for programs; the owner, given v0.1.1's build and Ctrl-V to press, reported it works on Windows | Pass |
|
||||
|
||||
## 13. Acceptance
|
||||
|
||||
@@ -137,7 +141,7 @@ What no check reached: no one has looked at the window on Windows, which CI buil
|
||||
|---|---|---|
|
||||
| Each task ticked with a passing review | each task is ticked only after its review, as `tasks/reviews.md` records; T04 and T10 reached the three-round cap without a passing round, their last fixes standing on red-green tests | Partial |
|
||||
| `scripts/check.sh` passes | macOS: 135 tests, clippy, fmt, 500 lines; Linux through `scripts/linux.sh`: 138 tests, clippy, on aarch64 in Colima and on x86_64 in WSL's Docker | Pass |
|
||||
| CI green on macOS, Ubuntu and Windows | run 934 on `0075667`: all three jobs pass; see the CI notes below | Pass |
|
||||
| CI green on macOS, Ubuntu and Windows | run 955 on `43ea5b1`, v0.1.1's commit: all three jobs pass; see the CI notes below | Pass |
|
||||
|
||||
## 14. Icon and the macOS app
|
||||
|
||||
@@ -145,16 +149,16 @@ What no check reached: no one has looked at the window on Windows, which CI buil
|
||||
|---|---|---|---|
|
||||
| The icon: Ely, a girl with long pink hair, holding a terminal | T24 | `assets/icons`, drawn at 16 to 1024 px and legible at 32; the owner saw it | Pass |
|
||||
| macOS: the rounded square; Windows and Linux: the figure alone, flat | T24 | `elyterminal-macos.svg` on Apple's grid; `elyterminal.svg`, which the Linux tarball carries and the Windows `.ico` renders | Pass |
|
||||
| `scripts/mac-app.sh` builds the app, signed ad hoc, and its disk image | T24 | its run: `codesign --verify --strict` passes on the app and on its copy in the image; the `.icns` holds 16 to 1024 px; the image verifies and mounts with the app beside Applications; LaunchServices opens the app as `com.zacharyzhang.elyterminal` | Pass |
|
||||
| `scripts/mac-app.sh` builds the app, signed ad hoc, or for a release with Developer ID and notarized, and its disk image | T24, T26 | its run: `codesign --verify --strict` passes on the app and on its copy in the image; the `.icns` holds 16 to 1024 px; the image verifies and mounts with the app beside Applications; LaunchServices opens the app as `com.zacharyzhang.elyterminal`; for v0.1.1 the Release workflow (run 959) ran it on `macos-signing`: notarization Accepted, the ticket stapled, and on this Mac the downloaded image and its app pass `codesign --verify --strict` under the Developer ID and Gatekeeper's `accepted, source=Notarized Developer ID`; the owner opened it; without the key the script stops before building | Pass |
|
||||
|
||||
## 15. Release
|
||||
|
||||
| PRD line | Task | Evidence | Status |
|
||||
|---|---|---|---|
|
||||
| A Gitea release, `vVERSION`, with the macOS disk image, a Windows zip and a Linux tarball | T25 | `v0.1.0` at `0075667`, its three files built from that commit by their scripts and checked again: the disk image verifies and its app passes `codesign --verify --strict`; the zip's executable has the icon and no C runtime DLL; the tarball opens its window on Ubuntu 22.04; each file downloaded back matches the SHA-256 in the release notes | Pass |
|
||||
| A Gitea release, `vVERSION`, with the macOS disk image, a Windows zip and a Linux tarball | T25, T26, T27 | `v0.1.1` at `43ea5b1`: the zip from its script on the owner's PC, the disk image from the Release workflow, signed and notarized; the Linux tarball, rebuilt for T27 from `aae7fba` by its script on the owner's PC under Omarchy, took the first one's place, and the notes say so; each downloaded back anonymously, once the repository was public, matches the SHA-256 in the release notes. `v0.1.0` at `0075667`, its three files built from that commit by their scripts and checked again: the disk image verifies and its app passes `codesign --verify --strict`; the zip's executable has the icon and no C runtime DLL; the tarball opens its window on Ubuntu 22.04; each file downloaded back matches the SHA-256 in the release notes | Pass |
|
||||
| The Windows executable carries the icon | T25 | its resources: icon group 1 with the seven images of `elyterminal.ico`, 16 to 256 px, and gpui's manifest (PerMonitorV2); a GUI program, importing no C runtime DLL; not yet seen on a Windows screen | Pass |
|
||||
| The Linux tarball carries the icon and a desktop entry; the window names itself `com.zacharyzhang.elyterminal` | T25 | on Ubuntu 22.04: `desktop-file-validate` reports nothing, every library resolves, glibc 2.35; under Xvfb `WM_CLASS` reads `com.zacharyzhang.elyterminal` twice, and under headless sway the window's `app_id` reads the same | Pass |
|
||||
| Each build comes from its script | T25 | `scripts/mac-app.sh` on macOS, `scripts/windows-zip.ps1` on the owner's Windows PC, `scripts/linux-tar.sh` in the owner's WSL | Pass |
|
||||
| The Linux tarball carries the icon and a desktop entry; the window names itself `com.zacharyzhang.elyterminal` | T25, T27 | on Ubuntu 22.04: `desktop-file-validate` reports nothing, every library resolves, glibc 2.35; under Xvfb `WM_CLASS` reads `com.zacharyzhang.elyterminal` twice, and under headless sway the window's `app_id` reads the same; T27's rebuild passes the same checks on Ubuntu 22.04, whose llvmpipe (LLVM 15) leaves the window black in a capture, the first tarball's too, while Debian 13's paints it | Pass |
|
||||
| Each build comes from its script | T25, T27 | `scripts/mac-app.sh` on macOS, `scripts/windows-zip.ps1` on the owner's Windows PC, `scripts/linux-tar.sh` in the owner's WSL, and for T27 on the owner's PC under Omarchy | Pass |
|
||||
|
||||
## CI notes
|
||||
|
||||
@@ -179,3 +183,8 @@ On 2026-10-15 the owner ran the app on macOS and found three faults, now fixed:
|
||||
- The desktop showed through sharp: on macOS 27 gpui's `Selection` material builds no blur; the window's view now takes `underWindowBackground`, radius 30.
|
||||
- The debug build lagged; the release build does not.
|
||||
- No button hid the side columns; each now has one at its end of the title bar, its state saved.
|
||||
|
||||
On 2026-10-16 the owner ran it on Omarchy 4.0.4 under Hyprland:
|
||||
|
||||
- No window blurred: Omarchy turns Hyprland's own blur off, and Hyprland then blurs nothing; T28 says how to turn it on.
|
||||
- The v0.1.1 Linux tarball built from `aae7fba`, installed by hand, wore the Omarchy theme.
|
||||
@@ -125,3 +125,28 @@ Each task gets at most three codex rounds. Each round: the commit, the verdict,
|
||||
|
||||
- Round 1, 2b8ae5d and 0075667: FAIL. The v0.1.0 release was not yet on Gitea, so the task line's release stood open.
|
||||
- Round 2, 59e41ea: PASS. v0.1.0 at 0075667 carries the disk image, the Windows zip and the Linux tarball; the reviewer downloaded each and found its SHA-256, signature, icon, manifest and glibc as recorded. CI run 934 on 0075667 passed on macOS, Ubuntu and Windows.
|
||||
|
||||
## T26
|
||||
|
||||
- Round 1, 6f7d3a9 and 0f87676 with Ely cdc5ce8: FAIL. v0.1.1 was still a draft, so the task line's release stood open.
|
||||
- Round 2, c316d27, 90a4625, 7bfb462, 43ea5b1 and 194c7bb: PASS. The owner's later asks went in first: a gear for Settings on Windows and Linux, Ctrl-V paste on Windows, the arrow pointer, the settings window without General, with the shortcut list and with columns that scroll apart, and the release's disk image signed with Developer ID and notarized on the macos-signing runner. v0.1.1 at 43ea5b1 is published and the repository public; the reviewer downloaded each file anonymously, checked its hash, signature and notarization, and drove the app on X11 and macOS. CI run 955 on 43ea5b1 passed on macOS, Ubuntu and Windows.
|
||||
|
||||
## T27
|
||||
|
||||
- Round 1, 340c7a9 and d8ebade: FAIL. A failed read marked the file's stamp as seen, so a theme file made readable again was never worn; `is_file`, `exists` and `metadata().ok()` took a permission error for absence, so a fresh install wore Catppuccin Mocha over an unreadable Omarchy folder, and an outage while following logged nothing. Fixed in aae7fba: the watcher compares the file's text, logs a failure once while it lasts and tries again; only a missing file means no Omarchy, and a file that cannot be read stops the start. The v0.1.1 Linux tarball was rebuilt from aae7fba on the owner's PC, which now runs Omarchy, and took the place of the one from 340c7a9 (1faf8ca).
|
||||
- Round 2, aae7fba and 1faf8ca: PASS. The reviewer reproduced both faults on the parent build and saw them gone, ran all 22 of Omarchy's themes through the window, and matched the new tarball's download to its SHA-256. CI run 976 on aae7fba passed on macOS and Ubuntu; its Windows job waits for the PC to run Windows again.
|
||||
|
||||
## T28
|
||||
|
||||
- Round 1, 741e48b with the v0.1.1 release notes: PASS. The reviewer read the new lines against Hyprland 0.56.2's `shouldBlur` and background-effect protocol and Omarchy 4.0.4's default `looknfeel.lua`, and the owner's captures with Hyprland's blur on and off against the acceptance row, which stays Partial for Wayland.
|
||||
|
||||
## T29
|
||||
|
||||
- Round 1, 3e30f95: FAIL. A shell that ran `exec herdr` kept its process group, so the session never looked at its foreground again and the panel stayed where it was; a relative `HERDR_SOCKET_PATH` was looked up from ELYTerminal's own folder, not the client's, so no socket answered. Fixed in 2af45cb: the foreground is its group and the executable its leader runs, a program that did not read is tried again, and a relative socket lies in the client's folder (`/proc/PID/cwd`, `proc_pidinfo` on macOS); on Linux an executable an update replaced still names itself herdr.
|
||||
- Round 2, 2af45cb: PASS. The reviewer ran real herdr 0.9.5 under the native view: a direct start, a delayed exec, a relative socket, both at once, and a folder with a space and an é each gave the folder events herdr's own snapshot named. CI run 988 on 3e30f95 and run 990 on 2af45cb passed on macOS, Ubuntu and Windows.
|
||||
|
||||
## T30
|
||||
|
||||
- Round 1, 1bf420c: FAIL. On X11 a maximized window, minimized, wrote the screen's size, since gpui's X11 window calls a maximized window unmaximized while it is hidden; and the window could be dragged under the 100 by 100 the settings keep, so a smaller size was refused and lost. Fixed in 2f58a06: a hidden window keeps the size from before, and the window is no smaller than 100 by 100.
|
||||
- Round 2, 2f58a06: FAIL. A size the window took just before something covered it was skipped while it was hidden and never read again once it showed. Fixed in 9729d24: a window that shows again is read again; and the window opens centered at whole points, since macOS grew a window whose centered edge fell on a half point by a point, so a kept 900 by 600 had opened at 900 by 601.
|
||||
- Round 3, 9729d24: PASS. The reviewer replayed the cover on macOS through gpui and AppKit, against the parent too, and saw the size kept once shown and the restart open at it; the window opened at its kept size and a move wrote nothing; on X11 a maximized, minimized and restored window and a resize minimized at once kept the right size, and the 100 by 100 minimum held. CI runs 993 on 1bf420c and 995 on 2f58a06 passed on macOS, Ubuntu and Windows; run 996 on 9729d24 passed on Ubuntu and Windows.
|
||||
Reference in new issue
Block a user