16 KiB
Tunal
Tunal is our own desktop file manager for Linux (Wayland and X11), written in Rust with Slint and Material You styling: tabs, split view, places, file operations, .directory metadata, sudo elevation, thumbnails, a music tag editor, a quick audio player, iOS/Android device browsing and SFTP locations. Final deliverable: the tunal binary built from this Cargo workspace, with README.md and FEATURES.md, for the user (astar76) on Arch Linux. Vision: PLAN.md. Full brief: PROMPT.md (read only the section your plan names).
0. Session rules — read first
- You are started with one plan:
Plans/<NN Category>/SNNN-*.md. Read only: this file, your plan, the last 3 entries ofdocs/PROGRESS.md, and the files/sections your plan names. - Do not open other files in
Plans/(norORCHESTRATOR.md, nor all ofPLAN.md). - Tick each checkbox in your plan file the moment it is done, one by one, never in batches. Right after each tick, sync the tracker (§Tracker). An interrupted plan resumes at its first unchecked box.
- Stay in scope. Out-of-scope ideas go to
docs/PROGRESS.md(“Later”), not into the code. - Invent nothing: check the code/docs; if a fact is still missing, ask — the orchestrator if you were started by one (never the user directly), otherwise the user.
- End of session: (a) end criteria verified by commands, not memory; (b)
docs/PROGRESS.mdentry (≤ 15 lines: done, not done, later); (c)docs/DECISIONS.mdif a decision binds later plans; (d) tick your line inPlans/INDEX.md(no commentary); (e) commitSNNN: …; (f) short report: done, not done, what the user/orchestrator must do, and any instruction that cost more than it gave. - Cost (D-036): first action of every session: invoke the
caveman:cavemanskill and keep it on (short replies, short reports). Read only what your plan names; don't re-read files; one smoke run or screenshot per end criterion, no extra variants. - Languages: answer in English. Code, comments, README.md and FEATURES.md in English. Internal docs (
CLAUDE.md,Plans/,PROGRESS.md) in English.
Tracker
Live checklist of every plan: https://claude.ai/artifact/4X8YCk3cQjUGyuyCqGuU7v (collection plans, one doc per plan id).
After ticking a box: ArtifactData update with url = the tracker, collection: "plans", doc_id: "SNNN", data: {"status": "running" or "done" (all boxes ticked), "items": [{"text": "<step>", "done": true/false}, … every checkbox of the plan in order], "updated": "<ISO date-time>"} and if_version = the version returned by your previous write (first time: get the doc once to read it; a doc that doesn't exist yet takes no if_version). Load the tool with ToolSearch select:ArtifactData once. If the tracker call fails, keep working and say so in the report: the plan file is the source of truth.
1. Repository layout
Root: /home/astar76/Projects/Tunal (target layout; phase 1 creates the crates)
Cargo.toml workspace (members = crates/*)
crates/
tunal/ app binary: main, Slint UI (ui/*.slint), Theme + Motion globals, components
tunal-core/ filesystem model, file operations, the location layer (local first)
tunal-theme/ XDG Settings portal (zbus), material-colors scheme generation
tunal-dirmeta/ .directory read/write (desktop entry format)
tunal-elevate/ root operations behind a password prompt
tunal-thumbs/ thumbnails (images, video frame, embedded album art)
tunal-tags/ lofty tags, MusicBrainz + Cover Art Archive client
tunal-player/ audio playback, waveform data
tunal-devices/ iOS (AFC) and Android (MTP) locations
tunal-net/ SFTP locations, ~/.ssh/config hosts, known_hosts
assets/ tunal.svg / .png / .ico; fonts/ (Material Symbols Rounded + its license)
docs/ PROGRESS.md, DECISIONS.md, STATUS.md, HANDOFF.md
Plans/ INDEX.md, _TEMPLATE.md, <NN Category>/SNNN-*.md
README.md FEATURES.md PLAN.md PROMPT.md ORCHESTRATOR.md
Never modify: PROMPT.md (the user's brief), the user's other projects under ~/Projects (Damson, Mulberry, Nacre …) and the old prototype in ~/Documents/Apps/tunal-files/, the reference app checkout (/home/astar76/Projects/Tunal-reference, outside the repo), anything under /usr, ~/.ssh/ (read only).
2. Facts
- Reference app: the repository URL in PROMPT.md §Project, cloned (shallow) to
/home/astar76/Projects/Tunal-referencewhen a plan needs it. Use it to learn features and behaviour only. Never copy its code, strings, names, icons or branding (it is GPL). Never write its name, its desktop's name or any other file manager's name in code, identifiers, UI text, binaries, README, FEATURES.md or commit messages; say “the reference app” in internal docs. - Toolchain: rustc/cargo 1.99.1 on Arch Linux. License GPL-3.0-or-later (D-015). GUI: Slint 1.19. Own components on a
Themeglobal (colour/shape/type tokens) and aMotionglobal (durations, easings, reduced-motion flag); std-widgets only for scrollbars and text input, stylematerial. - Theme:
org.freedesktop.portal.Settings→org.freedesktop.appearanceaccent-color(rgb doubles) andcolor-scheme(0 none, 1 dark, 2 light) viazbusblocking API, plusSettingChangedfor live re-theme. Schemes frommaterial-colors0.5 (ThemeBuilder::with_source, tonal spot). Fixed fallback seed when no accent. - Icons: Material Symbols Rounded, from
/usr/share/fonts/TTF/MaterialSymbolsRounded[FILL,GRAD,opsz,wght].ttf(packagettf-material-symbols-variable, Apache-2.0; license in/usr/share/licenses/ttf-material-symbols-variable/). Copy font + license intoassets/fonts/; draw glyphs by codepoint (foldere2c7, homee88a). App icon:assets/tunal.svg/.png/.ico. - Crates already chosen:
slint1.19,zbus(blocking),material-colors0.5,lofty(tags),russh+russh-sftp(SFTP, preferred). Later option:rusty-chromaprint(AcoustID). - MusicBrainz / Cover Art Archive: no API key; ≤ 1 request/s across the whole app; User-Agent
Tunal/<version> ( https://astar76.com/git/astar76/Tunal ). - Native dependencies (decided, D-004–D-007, D-014, D-016, D-019): video frames via the
ffmpegCLI subprocess; audiocpal(alsa-lib) + symphonia; iOSideviceover systemusbmuxd; MTP own pure-Rust client onnusb; native DnD via Slint's libwayland connection andx11rb; TLS/SSH crypto rustls + ring. No new system packages: optional tools missing → that feature off, no error. Any other non-Rust dependency: ask first. - User validates personally (🧑), all in phase 12 (D-009): visual review (S035), the polkit password prompt, real iPhone/Android devices, native drag/clipboard with other apps, a real SFTP host (S036). Plans that need these stop at that step and report.
- Design references (read only, D-027, D-028): the user's own Material You apps —
~/Projects/Damson(src/theme.rs,src/motion.rs,src/ui/),~/Projects/Mulberry(src/theme.rs,src/ui/),~/Projects/Nacre(src/theme.rs,src/ui/widgets.rs,src/ui/chrome.rs). They use egui, not Slint: borrow look and feel (colour roles, state layers, shapes, spacing, motion curves and timings) and port the idea to our Slint tokens; never change our stack, never edit them. Their code is the user's own, so copying is allowed where it fits. Also the user's old, buggy Tunal prototype in/home/astar76/Documents/Apps/tunal-files/tunal/(Python): look at its elements for ideas only, never copy its code — the new UI is meant to be new. A library default that looks off is not a reason to accept it: build the control ourselves onTheme/Motion. - Motion rules (
app-tasteskill): tokens only, hover tint and press squeeze on every control, interruptible motion, honour reduced motion, no idle animation, repaint only while something moves. Build new motion with theanimateskill;/unslopand/improve-animationsrun in phase 12 (S034, S035; there is no/review-animations). - Remote:
origin=forgejo:astar76/Tunal.git(Astar Hub, private), since 2026-11-25.
3. Code rules
- Write like the neighbouring code. KISS, DRY, YAGNI; no abstraction without ≥ 2 uses.
- Phases 1–11: no new tests (D-013); verify with build, clippy, fmt and a smoke run or screenshot. Phase 12 writes the tests; from then on a bug fix gets a regression test when feasible.
- All Rust, pure-Rust crates preferred.
cargo fmtandcargo clippy --workspace --all-targets -- -D warningsclean before commit. - Back-end crates (
tunal-core,-theme,-dirmeta, …) have no Slint dependency; the app crate adapts them to the UI. - Views talk only to the location layer in
tunal-core(a trait for list/stat/read/write/copy/move/rename/delete/trash). Local, device and SFTP backends implement it; views never know which protocol they show. - Blocking work (D-Bus, disk, network, devices) runs off the UI thread; results return with
slint::invoke_from_event_loopor aWeakhandle. - UI values come from
Theme/Motiontokens only: no literal colours, durations or radii in components. - Secrets (sudo and SSH passwords, key passphrases): held in
zeroize/secrecytypes, never logged, never in argv or env, never written to disk, zeroed after use.
4. Domain pitfalls (all agents)
- Slint animates only property changes: animate state, not timers. A running
animateorTimerkeeps repainting; stop it when idle (no idle animation). - The portal may be missing (no
xdg-desktop-portal) or return no accent: fall back, never panic. .directoryfiles are desktop entry INI ([Desktop Entry] Icon=…, plus view sections); keep unknown keys and comments when writing back.- File ops on large trees: progress, cancel, conflicts (skip/overwrite/rename) and partial failures; trash follows the freedesktop Trash spec (
~/.local/share/Trash,.trashinfo). - Symlinks, permission-denied folders, non-UTF-8 file names and very large folders (10 000+ entries, virtualized ListView) must not break a view.
- Tests never touch the real home: use temp dirs. Never connect to Tor or proxies in tests; network tests use a local server or mocks.
- Run the app offscreen or in a hidden session unless the user asks to watch. There is no
kwin_waylandinstalled: screenshots use Slint's software renderer to PNG.
5. Verification tools
| Tool | Role | Available after |
|---|---|---|
cargo build --workspace / cargo test --workspace |
build, unit + integration tests | phase 1 |
cargo clippy --workspace --all-targets -- -D warnings, cargo fmt --check |
lint, format | phase 1 |
busctl --user call org.freedesktop.portal.Desktop /org/freedesktop/portal/desktop org.freedesktop.portal.Settings ReadOne ss org.freedesktop.appearance accent-color |
inspect portal values | now |
fc-list |
check bundled/system fonts | now |
cargo run -p tunal -- --screenshot <png> [--dark] [--size WxH] (software renderer, offscreen, default 960x640; env TUNAL_SEED=#rrggbb, TUNAL_REDUCED_MOTION=1, TUNAL_VIEW=grid) |
single-PNG visual check; full state matrix in phase 12 | S003 |
XDG_CONFIG_HOME=<scratch> cargo run -p tunal -- [<dir>…] [--split <a> <b>] --screenshot <png> [--dark] --size 1200x760 |
one tab per folder, --split adds a split tab (last tab current); no folders = restore session.toml. Copy ~/.config/user-dirs.dirs into <scratch> for the places |
S010 |
XDG_DATA_HOME=<dir>/data cargo run -p tunal-core --example ops -- <dir> (refuses unless XDG_DATA_HOME is inside <dir>) |
job engine + trash smoke run: conflicts, cancel, trash/restore/empty | S007 |
cargo run -p tunal -- --gallery --screenshot <png> [--dark] --size 1200x1000 (--gallery alone opens it in a window) |
every control in rest/hover/pressed/focused/disabled; press squeeze not drawn by the software renderer | S004 |
cargo run -p tunal -- --gallery --page menu|dialog --screenshot <png> [--dark] --size 960x640 |
open menu + submenu + two toasts, or dialog + indeterminate toast, over a stand-in folder | S005 |
TUNAL_SETTINGS=<0-7> cargo run -p tunal -- <dir> --screenshot <png> --size 1000x700 (XDG_CONFIG_HOME=<scratch>) |
settings dialog page over a folder (6 Mouse, 7 Shortcuts); add TUNAL_KEYS=<command id>:<chord> to record that chord on the Shortcuts page (a taken chord shows the conflict row) |
S013 |
TUNAL_DRAG=x1,y1,x2,y2[,hold] TUNAL_REDUCED_MOTION=1 cargo run -p tunal -- <dir> --screenshot <png> --size 1200x760 (XDG_CONFIG_HOME=<scratch>) |
drags between window points and drops (drop menu) or holds (glow + drag image) before the frame | S014 |
Xvfb :97 & then env -u WAYLAND_DISPLAY DISPLAY=:97 target/debug/tunal <dir> & and DISPLAY=:97 target/debug/examples/xdnd_probe x1 y1 x2 y2 (or in x y <uri>) |
X11 native DnD: fake XTEST drag out of the window onto a probe target, or a probe source dropping into the app; Xvfb only. Also xdnd_probe click x y [count] [gap_ms] [hover_ms] [button] (2 = middle) and xdnd_probe key ctrl+t f3 alt+2 … (focuses the window under the pointer, then presses each chord), xdnd_probe press x1 y1 x2 y2 [hold_ms] (plain left drag, e.g. a selection box; screenshot while it holds); screenshot with import -window root <png> |
S031 |
same, with SLINT_BACKEND=winit-software (so DISPLAY=:97 import -window root <png> captures it), then DISPLAY=:97 target/debug/examples/xdnd_probe click x y [count] [gap_ms] [hover_ms] |
real clicks (XTEST) on a window point after resting hover_ms there, e.g. the split toggle with a tooltip showing; Xvfb only |
split/tooltip fix |
TUNAL_APPEARANCE=1 XDG_CONFIG_HOME=<scratch> cargo run -p tunal -- <dir> --screenshot <png> --size 1000x760 |
folder appearance dialog for <dir> (theme icons looked up at once); cargo run -p tunal-dirmeta --example roundtrip -- <dir> sets Icon in <dir>/.directory and prints the old values |
S015 |
TUNAL_PLAY=<audio file> XDG_CONFIG_HOME=<scratch> cargo run -p tunal -- <dir> --screenshot <png> [--dark] --size 1200x760 (TUNAL_PLAY_STATE=playing draws it playing: the wave) |
player bar open on that file, a third in (tags, cover, length read at once; no audio output), paused unless asked | S023 |
TUNAL_TAGS=editor|lookup|mapping|apply:<file>:<file> TUNAL_TAGS_SYNC=1 TUNAL_MUSICBRAINZ=<mock url> XDG_CONFIG_HOME=<scratch> cargo run -p tunal -- <dir> --screenshot <png> --size 1000x760 |
tag editor / lookup / mapping over a folder; apply also writes the tags (scratch copies only); mock = a local server for both services |
S021 |
cargo run -p tunal -- --gallery --page connection|host-key|secret --screenshot <png> [--dark] --size 960x640 |
the connection editor, the unknown-host-key prompt, the password prompt over a stand-in folder; with a scratch HOME (own .ssh/config, key) and XDG_CONFIG_HOME holding tunal/connections.toml, session.toml (pane sftp://…) and a trusted known_hosts, a normal --screenshot shows the Network section and an SFTP folder (local sshd on a spare port only) |
S029 |
cargo build -p tunal && target/debug/tunal --matrix <dir> (about 1.5 min) |
screenshot matrix: shell full/grid/empty/split, row hover/pressed/selected, context menu, drag, rename, properties, open-with, delete, appearance, player, tag editor, settings pages 0–5, gallery pages, light + dark, 720x480 minimum; stand-in folder in <dir>/fixture, config in <dir>/config. Hooks: TUNAL_POINTER=x,y[,press|click|menu] (hover/press/select/right-click before the frame), TUNAL_ACTION=<action id> (runs a menu action on the selection) |
S034 |
TUNAL_FRAMES=1 target/debug/tunal <dir> (under Xvfb :97, env -u WAYLAND_DISPLAY DISPLAY=:97) |
logs each drawn frame with seconds since start; an idle window logs nothing | S035 |
Don't assume a tool exists: check first. When your plan creates a tool, add its row here.
6. Git
Remote origin is Astar Hub (forgejo:astar76/Tunal.git); the user asked for the first push on 2026-11-25. .gitignore covers target/. One commit per logical step, message SNNN: … in English. No reset --hard / force push without an explicit request.
7. Definition of done
A plan is done when: all end criteria are verified by command or test; planned builds/tests are green; nothing regressed; PROGRESS / DECISIONS are up to date; the INDEX line and tracker are ticked; the work is committed. Say explicitly what was not done or verified.