S006: location layer, local backend, mime guess and ls example
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
parent
89b60028eb
commit
afdcfe2d1f
2 changed files with 906 additions and 8 deletions
|
|
@ -25,3 +25,4 @@ D-020 — 2026-11-18 — Accepted SSH host keys go to `$XDG_CONFIG_HOME/tunal/kn
|
|||
D-021 — 2026-11-18 — Playlist sort: a sort option "Playlist sort" offered only in folders under XDG_MUSIC_DIR that contain a playlist file (.m3u, .m3u8, .pls, .xspf); listed files first in playlist order, unlisted entries after in natural name order; several playlists → one option each; desc reverses; re-sorts when the playlist changes; stored as the folder's sort in `.directory` like other sorts — user request (details chosen by orchestrator, user may revise) — S008, S015.
|
||||
D-022 — 2026-11-18 — Fallback theme seed `#3F6FB5` (muted blue) when the portal gives no accent; palettes are `material-colors` 0.5 `ThemeBuilder` defaults (tonal spot, spec 2021) exported as ARGB `Palette` structs; library warnings go to stderr as one `tunal-theme: …` line (no logging crate yet) — S002 — S002, S003.
|
||||
D-023 — 2026-11-18 — Window minimum size 720×480 px (preferred 960×640): fits a 240 px sidebar plus a usable content column; Slint 1.19 can't drive the icon font's variation axes (font-weight doesn't reach `wght`), so `Icon` has size only and draws the default instance (wght 400, FILL 0); easing tokens live in an internal `Motion` global and Rust sets the reduced flag through `MotionPrefs` (easing properties can't be exported) — S003 — S003 and every UI plan.
|
||||
D-024 — 2026-11-18 — Location URIs are `scheme://authority/path` with the path as raw bytes (percent-encoded only in Display); every backend implements the object-safe blocking `Location` trait in `tunal-core` (chunked `list` with a `ControlFlow` sink, `watch` returning a drop guard), unsupported ops return `Error::Unsupported`, and views gate actions on `capabilities()` — S006 — S007–S014, S024–S029.
|
||||
|
|
|
|||
|
|
@ -20,5 +20,12 @@ One entry per session, newest last, ≤ 15 lines: done, verified how, not done,
|
|||
- Not done: live re-theme not observed end to end (no D-Bus Python bindings for a fake portal); the path is `watch` (verified in S002) → `apply` (verified by screenshots). Icon weight/fill: not settable in Slint 1.19 (D-023).
|
||||
- Later: icon weight/fill if Slint gains font variations; screenshot hover/press states need a controlled clock (phase 12).
|
||||
|
||||
## S006 — Location layer and local backend
|
||||
- Done: `tunal-core` types `Uri` (scheme, authority, path as raw bytes; `Uri::from_path/parse/to_path/join/parent/file_name`, Display percent-encodes the path, e.g. `file:///a/b%FFc`), `Entry { name: Vec<u8>, display_name, kind: Kind, size, mtime: Option<SystemTime>, mode (0o7777), uid, gid, hidden, mime: &'static str }`, `Kind::{File, Dir, Special, Symlink { target: Vec<u8>, target_type: Option<FileType> }}` (`None` = broken), `Error::{NotFound, PermissionDenied, Exists, NotEmpty, Unsupported, Cancelled, Io(String), Remote(String)}` + `needs_elevation()`, `From<io::Error>`.
|
||||
- Trait `Location: Send + Sync` (object-safe, blocking): `scheme()`, `capabilities() -> Capabilities { write, trash, symlink, watch, permissions }`, `list(&Uri, &mut dyn FnMut(Vec<Entry>) -> ControlFlow<()>)` (Break → `Cancelled`), `stat` (lstat), `open_read -> Box<dyn Read + Send>`, `open_write(&Uri, WriteMode::{CreateNew, Overwrite})`, `mkdir`, `rename` (`Exists` if target taken), `delete` (file/link/empty dir), `trash`, `symlink(link, target: &[u8])`, `watch(&Uri, Box<dyn Fn(WatchEvent) + Send>) -> Watch` (drop stops; `WatchEvent::{Changed(Vec<Uri>), Error}`); defaults → `Unsupported`. `Locations` registry (`with_local()`, `register`, `get`, `resolve`). `LocalLocation` (`file`): 256-entry chunks, `notify-debouncer-mini` 0.7 (200 ms, non-recursive); trash Unsupported until S007. `mime::mime_type(name, kind)` (`mime_guess`; dirs `inode/directory`, broken links `inode/symlink`, links by own name then target; local fifo/socket/devices `inode/*`). Example `ls [--watch] <dir>...`.
|
||||
- Verified: workspace build, clippy -D warnings, fmt --check; scratch dir (non-UTF-8 name shown raw as `%FF`, broken/dir/file links, fifo, hidden, `chmod 000` folder → PermissionDenied, 10 000 files in 36 ms debug / 15 ms release); `--watch` reported create/modify/delete/mkdir once per path.
|
||||
- Not done: nothing. URI schemes `trash:///`, `ios://`, `mtp://`, `sftp://user@host:port/path` come with their plans.
|
||||
- Later: local `rename` uses a check-then-rename (race); `renameat2(RENAME_NOREPLACE)` would need `libc`/`rustix`.
|
||||
|
||||
## Later
|
||||
-
|
||||
|
|
|
|||
Loading…
Reference in a new issue