Duscape is an interactive terminal disk space navigator (TUI) written in Rust. It visualizes disk usage via a squarify treemap, supports live scanning, and allows deleting large files in-place.
Workspace layout (Rust 2024 edition, version 0.2.1; duscape, a fork of diskonaut renamed after 0.2.0 so as not to clash with upstream's command β see README):
duscape/
βββ common/ # libduscape: what every viewer shares β model, treemap, scan protocol,
β # delete, preview reading, native clipboard, formatting, os
βββ scanners/ # duscape-scan: the walkers (Linux, macOS, Windows, portable), NTFS,
β # the parallel build, the second pass, rescan/refine threads
βββ viewers/
β βββ tui/ # duscape: the ratatui viewer (primary) β CLI, UI, input, config;
β β # its `duscape` binary holds the platform's window too (`front.rs`)
β βββ windows/ # duscape-windows: the Win32/GDI viewer
β βββ macos/ # duscape-mac: the AppKit viewer (objc2)
β βββ linux/ # duscape-linux: the Wayland/X11 viewer, no toolkit (wayland-client, x11rb, ab_glyph)
β βββ shared/ # duscape-viewer: what the desktop viewers share β the window's
β β # state and layout (`Viewer`), the first scan with its outline, the previewer
β βββ dos/ # not a crate: the MS-DOS treemap in 16-bit FASM assembly, `make dos`
βββ docs/ # features.md (every feature, per viewer), sizes.md (how sizes are counted),
β # security.md (defenses against malicious/bad files), terminal.md, viewers.md,
β # benchmarking.md, scan-performance.md (the measurements),
β # packaging.md (static binary first; deb/rpm, Flatpak, Snap weighed),
β # probes/ (bench-matrix.sh and .ps1, drop-cache.ps1, bench-diskus.sh, cross-arch-tests.sh
β # (32-bit and big-endian under QEMU), the C/Python probes behind the measurements)
βββ installer/ # duscape.nsi (the Windows installer, NSIS) and path.ps1 (its PATH edit);
β # `make installer`
βββ packaging/linux/ # the .desktop file, AppStream metadata and hicolor icons, by the app ID;
β # in the Linux tarballs as share/ (docs/packaging.md: why static first)
βββ example/config.toml
βββ Cargo.toml # Workspace root
Dependencies run one way: duscape-scan β libduscape, each viewer β both, and the desktop
viewers (Windows, macOS, Linux) β duscape-viewer too. The terminal viewer β the platform's
window crate, by its gui feature (default): the window crates are libraries (run, and
run_with for a command line read elsewhere) with a thin binary of their own each, and
duscape is one program per platform. A feature that is not drawing or input goes in common
(or scanners, if it reads the disk), so the other viewers get it by calling it; what is about the
window but not about a toolkit (which entry is in hand, marks, the layout in points, what a
delete changes) goes in viewers/shared, so the three desktop viewers behave alike. The scan protocol types (ScanOptions, EntryMeta, DirEntries,
Outline, Found) are in common because the model consumes them; duscape-scan re-exports
them, so duscape_scan::X works for either kind.
What every change is held to, adapted to sane practical defaults rather than met to the letter:
- Fast walkers and fast renderers. A feature is not done until its cost is measured on a
real disk (
--benchmarkfor the walk;tests/layout_speed.rsandDUSCAPE_PAINT_TIMESfor the window β "Modifying treemap layout" below) and is small beside the work it sits in. - Fast time to first paint. Show what is cheap now and refine after: the outline during the
scan, the tree when it is done, the second pass over small files (
refine_N) after the tree is on screen. - About 60 fps while laying out again (a resize, a folder change, a zoom): a relayout within
LAYOUT_BUDGET(10 ms) so the paint fits in the frame too. - Adapt, do not just degrade. A feature found to slow a frame is measured as it runs and put
off to a second pass when it would overrun, not dropped; the second pass runs once input has
stopped for
IDLE(60 ms), each change putting it off again. Prefer that shape β coarse now, complete after β to a switch the user has to find. What does it now:- the nesting stops at the relayout's deadline, a level at a time across every folder so it
is the deepest levels that wait, and lays out no more than
FIRST_PASS_ROOM(1000) of any one folder's entries (Nesting::deadline,room_cap); - the specks of the "small files" corners come with the tiles only while the last complete
layout with them, scaled by area to this one, would be inside the budget, and even then
stop at half of it (
Nesting::dust_deadline): a corner's specks grow far faster than the window (a cache of 256 folders: 5k at 1600Γ1000 points, 119k at 2560Γ1400), and before both a maximised first frame took 33 ms, now 7 (Viewer::defer_to_second_pass,finish_second_pass,second_pass_owed); - the first paint of a layout stops labelling the treemap's tiles at
passes::LABEL_DEADLINE(4 ms spent on labels, Windows and Linux); the second pass paints in full, and a layout painted in full once stays so (passes::Paints, byViewer::layout_generation), so labels never come and go on a hover.
- the nesting stops at the relayout's deadline, a level at a time across every folder so it
is the deepest levels that wait, and lays out no more than
- And what is cheap should stay cheap: a folder tile is filled only around what its nested
entries cover (
Inside), not under them β filled whole, each level painted its parent's area again; and text is measured once and drawn withExtTextOutW, notDrawTextW, which laid each line out again for its ellipsis. - Where it stands (2026-09-27, 1.5x, the Windows window resized about 1400β1850Γ1000 px): the
first frame after a relayout β the layout's first pass and a hurried paint β is 11β14 ms on
C:\Windows(layout 4.7β5.3, paint 6.4β6.9), E:\ and the 87k-file Dell backup alike; the second pass's full paint is 6β12 ms. Before this round it was 18β21. The flat Dell folder's 87k-entry top level is still laid out whole in its first pass (6β8 ms).
cargo build --workspace # Build everything
cargo test --workspace # Run all tests
cargo clippy --workspace --all-targets -- -D warnings # Lint
cargo fmt --all # Format code
cargo fmt --all -- --check # Format check (CI)On Windows without make: .\make <target> runs the same Makefile β make.cmd starts
make.ps1, which reads it and runs each recipe line in Git for Windows's bash (MAKE_SHELL
names another). It interprets the subset of make this file uses and stops on anything else, so
a recipe is written once. .\make -n <target> prints what it would run.
Windows setup and installer: .\make setup-windows is setup-ubuntu's counterpart β zig
(the version deploy.yml pins) and NSIS into target/tools, each zip checked against a SHA-256
pinned in the Makefile, then cargo-zigbuild, typos, cargo-deny, cargo-llvm-cov; Rust
with the MSVC build tools and Git for Windows come first, by hand. .\make installer builds
the release's GNU exes with zig and installer/duscape.nsi around them, to
target/installer/duscape-<version>-x86_64-setup.exe. The installer is per user
(%LOCALAPPDATA%\Programs\duscape, HKCU only, no elevation: the window elevates itself when a
volume wants it), with the Start menu shortcut on duscape-windows.exe (no console flash before
11 24H2), and the PATH and Explorer menu as ticked options. Its paths use backslashes: Windows's
makensis does not find File "dir/name". The PATH edit is PowerShell (path.ps1), not NSIS,
whose strings stop at 1024 characters and would cut a long PATH short. Not yet in deploy.yml,
and not signed.
Static release binaries (what deploy.yml ships; see "Releases" below):
make static # x86_64-unknown-linux-musl, needs musl-gcc (apt install musl-tools);
# on macOS by cargo-zigbuild, jemalloc archived with `zig ar` (Apple's
# `ar` drops ELF objects, and the link fails on `_rjem_malloc`);
# on Windows the native MSVC build, crt-static by .cargo/config.toml
make static-aarch64 # aarch64-unknown-linux-musl, needs zig + cargo-zigbuild
make static-windows # x86_64-pc-windows-gnu by cargo-zigbuild; on Windows the native buildRun the binary:
cargo run --bin duscape -- [FOLDER]
cargo run --bin duscape -- -a # apparent size modeSix kinds of thread communicate via mpsc channels (bounded, except the previewer's inbox), plus
parallel::SHARDS tree builders that share nothing:
Why (the performance goals): nothing that waits β on the disk, on a decode, on a timer β runs on the thread that draws, so the first paint comes while the walk is still going and no frame is held up by I/O. The channels are bounded so a fast walker cannot bury the renderer; what is sent to main is sized to the screen (the outline), not to the disk. Every desktop viewer keeps the same split: a scan thread, a previewer, rescans, and the window's own thread only laying out and painting.
| Thread | Role |
|---|---|
stdin_handler |
Reads crossterm events β Instruction::Keypress |
hd_scanner |
Drives the walk (its own worker pool). Sends each directory to one tree_builder by path prefix, and feeds an Outline that sends main a folder-only view β Instruction::AddScannedSummaries (batched, ~4096 entries). Directories deeper than Outline::DEFAULT_DEPTH are rolled up into the frontier folder above them rather than sent, so main does O(visible) work, not O(directories) β except under the folder shown (App::scan_focus, a scan::Focus the walkers and the outline watch): the walk reads toward it first (duscape_scan::focus), the outline sends what is under it whole to DEFAULT_DEPTH below it, the folder itself with its files, and a batch holding any of it goes every Outline::FOCUS_FLUSH (the desktop viewers': any batch every scan::FRAME). When the walk ends: merges the builders' trees, replays deferred shared blocks β Instruction::ScanComplete(tree), then StartUi |
tree_builder_N |
Owns a private FileTree in deferred-sharing mode and adds whatever hd_scanner sends it. Never touches another thread's memory |
mft_reader |
Windows, elevated, a volume root: flushes the volume and reads the NTFS master file table (mft::walk_mft, Reading::run), handing each chunk's Charges (made on the parsers' threads) to mft_live and, once the table is read whole, the listing to hd_scanner as Audience::Tree. A read that fails part way reports through the walk and the kernel walk takes over |
mft_live |
The view's running totals while the table is read (mft::Running): each directory's files so far, as one DirEntries of Audience::View with the sizes in its unlisted, every LIVE_EVERY (16 ms, a frame: in practice a flush a chunk), the last of a flush marked so the outline sends the batch at once β so the treemap is up and growing from the first chunk, not after the last. On the reading thread the flushes were a quarter of the read; here they cost it nothing (measured both ways, DUSCAPE_NO_LIVE_TOTALS) |
mft_seeder |
Lists the top SEED_DEPTH (6) levels through the kernel, breadth first, beside the flush and the read, and seeds Running with each directory's record and place: the table's records are in no tree order (an upgraded Windows's C:\Windows is a late record, and every chain through it waited for its chunk), and through the kernel the levels the view shows are known in milliseconds. Ends with the read |
event_executer |
Converts Event β Instruction (visual feedback). A clipboard flash gets a short-lived clipboard_flash thread that asks for a redraw when it expires; the flash carries its own deadline, so a lost redraw cannot leave it on screen |
loading_loop |
Toggles loading indicator while scanning |
ticker |
Sends Instruction::Tick with try_send (late ticks are dropped): every ui::FRAME (16 ms) while App::ticker_pace says the help line is sliding, else every ui::IDLE_TICK (250 ms), looking again one frame after each resting tick since a slide begins on one β twice per resting interval, not at frame rate. App::tick moves the help line (ui::Ticker/Strip) |
refine_N |
The second pass (duscape_scan::rescan::Refiner β refine::refine, a few refine_* workers): FIEMAP on the small files the walk noted (SmallFiles, 4β64 KiB, nlink == 1, XFS/btrfs), directories under App::scan_focus (the folder shown) first β Instruction::Refined(generation, Found, left); FileTree::apply_found charges them to the ledger. A new whole tree cancels it; folders rescanned meanwhile are skipped (refine_skip), since a folder rescan refines its own tree before grafting |
rescan_N |
One per r/R (duscape_scan::rescan::Rescanner). A folder the whole scan would not enter (walk_would_enter: pseudo, network, -x, bind duplicate) or past --max-depth (counted from the scan root) is not rescanned (Outcome::NotWalked); a delete inside a folder being rescanned restarts that rescan. parallel::build_tree on the folder β Instruction::Rescanned(id, Outcome). App::rescan_done grafts it (FileTree::graft, ancestors corrected by the difference) and leaks the old folder like finish_scan does. A rescan that another under way covers is not started; one the new rescan covers is cancelled and its result dropped |
scan_recorder |
macOS: deflates and writes the scan's stream, trimmed, to the saved-scan file as it goes (cache::Recorder), one record a directory over a bounded channel, so the walk pays the encoding alone; the recorder renames the file into place when the stream ends, and removes it if the scan stops |
rescan_N as the catch-up |
macOS, after a tree read from the saved scan as it was is on screen: a whole-tree rescan through Cache::CatchUp (Rescans::start_catch_up), whose tree replaces it by graft as R's would; the status line says "the saved scan, being brought up to date" |
fill_N |
macOS, once the catch-up's tree has landed: lists the folders the saved scan trimmed, the one in view first, and reports batches of 256 (or every 100 ms) as Outcome::Filled under one id until left is None (Rescanner::spawn_fill, fill::fill); a delete does not restart it, and a fill adds only what the tree lacks |
snapshots_N |
The last idle pass, macOS, root only (Rescans::start_idle, once nothing else reads the disk: the first scan, its catch-up and fill done; Rescanner::spawn_snapshots): each of the volume's local snapshots mounted read-only and nobrowse in a private folder (mount_apfs -s on the volume's device), read on the walk's thread count where the change log named folders since it (one replay on / for every snapshot, its id from .fseventsd; whole where the log does not reach) against the live volume by file id and, for a file written over in place, by its physical extents (snapshots::gone_from_live), unmounted, one tree for them all β Outcome::Snapshots, grafted at the root's (local snapshots) folder. A whole rescan cancels it; the new tree's idle call starts it again |
deleter |
The desktop viewers, one a delete (duscape_viewer::deleting::Deletion): removes the entries confirmed with delete::remove_counting (or a Trash's call), counting each into a shared Tally, and reports how each went β the window's Viewer::delete_done. Meanwhile the window takes no input but Esc and the box's Cancel (Tally::stop), and draws the box (DeletionLayout) once it has run SHOW_AFTER (100 ms), every REDRAW_EVERY; a folder removed only in part (stopped, or a failure inside it) is rescanned. On the window's thread, a package cache's thousands of files froze the window for seconds |
archives_N |
The archives' pass (Rescans::start_archives, from start_idle once a tree is in hand and nothing replaces it; archives::run): idle until a viewer says which noted archives are on screen (Rescans::want_archives, after every relayout, from Viewer::want_visible_archives and the TUI's App::want_visible_archives: an archive's tile, nested or not, large enough to show a nested level β 3 Γ MIN_TILE_PIXELS either way β largest first, then the list's visible rows; the terminal's top-level tiles of 18Γ9 cells and up, and its rows), then reads those indexes on a few threads that block while nothing is asked (Wanted, woken by want_archives and by a stop) β Outcome::Archives, grafted by Rescans::finish (FileTree::expand_archive) and reported as a fill's batch (filled: the folders changed, the archives left). An archive no layout would change for is never read until one does: a zoom, a folder entered. It ends when none is left unread, and a stale pass's batches are dropped by id. Stopped by a whole-tree rescan, which notes the archives afresh; a folder's rescan brings its archives back unread (FileTree::graft), and they are read again when on screen (Wanted::done forgets an archive once reported: kept, a rescanned archive stayed a file). The graft is on the window's thread, its folder built whole there: not measured for an archive near MAX_MEMBERS (a million entries), owed |
previewer |
Reads the file in hand for the preview: first 64 KB as text, or a picture decoded and scaled (PNG, JPEG, WebP, GIF, BMP, ICO, TIFF, QOI, HDR, PNM, DDS: |
the image features in Cargo.toml, with why EXR, AVIF and TGA are not) after a 100 ms debounce (a newer request supersedes it) β Instruction::PreviewReady(generation, _); answers to an older generation are dropped |
|
| main | App state mutations + ratatui rendering. During the scan it renders from the outline; on ScanComplete it swaps in the finished tree, keeping the current folder |
Synchronization: Arc<AtomicBool> for running/loaded flags; bounded sync channels (capacity 1β100).
libduscape (common/) β what every viewer shares, no user interface:
model/files/file_tree.rsβFileTree: hierarchical navigation, deletion tracking;deferring_shared_blocks/merge_from/replay_deferredfor the parallel build;add_summaryfor the outline;graft,apply_foundmodel/file_to_delete.rsβFileToDelete::in_current_folder, what both viewers confirmscan/mod.rsβ the scan protocol:ScanOptions,EntryMeta,DirEntries(itslaterandextent_spaceare filled by the Linux walker for the second pass; a failure is counted withDirEntries::fail(action, name, error), neverfailed += 1, so that--issuescan say why:Issuescounts every one by kind and by the name of the folder holding it (folders: a Synology NAS's million@eaDirfailures in one line; 64 kinds and 64 names at most, the rest asIssues::OTHER, so an error that names its path cannot make one kind a failure; which 64 names get lines of their own follows arrival, so it varies between runs), by where (scan/places.rs,Places: every failure counted at its path, the deepest paths counted at their parents once there are more than 4096, so the totals stay whole; the report a tree under the paths' common root whose 60 lines go to the folders holding most, largest first and not depth first, a folder of one folder sharing its line), and keeps a few examples β 8 a directory, 200 a scan β andFileTree::add_dir_entries/merge_fromgather them intoFileTree::issues),Outline/DirSummary(the depth-capped live view;followingaFocus, exempt under the folder shown),Found/FoundFile;Focus/FocusWatchβ the folder shown, shared with whatever still reads the disk, a move told by one atomic load;Audienceβ whom aDirEntriesis for:Both(a listing, as every walker hands one on),View(a running total so far, as itsunlistedsum, for the outline alone:build_treepasses it toprogressand no builder) orTree(a listing the outline skips, having had its totals) β how the NTFS table reader shows the volume while it reads (DirSummary::ofcountsunlistedas files of the directory's own)model/files/hard_links.rsβ charges shared blocks to each folder once, over interned directory ids; two ledgers, one keyed on inode (hard links) and one on physical extent (reflinks)model/files/hash.rsβ the fast hasher behind the folder and inode mapstiles/treemap.rsβ squarify algorithm, in aGrid's cells:Grid::TERMINAL(the cell'sHEIGHT_WIDTH_RATIO = 2.5, an 8Γ3 least tile; the TUI, and the DOS port's reference) orGrid::pixels(min)(square pixel cells, what the desktop viewers use). A loop over the children, linear in them βlargest_afteranswers "is any child left big enough" β since a window's pixel grid gives tens of thousands; its layouts are the recursive version's exactly. A step reads only its row's two ends (worst_in_renderable_row): in a row every child has the same second side and a first in proportion to its size, so with the children largest first what renders and the worst ratio are decided there β read whole, a pixel grid's rows of thousands made each step cost the row (a flat 87k-file board, 13.5 β 5.9 ms); and steady (TreeMap::populate_steady,Board::change_files_steady,nest_steady): a relayout of the same folder with new sizes keeps the last layout's rows by name (Plan), so while a scan runs a folder overtaking another grows in place instead of recutting the tiles after it; it lays out afresh when a tile would be thinner than 1:5, new entries take a quarter of the area, or a planned entry is too small for a tile after three tries without it. The arithmetic isSpace(the room left, cut a row at a time by shares), apart from what the rows are made into (Lay): aTreeMap's tiles and corner, orscatter's motes.viewers/shared/tests/layout_stability.rsmeasures it (on~: 8% of tiles jumping per relayout β 2%, 14% of the area at the scan's end β 2%)tiles/board.rsβBoard: tile selection, zoom stack, navigation;hidden, the entries in the "small files" corner (the treemap records them as it lays out,TreeMap::hidden);set_free_space, a volume's free space and the used space the scan has not found (FreeSpace, unzoomed only), cut first (cut_strip): the free space a band the board's width along its bottom, as tall as its share of the volume β its place and both its sides fixed through the scan, since they depend on nothing the scan finds (cut from one strip with the unscanned space before 2026-10-05, it kept its area but changed shape, as if the free space changed); the unscanned space a strip at the right of the rest, its share of the board, narrowing as the scan goes; the entries laid out in what is left, not ranked among them, growing into the unscanned space. Once the scan is over the unscanned strip's foot may be the purgeable part (purgeable_tile). The tiles come after the entries' (free_tile,unscanned_tile, by index, namedFREE_SPACE_NAMEandUNSCANNED_NAME,UNSEEN_NAMEonce the scan is over), never in the listing and never a stop for the selection (selectable,select_first);corneris the "small files" corner bounded by the entries' area, short of the strip, for every painter and hit testtiles/dust.rsβscatter: the "small files" corner filled in β its entries laid out again inside it in one-pixel cells with no least tile, as many as it has pixels, largest first and in proportion to each other, so a flat folder of 87k small files shows as specks, not a grey box. Laid by the treemap's ownSpacestraight into motes, noTilemade of each (a test holds them to where a treemap of stand-ins would put them): on/usrat 2560Γ1400 pt, 47k specks, a relayout 10.8 β 8.8 ms. The motes have no names and are no targets;Viewer::dustcolours them by the rule their tiles would have (entry_color:tile_colorby name,depth_shadedarker a level in; a file's extension looked up once, and a run of one kind not looked up again: 8.8 β 8.3 ms; no extension is not an empty one,Makefilegrey andnotes.hashed) and every desktop painter fills them in one pass: framed as a tile where one has room for a frame (Dust::framed), elseSPECK_SHADEdarker under the least tiles' grid (Dust::grid, lines everyMIN_TILE_PIXELSaligned to the board) β plain, a corner read as a block of flat colour twice as bright as the framed tiles beside it (measured on Windows, 2026-10-05; now within 5% of them). Each corner comes as aSpeck(where, the entry, its rank, its depth): the board's fromBoard::scatter_corner, each nested folder's fromnest_with'sspeck(Nesting::dust). A folder is ranked once for its tiles and its corner (Ranking: one pass over the folder, ranked only as far as asked, names borrowed and copied only for the tiles laid out), and where the entries too small to rank left their room empty rather than a corner, that room is it (TreeMap::leftover). In a first pass the specks stop atNesting::dust_deadline, half the relayout's budget, and the rest are the second pass's: how many a corner holds is not known until it is laid outtiles/nested.rsβnest: the treemap nested β the same squarify run inside each folder tile (under its label rows, within a margin) on the folder's entries, and theirs in turn, down to the files wherever there is room: what ends it is an inside too small for two minimum tiles either way, and the tiles in all are bounded by the folder tiles' area at the minimum size β the screen bounds a relayout's and a paint's work (Nesting's depth and tile caps are guards beyond that). The minimum tile isNesting::grid's. A folder too short for its label rows nests under its margin alone;Nesting::labelledsays which have them, so a painter labels only those. Each folder is listed bylargest_in_folder_from, only as many entries as its inside has room for and none under (least β 1)Β² cells (which can never round to a tile), so a folder of fifty thousand entries is not named and sorted whole on every relayout; a level at a time across every folder (a queue, breadth first), so parents come before children and a painter draws in order, and a first pass's deadline (Nesting::deadline, after the top-level folders' own entries) cuts the deepest levels everywhere rather than the last folders whole;room_capbounds one folder's share of a first pass, andnest_withsays whether either cut. What a folder's entries cover β its inside less its corner β is kept as itsInside(NestedTile::inside,Nested::tops,Viewer::board_inside), so painters fill a folder only around it (Layout::fill_parts, the parts to fill in points, one helper for every painter). The terminal nests too (ui/display.rs'sNESTING: two label rows and a margin of one cell, so a folder's entries are a block of their own inside its border; laid out again only whenBoard::generationmoves, not every frame), drawn byRectangleGrid::nested. ANestedTileknows itsparentandtopby index, not its path (nested_path,nested_path_is): paths cloned per tile were half the nesting's timearchive.rsβ zip archives and the formats that are zips by another name (EXTENSIONS: jar, apk, whl, nupkg, vsixβ¦), as folders:read_indexreads the central directory from the file's end (the end record searched in its last 64 KiB, Zip64, a self-extractor's stub before it shifting every offset, CP437 names unless flagged UTF-8; at mostMAX_DIRECTORYbytes andMAX_MEMBERSentries, the resttruncated; a name going up (..) or with a part that is no plain name here βC:on Windows, which a join takes for the drive, so a delete of the entry reached it β is left out,member_path), never the entries;member_ofsplits a path inside an archive into the archive and the inner path (no file at the path, an archive above it),on_diskthe file to open or reveal for it;read_memberunpacks an entry's start or whole, stored or deflated (flate2, pure Rust), in memory. The walk notes an archive by its name (FileTree::archives) and reads nothing;FileTree::expand_archiveturns the file into a folder of its entries sized by their compressed lengths (the first of a name kept, a file where a folder is left out: a zip may nameaa file and holda/b, which ended the build), the folder's sizes the file's (the headers stay in the folder's size, so a tiny archive's entry is a sliver beside them β honest, and nounlistedsum, which would make the macOS fill take it for a trimmed folder). An entry is refused bydelete::refused, previewed bypreview::read/picture_bytesfrom inside the archive, and a rescan of it rescans the folder holding the archive (Rescans::start)delete.rsβremove(from disk, a link itself never its target) andrefused(NTFS metadata);remove_counting, a walk of its own counting into aTallyand stoppable (remove_dir_allsays nothing until done), a read-only file deleted ignoring the attribute asremove_dir_alldeletes it (FILE_DISPOSITION_FLAG_IGNORE_READONLY_ATTRIBUTE): cleared, it was cleared on every hard link of the filemetafiles.rsβ NTFS metadata names, for the Windows walker and fordeletesnapshots.rsβ a volume's local snapshots as one virtual folder at its root (FOLDER,(local snapshots)), a folder per snapshot:Noted(FileTree::snapshots, set byFileTree::note_snapshots, which adds the folders empty;is_snapshot_path),describe(asked bynas::describe, so every status line says what the folder is), andis_snapshot_source(<snapshot>@/dev/β¦, a mount's source). Unprivileged, the windows split the unseen space withFileTree::purgeable(os::volume_purgeable: available for important use less free, through CoreFoundationdlopened, asked beside the walk since its first answer costs up to a second), the board'spurgeable_tile(PURGEABLE_NAME, "at most": it counts purgeable files the scan found too), only while the snapshots are unread. Nothing is at the folder's path on disk:delete::refusedrefuses what is in it,Rescans::startwill not rescan it (a rescan would find it gone and take it off the tree), and a real entry of the name at the root means no folder is addednas.rsβ the folders a system keeps for itself, by name (KNOWN: Synology's#snapshot,#recycle,@eaDir,@docker,@ActiveBackupβ¦, QNAP's@Recently-Snapshot,@Recycle,.@__thumb,.qpkgβ¦, ZFS's.zfs, NetApp's.snapshot, Samba's.recycle, macOS's and Windows's metadata folders):left_out(snapshots, unless--snapshots),left_out_note,describepreview.rsβread(sniff the first 64 KiB: text lines, info, or a picture),describe_picture,decode_picture(bounded). Scaling and encoding for display are the viewer's. A binary file isContents::Binary:describe_binary(its size, thenplacement::describe) andhex_dump(HEX_LINESof sixteen bytes, a dash after the eighth, the characters beside); the terminal shows the description, the desktop viewers the dump (Preview::Hex, drawn with the monospace font shrunk until a line fits βFonts::fittingon Windows,draw::hexon macOS and Linux, which put the description above it)placement.rsβ where a file's blocks are, for the preview of a file with nothing else to show. Linux: FIEMAP for its extents, sparseness and shared blocks, then sysfs for the disk β through a partition to the disk's model and SSD/HDD and the offset into it; the members of an LVM or md volume (the table that says which is root's); a loop device's file. The companion toolwhereisthisfollows every layer; this is the few lines that fit under a treemap. Windows:FSCTL_GET_RETRIEVAL_POINTERSfor the runs (summed byruns::sum, tested everywhere), the volume's disk extents for the disk and offset,IOCTL_STORAGE_QUERY_PROPERTYfor its model, bus and seek penalty β the volume and disk opened with no access rights, so unelevated. All three desktop viewers draw it wrapped above the hex dumpabout.rsβ what every viewer says about duscape itself, one source: the name, version, summary, homepage and issues link,LICENSE's copyright lines (copyrights), the lines of an About box (lines), and the licences in full (licenses,licenses_filefor a window to open as text):LICENSEandTHIRD-PARTY-LICENSES.txt, embedded (include_str!, 115 KB a binary). The latter is generated bymake third-party(cargo-about,packaging/about/: every crate compiled into a shipped binary on any release target, then Rust's standard library, musl and jemalloc; offline, carriage returns dropped, so the file is the same on every platform) and checked in;deny.yml'sthird-partyjob regenerates it and fails if it differs β runmake third-partyafter changing a dependency. Shown byduscape --licenses, the Windows window menu, the macOS app menu, the Linux right-click menu and F1; shipped in every packageclipboard.rsβ native clipboard (pbcopy, Win32,wl-copy/xclip/xsel),base64launch.rsβopen(the default app) andreveal(the file manager, selected):open/open -Ron macOS;ShellExecuteWandexplorer.exe /select,"β¦"(a raw argument: Explorer takes a comma in a plain one for a switch) on Windows;xdg-openandorg.freedesktop.FileManager1overdbus-sendelsewhere, the bus call on a thread of its own since a file manager being started to answer can take seconds. Nothing waits on the window's thread, and every child is reaped by a thread that waits for itformat/display_size.rsβ byte β human-readable (B/K/M/G; G is the largest unit, so a volume of terabytes shows as thousands of gigabytes, its whole part grouped in thousands β1,862.6G, never1862.6G, which reads as a tenth of it);display_count.rsgroups a count the same way. The DOS port'sfmt_sizeis a port of the former without the groupingos/unix.rs,os/windows.rsβis_user_admin(),size_on_disk_fast(),volume_id(),link_count(),volume_used()/volume_free()(on APFS a volume's own use byATTR_VOL_SPACEUSED, sincestatvfsgives the container's, except at/, whose scan reaches the other volumes);os/mod.rsβcanonical_root(), what every scan root andFileTree::newgo through: canonical, and a network share's root (\\?\UNC\server\share, whichcanonicalizegives with nothing after the prefix) with its separator, so paths under it strip to names;scan::below_rootstrips a separator left in front of a name anyway. Canonical on Windows means verbatim (\\?\C:\), which no person writes: every path shown β a window's title, a dialog, a status line, the chooser, the terminal's title and panels,--issuesβ goes throughformat::shown_path(C:\,\\server\share), and a copied path throughquote_path_for_shell, which drops the prefix tooos/volumes.rsβvolumes(): what is mounted, its device or label, filesystem, size and use β/proc/self/mountssifted (block devices and the known network filesystems, one line a source, tested) andstatvfs;getmntinfoon macOS; the drive letters on Windows, a mapped network drive named by its share and its provider (network_filesystem:cifs,nfs,webdav), and the drives the user mapped that this session has no letter for β an elevated window's, which Windows does not give them β by their shares, fromHKCU\Network(with_mapped,MappedDrive; scanned by the share's path, listed unsized where an elevated session cannot reach it yet); never by the server's filesystem, which Windows reports as the volume's (NTFS). For the windows' chooser
duscape-scan (scanners/) β reading the disk:
lib.rsβscan_directories(): per-directory batches, the seam every walker plugs into;parallel::build_tree(): the app's tree build β shard by path prefix, merge, replay;walk_would_enter,thread_count,scan_into_treeportable.rsβ the portable walk onstd::fs: a shared queue of directories, a few workers, oneDirEntriesa directory. The BSDs' walker (no native one), the benchmark'sportable-*baseline (scan_folder), compiled and tested everywhere. It replaceddua-core(2026-10-04), which Debian does not package; with-xon/usrit finds what the native walk finds, 3.6x faster thandua-core's walk did (docs/scan-performance.md)macos.rsβ macOS walker ongetattrlistbulk(2)(seedocs/scan-performance.md). APFS clones go through the ledger as reflinks do: the bulk call also asksATTR_CMNEXT_CLONEIDandATTR_CMNEXT_EXT_FLAGS(FSOPT_ATTR_CMN_EXTENDED), and a file whose blocks are a clone's βEF_SHARES_ALL_BLOCKS, or a clone id that is not its own inode, which is how the system's own clones on Preboot show, with no flags β getsshared_extentfrom the id and the device (clone_identity); no cost to the walk's rate, measured. A mount that is a disk image's volume, its image inside the scan, is left empty and noted (disk_image.rs). It knows nothing of Linux filesystems, by choice:linux/andext4.rsare Linux-only, and an ext4 or btrfs USB drive on a Mac is walked through its driver like any folder (docs/features.md)disk_image.rsβ macOS: whether a mounted volume is read from a disk image the scan counts as a file (counted_by_the_scan): the device'simage-path(attached byhdiutilor the Finder) orDiskImageURL(by the system: the iOS simulator's runtime) up IOKit's registry, IOKit and CoreFoundationdlopened when a mount is first crossed; paths compared with firmlinks undone (real_path,ATTR_CMNEXT_NOFIRMLINKPATH), so a scan of/and of/System/Volumes/Dataagree.walk_would_enteron macOS does not ask it, so a rescan of such a volume walks it (as it walks a share): owed. So is the Linux rule: a loop device's volume from a file inside the scan (/sys/block/loopN/loop/backing_file, whichplacement.rsreads already) is walked there and counted twice; it wantsmake test-fs, whose fixtures are loop imagesext4.rsβ as root on ext4, the walk read from the block device: directory blocks and inodes swept in device order a generation at a time, every run advised before any is read, parsed and batched on several threads; oneDirEntriesper directory like any walker. Declines up front (and the kernel walk runs) for a filesystem it cannot follow (META_BG, a device that will not open); a mount point inside, or a directory of a shape it does not read, goes to the kernel walker whole; rescans and--no-device-readnever use it.--bench-stage ext4-rawis the inode survey alone. Last seconds of writes may be missing: it reads the device's page cachelinux.rsβ Linux walker ongetdents64/statx, own thread pool: the walk itself (Job,inspect,read_directory,walk_linux); what it asks along the way is inlinux/, one file each.linux/stat.rsβ everystatxgoes through its ownstatx, which onENOSYS(a kernel before 4.11 β Synology DSM's 4.4) or a seccompEPERManswers withfstatatinstatx's shape (statx_from_stat) and stays on it (NO_STATX): basic fields only, no attributes or mount id. Those the kernel gives only from 5.8 (STATX_ATTR_MOUNT_ROOT,stx_mnt_id), and before itmount_oftakes both from the mount table (Shared::mounted_at,mounts::points: the last mount at a point shows), so bind-mount duplicates are still found;mount_atlikewise.DUSCAPE_NO_STATX=1makes a scan read as a pre-4.11 kernel would β the fixtures run their totals and mount layouts that way too β andstrace -e inject=statx:error=ENOSYSreproduces such a kernel from outsidelinux/mounts.rsβ/proc/self/mountinfo(read,parse,points), bind mounts reached elsewhere (reached_elsewhere),mount_oflinux/filesystem.rsβclassify: onestatfsper mount crossed says pseudo, network (FUSE by its subtype), reflinks, ext, btrfs, and whether compressed sizes can be readlinux/crossing.rsβ the rules at a mount point that a rescan must keep too:walk_would_enter,-x's boundary (same_filesystem), mount loops (loops_back)linux/btrfs.rsβ btrfs's own ioctls: the filesystem's UUID (fsid,BTRFS_IOC_FS_INFO), compressed sizes (btrfs/extents.rs,BTRFS_IOC_TREE_SEARCH_V2), read-only subvolumes (btrfs/subvolume.rs,BTRFS_IOC_SUBVOL_GETFLAGS, no privilege needed). A read-only btrfs snapshot inside the scan is left empty unlessScanOptions::snapshots(--snapshots):snapshot_left_out, which the walk andwalk_would_enter(a rescan, and the ext4 device reader's mount points, the scan's own root excepted) both ask. Every subvolume has a device of its own, so one is always a crossing, onto btrfs (filesystem::Kind::btrfs), at a root numbered 256 β only there is the directory opened to ask, never off btrfs, where opening an automount point would mount it. Synology keeps a share's snapshots under its#snapshot, one an hour, and walking them walked the share once eachlinux/reflink.rsβ theFS_IOC_FIEMAPreflink probe, on files of 64 KiB and up, and not at all under a folder whose snapshots are left out ("Snapshots" below);linux/dirblocks.rsβ directory blocks read ahead through the device;linux/environment.rsβ what--issuessays about the machine
ntfs.rsβ NTFS file-record parser: sizes$MFTand the other metadata files the Windows walker adds at a volume root when elevated (records fetched withFSCTL_GET_NTFS_FILE_RECORD). Platform-independent so its tests run on Linux CImft.rsβ NTFS read from its master file table, elevated (docs/scan-roadmap.mdstep 2 for Windows, what WizTree does): the whole$MFTread in 32 MiB chunks along its runs and parsed on a few threads into(parent, name, sizes)per record β every$FILE_NAME(one per hard link, the DOS name dropped beside a Win32 one), the unnamed$DATA's length and allocation (resident: 0 on disk; compressed or sparse: the compressed size), directory and junction flags, extension records merged into their base β then handed on breadth-first from the scan root's record as oneDirEntriesper directory, exactly as the kernel walk would. Hard links arrive counted, so only files with several names go through the ledger; NTFS's own files are sized by their clusters asntfs.rssizes them.scan_directoriespicks it whenread_deviceis on, the scan root is a volume root (a subtree is a fraction of the volume and the table costs all of it), the volume opens (\.\C:, elevated) and flushes, and a sample of the table says its directories are small enough for the table to pay (TABLE_UP_TOentries a directory: the walk costs a handle per directory, the table a record per file); else the kernel walk.--no-device-readopts out. The parser and the tree run and are tested on every platform; onlymft::volumeis Windows. The table is read on its own thread (mft_reader), and since nothing can be listed until it is read whole (a directory's files are scattered through it: 1.7 s on thisC:\, then 0.9 s to assemble, with nothing on screen before this), the view gets running totals meanwhile (Running,Charges, onmft_live): each chunk's files charged to their directory's record on the parser's thread, and everyLIVE_EVERY(the first chunk's at once) each directory's total since last time handed on as oneDirEntriesofAudience::Viewβ the sizes as itsunlisted, the flush's last marked β at the path its ancestors' records give (resolved once and kept), a directory whose ancestors are not all read yet waiting for a later flush, and nothing charged where the listing would not go (--max-depth, a snapshot folder left out by name, a link). The top levels' places come from the kernel's listing (mft_seeder,Running::seed), since the records are in no tree order. The listing that follows isAudience::Tree, which the outline skips; the tests hold the totals to the listing's sums, hard links and NTFS's own files included. The gate's sample is fetched byFSCTL_GET_NTFS_FILE_RECORD, 1024 records spread over the table, not read as a slice: a volume handle's first read costs 0.4β0.8 s whatever its size, as the volume's flush does, and the two do not overlap β the 0.85 s before the first running total on thisC:\is those two, measured on 2026-10-01 (docs/scan-performance.md, "First paint")windows.rsβ Windows walker: one handle per directory, entries read in bulk withGetFileInformationByHandleEx(FileIdExtdDirectoryInfo). No listing carries a link count, so files in hard-link hot spots (or all files β₯--hard-link-threshold) are sent withLINKS_UNKNOWNand the ledger dedupes them by file id β memory instead of a file open eachcache.rsβ the saved scan (roadmap step 9), in three modes (ScanOptions::cache, aCache):Recorder, a tee on whatever walker ran, writing eachDirEntriestrimmed (folders, hard-linked and shared-extent files, and files ofKEEP_FROM= 1 MiB and up kept one by one; the rest of each folder as oneUnlistedsum β about one entry in fifty kept, 3β4 bytes an entry deflated, so a terabyte's file is 10β30 MB; APFS clones are kept one by one too, about 27 bytes each, since summed they would be counted in full again:/on a Mac with 830k clones is 61 MB, read back whole in 0.9 s) as tagged records naming each directory by its parent's record index, deflated on a thread of its own (scan_recorder), to~/Library/Caches/duscape/<key>.scan, renamed into place only when the stream ends; the key and stamp in the clear at the front (peek), the counts and checksum in a footer record.SavedStream(Cache::Saved, the viewers' first scan): the file read as it is, inflating as it goes, the first directory in milliseconds, the root notedNOTE_OWEDsoFileTree::from_saved_scansays a catch-up is owed.Saved(Cache::CatchUp, the whole-tree rescan a viewer starts behind that tree): the file read whole and checked, the log replayed on a thread while it inflates, thenCachedScan, a walker like the others β the folders the log named listed again first on a pool (Lister,threads), so a hard-linked file's fresh size and link count patch every saved copy (the ledger keys on the disk size), then the stream with folders gone dropped and folders new walked (Walker), the root notedNOTE_CAUGHT_UP.too_stalesays when a walk costs less. Platform-independent and tested on Linux CI with astd::fslister; only the log is macOS. Off for rescans,--issues, the benchmark (cachedandsavedstages excepted) and--no-cache. Swept (cache/sweep.rs,sweep) on the recorder's thread when it starts and again after its rename: removed are part files whose process is gone (kill(pid, 0)βESRCH), an older format, a file that is no saved scan, one saved under another system version, one whose device's log was reset; the rest kept withinROOM(256 MiB), least recently saved out first, never the file just saved nor a newer format (another build's). Not by age nor by the folder being gone β a rarely scanned archive disk, an unplugged one, is where a saved scan pays most; the catch-up'stoo_stalejudges use.wait_for_saveslets a process that ends with its scan (the terminal viewer, the benchmark'scachedstage) wait for the writer: before it, a short scan's save was lost and its part file left.clearisduscape --clear-cachesnapshots.rsβ macOS: a volume's local snapshots (volume_for: an APFS mount point, the data volume for/;list/list_with_times,fs_snapshot_list, unprivileged) and, as root (can_read), what each alone keeps (read,snapshots/macos.rs) β none for a dataless one (Listed::dataless,ATTR_CMN_FLAGS0x20: trimmed to its metadata, it lists files it no longer holds; read, one listed 267.6 GB on a volume with 142 GB unseen): itsScopefrom the change log (snapshots/log.rs: the id before it from.fseventsd's names and times, sinceFSEventsGetLastEventIdForDeviceBeforeTimegives 0; one replay on/, taken onto the volume through/usr/share/firmlinks; whole where the log does not reach or lost events under the root), mounted, read bygone_from_liveβ a folder the log named compared one level and only its subfolders moved or gone walked (same_place), whole otherwise with a folder the same by time as its live counterpart not compared; a seen-set so start points and walks never add a folder twice, which still lets a walk whole take every subfolder of a folder first reached as named (Visit::Deeper: else what was under it went unread, the totals varying with the threads' order); a panic in a folder counted unreadable, since a dead worker left the others waiting with the snapshot mounted; a file kept when its id is nowhere live (LINKS_UNKNOWN, noshared_extent, so the ledger counts by id one several snapshots keep once above them), and in a named folder a live file written over since counted by its blocks (written_over:snapshots/extents.rs,F_LOG2PHYS_EXTextents less the live file's less aRangesof what the pass counted) β and unmounted (Mounted's drop; a pass first unmounts what one in a process since gone left behind,sweep_left_behind, since a quit does not wait for the pass).build, one tree for every snapshot, and aReadingeach, which--issuesprints. The walk, the log's rules and the extents' arithmetic are tested on plain folders everywhere unix; the mount and the root path have not been run. The macOS walker leaves a snapshot mount empty unless--snapshots(macos.rs,snapshot_left_out). What it cannot see is indocs/sizes.md, "Local snapshots"fill.rsβ the fill pass: the folders a saved scan trimmed (FileTree::unfilled_folders) listed again on a pool, the folder in view first (Focus), a batch at a time asrescan::Outcome::Filledthrough the rescan channel every viewer has;FileTree::fillputs each folder's smaller files in by name and takes the sum back. Started by a viewer once the catch-up's tree has landed (Rescans::start_fill). Until a folder is filled its sizes are right and its small files' tiles missing; a small file hard-linked since the save is counted in the sum and once more where it was listed afresh, until the fillfsevents.rsβ macOS: the volume's change log, CoreServicesdlopened when asked (the viewers keep frameworks out of their load commands):current_event_id(the stamp, taken before the walk starts),log_uuid(the log's identity for the device: reset means nothing since is known;None, no log, means nothing is saved),system_version, andreplay, the stream since an id on a dispatch queue, ended byHistoryDoneor a time bounded by the walk it would save;MustScanSubDirs/dropped β walked whole, wrapped or root changed β lostfocus.rsβ steering a walk toward the folder shown:arrangeputs a worker's jobs toward the focus (under it, or on the way down to it) where its stack pops them next,take_towarda steal's pick from the shared queue; the macOS walker partitions its one queue as it fills (QueueState::toward). With no focus, one atomic load a directoryarchives.rsβ the archives' pass (run, behindRescanner::spawn_archives):Wanted, the archives a viewer has on screen, replaced whole each time it asks (Rescans::want_archives, in the order asked: the viewers ask largest tile first), a few workers reading indexes and a coordinator that sends what they read everyGATHER(30 ms) as oneOutcome::Archivesrefine.rsβ the second pass (SmallFiles,refine)rescan.rsβRescannerandRefiner: rescans and the second pass on threads of their own, results through a callback, for any viewer
duscape-windows (viewers/windows/) β the Win32/GDI viewer, over duscape-viewer, at
feature parity with the TUI bar configurable keys (docs/features.md). Behaviour goes in the
shared Viewer, not in win/:
preview.rsβprepare_picture: a picture decoded and scaled to the pixels it will take, as BGRA rows blended over the panel, forlibduscape::preview::Reader; no Win32, tested everywherecli.rsβ the TUI's scan flags, and--no-elevateelevate.rsβ a whole volume unelevated asks to run as administrator:wanteddecides,relaunch_argsandcommand_line(Win32 quoting, tested) make the new process's arguments β this process's plus--no-elevate, so it never asks in turn, plus the folder if it was picked in the dialog β andrelaunchstarts it through the shell'srunas; declined (Refused::Declined) the scan goes on unelevated; failed, so does it, and the status bar says why. Only a local disk (is_local_disk: fixed or removable, byGetDriveTypeW) asks β a share, a CD or a RAM disk gains nothing from itwin/mod.rsβ the window: input βViewercalls (points are pixels over the DPI scale), thenchanged()(a preview request at the drawn size βwanted_preview_sizedβ title, redraw). Messages the window does nothing with go toDefWindowProcWoutside the re-entrancy guard (HANDLEDis the list; an arm added todispatchgoes there too, or it never runs): the frame's own loops (an edge dragged, maximise, the system menu) run inside that call and sendWM_SIZEandWM_PAINTre-entrantly, which the guard would drop. Threads post one boxedAppMsg; one arriving during a modal loop (message box, context menu) is queued FIFO inPENDINGand handled when the handler returns β order matters, the outline's last batch comes before the finished tree. Outline batches are absorbed as they come and the view laid out once a frame (scan::FRAME, 16 ms): by the batch that finds the frame up, orOUTLINE_TIMERfor the last of a burst (WM_TIMERcomes only when the queue is empty, on 15.6 ms ticks), then painted at once (PAINT_NOW,UpdateWindowonce the guard is down, sinceWM_PAINTtoo waits for an empty queue). Laid out per batch (15β25 ms each, then) the window answered nothing until the scan ended; 100 ms after a burst it moved at 8 fps. Now 56 fps median on a warmC:\Usersscan (2026-10-05: layout 2.6 ms, paint 7.7 ms)win/paint.rsβ double-buffered in a 32-bit DIB section, byViewer::layout; returns the breadcrumbs for clicks.Canvas::fill/framewrite the section's pixels directly (aGdiFlushfirst when GDI has drawn since): asFillRect/FrameRectcalls, the nested treemap's thousands of overdrawn tiles cost 30 ms a frame; and a folder tile is filled only around what its entries cover (fill_tile,Layout::fill_parts). Text and pictures are GDI's: text measured once (GetTextExtentExPointW, whose partial extents say where to cut for the ellipsis, measured once a font) and drawn withExtTextOutW, the font selected only when it changes βDrawTextWcost half as much again. The fonts are the system's message font (SPI_GETNONCLIENTMETRICS) and a treemap label size that fits the label band whole.DUSCAPE_PAINT_TIMES=1(passes::paint_times, the Linux window's too) prints each frame's time, and each resize's layout, on stderr (redirect it: no console).painttakes the back buffer out of theWindowfor the frame, noRefCell. The buffer (BackBuffer, a DIB section in a memory DC) is kept between paints and made again only when the size changes: made fresh, its pages faulted in on every frame. A first paint of a layout stops the treemap's labels atpasses::LABEL_DEADLINE; thenSECOND_PASS_TIMER(set by each change and by a paint that stopped, so it fires once input has stopped forIDLE) runsPaints::second_passand paints in full;Paintssays which paints are in full, as it does for the Linux viewerresources.rsβ the binaries' own resources, written without a resource compiler (the zig cross-build has none) andinclude!d by this crate'sbuild.rsand the TUI's: the icon (duscape.ico,RT_ICONa size and theRT_GROUP_ICONExplorer reads) and the version (RT_VERSION, from the package's: Explorer's Details tab, Task Manager's name for the process, the file version an installer compares) as a.resfile forlink.exeon MSVC; on GNU one COFF object with a.rsrcresource tree, the manifest in it too (a second.rsrcobject does not link). The manifest is a resource there on both (RT_MANIFEST1), aslink.exemakes none of its own unless asked;embed-manifest, which MSVC used before 2026-10-04, is gone (Debian does not package it). Both manifests (viewers/tui/windows.manifest,duscape-windows.manifest) sayasInvoker: the program raises itself throughrunaswhen a volume wants it, never at its start.duscape.icoisduscape_viewer::iconat ten sizes, PNG-compressed and checked in;icon::tests::the_icon_file_is_the_one_drawnfails when the drawing changed and the file did not (DUSCAPE_WRITE_ICON=1writes it).src/resources_tests.rstests the writer on every platform The list is drawn as the tree (Viewer::rows): each level indentedROW_INDENT, a folder's expander (βΈ/βΎ) in theEXPANDERcolumn before its name, the "% of parent" bar from its level's indent. The treemap is drawn nested (draw_nested, after the top-level tiles and before the corner and the frames): each level a shade darker, a label where there is room, the hovered tile framed
duscape-viewer (viewers/shared/) β what the desktop viewers share, with no toolkit:
state.rsβViewer: everything the window shows and how it answers input βLayout(points; tiles in 2.4Γ6 pt cells, the treemap's 2.5 ratio, until the viewer says its pixels per point withset_pixel_scale: then one-pixel square cells,Grid::pixels(MIN_TILE_PIXELS), and the nesting'sTILE_LABELband andTILE_MARGINkept in points; every desktop viewer does, and the scale is taken at theresizeit calls with it), the entry in hand kept by name so a relayout cannot move it, the details panel following the pointer (PEEK: a tile rested on 100 ms isshownand previewed until 100 ms after the pointer leaves;peek_duesays when a viewer is to wake forpeek_tickβ the Linux loop's wait, a Win32 timer, a sleeping thread on macOS), marks, navigation, zoom, delete (delete,delete_prompt, andremovedfor a Trash), rescans (throughduscape_scan::rescan::Rescans), the status bar's words;absorb_summariestakes outline batches in without a relayout andcatch_uplays the view out for them (add_summariesis both). It keeps the TUI's rules from "Key Patterns":chosensays whether the entry in hand was picked or placed, and only a picked one seeds a Ctrl+click selection; a Shift run adds its range to the marks it started from (mark_run) and shrinks when reversed; every change to the marks copies their paths once the viewer has calledset_clipboard(Windows does; macOS and Linux copy through their toolkits and readtarget_paths). Its tests run on every platform; a behaviour the windows should share goes here first. The list can be a tree (WizTree's view,tree_view):libduscape::tiles::tree_rowskeeps which folders are open in place and makes the rows (each open folder's entries indented under it, largest first,Row::pathfrom the listed folder); the cursor is a row's path, its first name beingselected, so the board's selection follows the row's top-level entry. A mark is a row's path too (marked, aMarks: the order and a set beside it, so a painter's question of a row or tile is a lookup β passes over the marks after Ctrl+A on 87k entries were billions of comparisons a frame;is_marked_row,marked_nestedfor the nested tiles, worked out once a paint;marked_countandmarked_size, the outermost marks, kept until the marks or the rows change): a β§ range runs over the rows on show, a folder's opened in place with the rest; a folder closed takes the marks inside it off; a delete or a size takes a marked folder and not also the rows marked in it (target_rows). Until 2026-10-05 marks were top-level names, and a range among a folder's rows marked the folder. β opens the folder in hand and then goes down into it, β goes up to the folder and then closes it, a click on the expander (Hit::Expander) toggles; a nested row is what is previewed, copied, entered (down through the folders above it) or deleted. With it the treemap is nested (nested, rebuilt with the board): a tile inside a folder's (Hit::Nested) is a target like any other β a click opens the folders above it and puts its row in hand, Ctrl and Shift mark its row β and hovering one names it (hover_nested, cleared by every relayout since the tiles moved). Off by default (set_tree_view); all three desktop viewers turn it on for every scan, and a viewer that does not draw depth sees the flat listing and the flat tiles. At the root of a volume the volume's free space is on the board too (free_space, on by default;toggle_free_space;Board::set_free_spaceat each relayout, the free and used bytes asked ofos::volume_freeandos::volume_usedafresh since a delete frees some; the unscanned share is the used less what the scan has found, none where it found more, and counted on disk whatever size is shown, since the volume counts blocks):free_togglegives the words and state of the toggle every window draws atLayout::free_toggle, the path bar's right, while the root of a volume is shown and nowhere else; the free tile isFREE_SPACE_COLOR, the unscannedUNSCANNED_COLOR(board_color), and bothHit::Nothing(set_volume_free_sourcestands in for the OS in tests)state/tween.rsβ tiles sliding (TWEEN, 200 ms, keyed by path) from one steady layout to the next:set_animationturns it on, and a viewer that does callsanimateonce a frame whileanimating. Off by default; only the macOS window drives it (DUSCAPE_ANIMATE=1;DUSCAPE_NO_STEADY=1there turns the steady layout off, for comparing). A zoom or a change of scale ends a slide first (before_zoom), since the board is laid out again under it. Tiles keep their labels while they slide β without them the motion is unreadable, and during a scan the tiles slide nearly all the time β so a viewer that drives it draws labels as when still (10.9 ms a sliding frame on~on macOS). Folders are painted whole while sliding (their insides taken off) and the second pass snaps the slide to its end, which is why the Windows and Linux windows, whose second pass runs afterIDLE, do not drive it yeticon.rsβ the app's icon, drawn by the treemap: a folder of three files beside five more, squarified at the size asked for (so sharp at every size) in the tiles' colours, round cornered from 24 px;rgbafor a window system that takes pixels,pngfor one that takes a file's bytes (image's encoder, fast: 512 px in 4.5 ms at macOS's start-up; the checked-in.icoholds its best-compressed images). A placeholder until a drawn one. Windows sets it on the class and withWM_SETICON(win::app_icon, atSM_CXICON/SM_CXSMICON), and the.exes carry it as a resource (viewers/windows/resources.rs); X11 as_NET_WM_ICON(16β128 px); macOS as the application icon image (Dock, switcher), set once launching is done, andDuscape.app's file icon,viewers/macos/duscape.icns(icns, checked in and tested like the.ico;make mac-appcopies it,Info.plistnames it). Wayland takes it from the.desktopfile of the window's app ID:packaging/linux/icons, the PNG files atHICOLOR_SIZES, tested the same way.APP_ID(lib.rs,io.github.angch.duscape) is that ID, the Wayland app ID and X11 class the Linux window sets, and the name of every file inpackaging/linux(tests/packaging.rsholds them to it and the metadata's newest release to the version)passes.rsβ a layout's paints, first in a hurry and then in full, for every viewer:LABEL_DEADLINEandLabelBudget(which tiles a paint has time to label),Paints(which layout was painted in full, whether a second pass is owed, andsecond_pass, what a viewer runs once input has stopped forIDLE). A viewer only draws, and wakes afterIDLEmenu.rsβ the context menu every desktop viewer opens on a right-click:Viewer:: context_menu(&Platform)gives itsEntrys (anAction, the words, whether it can be chosen) for what is targeted, the counts following the marks;Platformsays what the viewer adds (the file manager's name, Quick Look, Copy as Pathname, a Trash). A viewer draws the entries (Win32TrackPopupMenu, anNSMenu, the Linux viewer'sdraw::menu), adds its own key hints, and carries out the action chosen; an item offered on one window is offered on all.open_in_handis Open: a folder goes in, a file's path comes back to be openedchooser.rsβ a window opened with no folder, or the path bar's button (Layout::chooser_button, at its left):Chooser, the volumes (each with how full it is), the home folder and, where the viewer has one, the folder dialog (Target::Dialog); opened over a scan,with_cancelends it with a Cancel row (Target::Cancel) back to that scan, which Esc takes too (cancellable), where opened with no folder Esc closes the window. Laid out as rows in points (layout,hit,hover_at,arrow,words); each window draws the rows and starts the scan on the target chosen β Windows through its elevation prompt (scan_chosen, which stops the scan shown and numbers the new one so a replaced scan's reports are dropped, as macOS and Linux do), macOSshow_chooser/choose_row, LinuxApp::choose_rowdeleting.rsβ a delete on a thread of its own (Deletion, throughViewer::start_delete,deleting,cancel_delete,delete_done), its box's words and layout in points (DeletionLayout), and what failed as aFailure; every desktop viewer draws the boxscan.rsβ the first scan with the liveOutline, results through callbacks on the scan's thread;preview.rsβ the latest-wins preview reader (pictures are handed over as bytes for the viewer to decode:NSImageon macOS, theimagecrate on Linux; a binary file as its description and hex dump,Loaded::Binary)
duscape-linux (viewers/linux/) β the Wayland and X11 viewer, pure Rust, no C library
(not libwayland, not Xlib), so it builds static for musl and runs on any compositor or X server:
backend.rsβ theBackendtrait (present a canvas, set the title, own the clipboard, move/ maximise/minimise for the app's own title bar) andInput, what either windowing system reports, in points;keyshas the non-character keysyms both speak;level_keysympicks the shifted level (Caps Lock only on letters);openchooses:DUSCAPE_BACKEND, else Wayland whenWAYLAND_DISPLAYorWAYLAND_SOCKETis set, else X11, trying the other if the first failswayland.rsβwayland-client's pure-Rust protocol: the compositor byconnect_to_env(WAYLAND_SOCKET, elseWAYLAND_DISPLAYunderXDG_RUNTIME_DIRor a path), elsewayland-0there as libwayland defaults whenWAYLAND_DISPLAYis unset andwayland-client0.31 does not (default_socket, tested);wl_shmdouble buffers in a memfd,xdg_shell(configure βInput::Resized, close),xdg-decorationasking for a server title bar and reportingInput::Decorated(false)where there is none,wl_seatkeyboard (xkb keymap byxkb, repeat done here since the compositor leaves it to clients) and pointer (cursor from the theme viawayland-cursor; discrete or smooth wheel),wl_output/preferred_buffer_scalefor the scale,wl_data_deviceoffering the clipboard with the last input serial. Events are dispatched on a thread of their own; the app thread sends requests to the same connectionxkb.rsβ reads the compositor's xkb keymap text:xkb_keycodesnames β codes (aliases too) andxkb_symbolsfirst-group levels β keysyms, by name; keys it lacks fall back to a US layout by evdev code, keys it has but cannot name mean nothing. Tested against a keymap dumped byxkbcomp(xkb_test_keymap.xkb)x11.rsβX11onx11rb: the display opened x11rb's way (the socket file, then TCP), else by the Linux abstract socket of the same name (abstract_socket, with the.Xauthoritycookie), which x11rb never tries and Xlib tries first β a user's own Xorg (Chrome Remote Desktop's,-nolisten tcp) cannot make the file in root's/tmp/.X11-unixand listens on the abstract name alone, so every client worked there but this one; andunix:20, Xlib's spelling of a local socket, which x11rb reads as a socket's path.connects_where_the_file_is_missingkeeps it. Then the window, its properties and size hints, the events (read on a thread of their own intoInput), the frame put up whole withPutImage(re-encoded only for an unusual visual), the core keyboard mapping, and the clipboard: when nowl-copy/xclip/xselis installed the window ownsCLIPBOARDitself and answersSelectionRequest. The scale (pixels per point) isDUSCAPE_SCALE, elseGDK_SCALE, elseXft.dpi/96, read again when the root'sRESOURCE_MANAGERproperty changes (xrdb, a desktop's scaling setting) and reported as a resize at the new scale: X11 has one DPI for the server, so that change is what moving to another display amounts to; a monitor's RandR millimetres are not trusted. Wayland's scale followswl_surface.enter/leave,preferred_buffer_scaleand each output'sscale, an unplugged output forgotten. The window has no background and north-west bit gravity: with a background pixel and forget gravity the server cleared it at everyConfigureNotify, a near-black flash a pixel of a slow drag on the resize handlecanvas.rsβ the software framebuffer in points: fills with alpha, gradients, strokes, anti-aliased rounded rectangles, andblit(a picture fitted by box-filtering)font.rsβFonts::systemfinds the sans, bold and mono faces throughfc-match(else well-known paths, elseDUSCAPE_FONT*);Facecachesab_glyphglyphs by character and quarter-pixel size, sized by the em as every toolkit is (ab_glyphscales by the line height:em_to_height;fontduebefore 2026-10-04, which Debian does not package β a snapshot differs by anti-aliasing alone, at most 21 levels in 255);Pendraws into a rect, aligned, vertically centred, cut with "β¦"draw.rsβ the frame, byLayout: the same panels asmac/draw.rs, in a fixed dark theme β the list as the tree (rows: each level indentedROW_INDENT, a folder's expander whereViewer::hitlooks for it), the treemap nested (nested, after the top-level tiles and before the marks, the corner and the frames), a tile's label its name at the left and its size at the right (tile_label; a file's size at the bottom right when there is room);dialogpaints the confirm/notice box and returns its buttons for clicks;title_barthe app's own title bar (Viewer::top_inset,Layout::with_top) where the compositor draws nonetrash.rsβ freedesktop Trash:gio trashif present, else~/.local/share/Trashor.Trash-<uid>at the filesystem's top, with the.trashinfoapp.rsβ the loop over onempscchannel (Msg:Inputfrom the backend, scan batches, the finished tree, rescans, decoded previews, ticks, snapshot), draining what has piled up before one redraw β outline batches are absorbed as they come and laid out once for the lot (outline_behind); keys and mouse βViewercalls likemac/view.rs's (a click on an expander toggles beforeclick, the wheel over the treemap zooms, the back button goes up);Dialogfor asking before a removal; the title bar's buttons, drag and double-click β the backend. The second pass (Paints::second_pass) runs once nothing has changed on screen forIDLE, a message that changes nothing not putting it off, as the Windows timer is put off by each change.DUSCAPE_SNAPSHOT=out.pngwrites the frame after the scan and quits β how the drawing was checked here: X11 on anXvfb(-listen tcp -ac, from before the window could reach an abstract socket; a plainXvfbdoes now) withxdotoolfor keys and clicks; Wayland on a headlessweston --backend=headless-backend.so --shell=kiosk-shell.so, unpacked from its .deb, withweston-screenshooter(it has no input to inject, so keys are covered byxkb's tests)
duscape-mac (viewers/macos/) β the AppKit viewer, on objc2/objc2-app-kit, over
duscape-viewer:
mac/view.rsβ the oneNSView: events, menu commands, dialogs, Trash, pasteboard, Finder, Quick Look, drag and drop. Other threads come back throughon_main(the main dispatch queue). TheVieweris in aRefCell; never hold a borrow across a modal (NSAlert::runModal, the open panel), which runs the event loop inside the call.DUSCAPE_MAC_SNAPSHOT=out.pngwrites the view to a PNG after the scan and quits β how to look at the drawing without screen accessmac/appkit.rsβ AppKit loaded when the window starts, not whenduscapedoes: both binaries link with-dead_strip_dylibs(build.rs) and name no framework symbol, since objc2 finds classes by name, soload(first inrun_with)dlopens AppKit and QuickLookUI and AppKit's data constants (attribute names, pasteboard types, font weights) are read bydlsym. Linked, the terminal viewer loaded fifteen frameworks at every start (cold: 0.41 s to--version, now 0.07). Take a new AppKit constant through it, never by itsobjc2-app-kitstatic, or the frameworks come back:otool -L target/release/duscapelists libSystem and libobjc alone. The debug build keeps AppKit in its load commands anyway, sosmoke.shruns the releasemac/script.rsβDUSCAPE_MAC_SCRIPT: synthetic keys, clicks and menu choices posted to the app's own event queue, andstatedumps to assert on.tests/smoke.shruns one on a fixture; run it after changing the viewer (macOS, logged-in session, no permissions needed)mac/draw.rsβ painting, byLayout: the same tree, nesting and labels as the Linux viewer'sdraw.rs;mac/mod.rsβ the app, delegate, menus, window. Inmac/view.rsa click on an expander toggles beforeclick, a mouse's wheel (not a trackpad's) or a pinch over the treemap zooms, the back button goes up, and outline batches are laid out once per burst (outline_behind, a catch-up queued behind the batches waiting on the main queue)
MS-DOS (viewers/dos/) β FASM, real mode on a 286 (or 186) with no coprocessor, not part of
the Cargo workspace:
DUSCAPE.ASM (the program), PANEL.ASM (side panel), PREVIEW.ASM (text and half-block
pictures, the six adaptive DAC colours), PNG.ASM and JPEG.ASM (decoders; a JPEG block's mean
is its DC coefficient, so no IDCT), PVDATA.ASM (their data), SOFTFP.ASM/FPDATA.ASM (IEEE doubles in software, unpacked,
rounded after each operation), J286.INC (conditional jumps as short-or-inverted macros). No
32-bit register, FS/GS, 386 or x87 instruction, and no dd/dq variable (FASM makes 32-bit
code for those unasked): python3 viewers/dos/tests/lint286.py must say so, and test.py runs
everything on an emulated 286 without an FPU. 16-bit addressing has no [si+di], and [bp+β¦]
is in SS. A port, not a binding: the squarify layout, RectFloat::round,
Board navigation, the tile text and the size formats are rewritten from common/ and the TUI's
grid/, so a change to those should be carried over by hand. make dos fetches FASM and CWSDPMI
into target/dos/ (hash-checked) and assembles inside DOSBox-X; make dos-run opens the repo as
C:. -k KEYS -s FILE types keys and writes the screen and tiles; python3 viewers/dos/test.py
runs the checks on fixtures that way, the layout ones against TreeMap through viewers/dos/tiles
(a crate outside the workspace). Run it after changing the DOS viewer. DOSBox-X loses long-name
search entries when two searches are open, so each folder is listed to the end before its
subfolders are walked (a pending stack in its own segment), and the delete queues its entries the
same way; keep it that way. Do not set attributes on host files needlessly: DOSBox-X stores them in
.DBLOCALFILE_ATR_* files beside them. Decoding runs with ES = the line segment and FS = the
window: a rep stos/movs into DS there must set ES first, and a table in the code segment is
read through cs:.
duscape (viewers/tui/) β the ratatui viewer:
issues.rsβ--issues: a scan with nothing drawn (parallel::build_tree, as the app scans), thenduscape_scan::environmentandFileTree::issues' report on stdoutfront.rsβ which viewer thisduscapeis:choose(pure, tested) on the arguments andStartedβ--tui/--gui;--benchmark,--issues,--help,--versionthe terminal's; a name ending-gui/-linux/-windows/-macthe window; then a terminal on stdin or stdout is the terminal viewer (so a redirected benchmark stays one), neither with a display the window, and on Windows no console, or one the process has alone (GetConsoleProcessList), is Explorer's start: the window, afterFreeConsole.windows.manifest, embedded bybuild.rs(a resource,viewers/windows/resources.rs; bins only,guifeature), setsconsoleAllocationPolicytodetached, so from Windows 11 24H2 Explorer makes no console at all and nothing flashes; older Windows ignores it and makes one, which is let go. The terminal viewer with no console (--tuifrom a shortcut) gets one (ensure_console,AllocConsole).lib.rs'srundispatches: the window gets the sameOpt, parsed once (Opt::scan_options, the folder,--no-elevate), not the config file. The executable is console subsystem, or the terminal viewer would have no stdin;duscape-windows.exealone keepswindows_subsystem = "windows". The window's elevated relaunch passes--gui(elevate::relaunch_args), since the program relaunched may be this onemain.rsβ entry point, thread spawning, channel setupapp/mod.rsβAppstate machine,UiModeenum, render dispatchinput/controls.rsβ per-mode keypress handlersmessages/instruction.rsβInstructiondispatch toAppmethodsui/display.rsβ ratatui rendering orchestrationui/grid/β the treemap (RectangleGrid): the board's tiles, the nesting inside them (nested, laid out inui/display.rsbyNESTINGand cached byBoard::generation), the "small files" corners (β«,SMALL_FILE, one cell wide in every terminal), and the frames of highlighted tiles, drawn last (frame_on_grid)ui/highlight.rsβhighlight: how the entry in hand and the marks look, one rule for the list and the treemap (see "Colours")ui/side_panel.rsβ the list left of the treemap;screen_areassplits the screen (a third to the panel when β₯ 80 columns) andentry_atmaps a cell to a row β used by both the renderer and the mouse, so they cannot disagreeconfig/mod.rsβ TOML config (~/.config/duscape/config.toml)preview.rsβ the preview thread (debounce, thenlibduscape::preview), and kitty/sixel graphics output (Graphics:KittyGraphicswrites after each frame, only on change;q=2so the terminal never answers on stdin,z=-1so dialogs cover it).SixelGraphicshas nothing to delete a picture by and the frame never redraws cells it thinks blank, soprepare(before the frame) erases the old picture's cells when it changes; text over a sixel destroys it, so it is hidden while a dialog is up (stays_under_text), andclearedforgets it when a resize clears the screen. The encoder is a median-cut palette of 256 and the picture is cut to whole 6-pixel bands so none spills into the next row.side_panel::screen_areassizes the preview 16:9 from the cell pixel sizeDisplaymeasures each frame (else theCSI 16 tanswer,queried_cell_pixels).graphics_protocoldecides once: env vars (kitty, Ghostty, WezTerm; tmux never kitty), else a graphics query +CSI 16 t+ DA1 read straight off stdin β what finds it over ssh; sixels are DA1 attribute4(tmux answers for itself). Where nothing can be asked (Windows) Windows Terminal, foot, mlterm and iTerm2 are taken as sixel by name (WT with its fixed 10Γ20 sixel cell, since the console reports no pixels). It must first run in raw mode before any thread reads stdin (try_main).pictures()picksPictures::Kitty,Sixel,Blocks(the fallback:βcells the previewer colours asPreview::Blocksandside_paneldraws into the frame) orDescribedclipboard.rsβlibduscape::clipboard::copy, else the terminal's OSC 52; paths are quoted bylibduscape::format::quote_path_for_shellbefore they get therecli/mod.rsβ clap CLI args
Loading // Scan in progress
Normal // Main treemap view
ScreenTooSmall // Terminal < 50Γ15
DeleteFiles(Vec<FileToDelete>) // Confirmation dialog: the marked entries, or the one in hand
ErrorMessage(String) // Error display
Exiting { app_loaded: bool }- Multi-selection:
App::markedholds names in the order picked;mark_rangeis a Shift run's anchor and the marks it started from, so reversing shrinks the range. Every change callscopy_marked, which reuses right-click'sshell_path. Plain moves, jumps, clicks and folder changes clear it.cursor_chosensays whether the entry in hand was picked (plain click, arrow, jump) or placed by the app (a folder's top row, a deleted entry's neighbour); only a picked one seeds a Ctrl+click selection, sodnever deletes an entry nobody chose.ddeletes every marked entry (get_files_to_delete), continuing past failures and naming the first. - Help line: an endless strip, legend and tips alternating (
ui::bottom_line::Strip). It restsREST(5 s, from arrival or the last key, whichever is later) at each stop β one per segment, or a page at a time for one wider than the screen β and slides to the next inSLIDE(80 ms, eased), so every move finishes within 100 ms. The position is kept within a segment (Ticker), so a legend that changes length (scan done) does not make what is on screen jump. Keys named in it come fromKeybinds, never literals. It ticks at frame rate only while it slides, and twice a rest otherwise (App::ticker_pace): 60 fps where something moves, next to nothing when idle. - Colours: no dark gray (unreadable on black) and no magenta on the light cursor bar. The
list and the treemap highlight by one rule,
ui::highlight::highlight: in the panel with the keyboard the entry in hand is a bar, white on blue for a folder and black on gray for a file; in the other it is white, bold and underlined, with no bar; marks are black on yellow either way, underlined when in hand too. A highlighted tile's border takes the same colours.side_panelandgridtests assert them. - Focus: the list has it by default (
Focus::List;list_cursor: Nonemeans its top row, and while the list has focusrendersyncs the treemap's selection to it).App::focussays which panel the keyboard drives; it follows the last click, Tab, and Left off the treemap's left edge, and is alwaysTreemapwhile the panel is hidden. In the desktop viewers that is derived, not set (Viewer::focus(): the panel last chosen, the treemap while the layout has no list), so a window narrowed and widened again, or minimised, gives the list back. The list's cursor is kept by name (the listing re-sorts during a scan); moving it selects the entry's tile, or nothing if it has none. Enter, Esc and delete go throughselected_entry, so an entry without a tile can still be acted on. - One listing, two views:
Board::listingis the folder's entries, largest first, unzoomed, sorted once perchange_files; the side panel draws it every frame without re-sorting. Clicks are keyed by entry name, so a tile and a list row are the same target, and an entry with no tile can still be entered or copied. - Render-on-demand: Render only when an
Instructionarrives; no continuous loop. Every frame is one something asked for, so the frame budget is spent on changes, not on repainting what is there; the desktop viewers likewise paint on a change, and drain what has piled up before painting once for all of it. - Live treemap update: while scanning,
Boardrecomputes tiles from a folder-only outline (OutlineβFileTree::add_summary) β every folder toOutline::DEFAULT_DEPTHwith a running size, shared blocks counted in full, deeper directories rolled up into the frontier folder above them. Files, and folders below the frontier, appear when the finished tree replaces the outline (App::finish_scan). Keep the outline O(visible): the first version sent every directory and saturated the rendering thread, which back-pressured the dispatcher and slowed the walk. This is the goals' time to first paint: the treemap is up in the first batch, coarse, and filled in as the walk goes. The desktop viewers' outline sends what it has every frame as well (Outline::flushing_every(scan::FRAME)), and a window lays the view out at most once a frame (OUTLINE_TIMER,outline_behind), so the live view moves at the frame rate and a scan never crowds out input. A folder entered during the scan is followed (scan::Focus, set byApp::render_and_update_boardandViewer::relayout): the walkers read toward it before anything else, the outline is exempt from its depth cap under it and carries the folder's own files, and the treemap says "Scanning this folderβ¦" rather than "empty" while there is nothing to draw (the outline holds no files, so a folder of files alone looks the same as one not read yet until the finished tree arrives). - Parallel build, no shared memory: each builder owns a tree; correctness rests on
HardLinks::chargebeing order-independent, so deferring every charge to one final replay gives the same per-folder sizes as charging inline. Tested folder-by-folder against the inline tree (model::tests::sharded). Shard bySHARD_DEPTHpath components, not the whole path β seedocs/scan-performance.mdfor why the merge otherwise costs more than the parallelism saves. The point is the goals' fast walker: the build is hidden behind the walk instead of following it, so the scan takes the walk's time and no more. - Two sizes everywhere:
EntryMetacarriessize(on disk) andapparent(length); every walker fills both.model::Filestores disk asu64plus apparent as ani32difference (FileSizes::Farboxes both when they are β₯ 2 GiB apart), keepingFileOrFolderat 16 bytes β asserted inmodel::tests; do not grow it. Folders holdsizes: Sizes.FileTree::shownandBoard::showpick which is displayed; the ledger charges both kinds to the same ancestors and identifies files by the disk size.ScanOptions::show_apparent_sizeonly sets the initial view. - Sizes are not additive: a folder's size counts each distinct set of blocks once, so hard
links, XFS/btrfs reflinks and APFS clones all make it smaller than the sum of its entries. See
docs/scan-performance.mdanddocs/sizes.md(what is still counted twice: a file sharing ranges of another, as Preboot's cryptexes share their image's). - Zoom as filter: Zoom level controls which nested folders are rendered.
- Modal via enum:
UiModevariant change = modal open/close; no separate stack. - Config merging: CLI
--apparent-sizeORs with config file setting. - Graceful degradation: Read errors counted but scan continues. A failed directory read ends that directory rather than retrying it β the error belongs to the descriptor, not the entry.
- Per-filesystem attributes: a returned-attributes bitmap says an attribute is present, not
that its value is real.
msdosfsclaimsATTR_FILE_ALLOCSIZEand packs zero, so the size attribute is chosen per device. Seedocs/scan-performance.md. - Pseudo-filesystems: crossing a mount point into
/proc,/sys, cgroup, debugfs and friends is refused (bystatfsmagic); naming one as the scan root still scans it. - Loops: a mount of a directory inside itself, or of one above the scan inside it, is one of
its own ancestors, and walked holds itself again (Synology's
/volume1/@docker, a folder mounted onto itself, is not one: thesynologyfixture scenario lays out a real DSM mount table and passes with this check disabled). At every mount root or crossing β only a mount can loop, Linux having no directory hard links βlinux::loops_backstats the ancestors up to/and compares device and inode; a match is not walked, and is noted (DirEntries::note, kindloop: in--issues, not in the failure count).walk_would_enterrefuses such a folder to a rescan. -xon btrfs: the boundary is the filesystem, not the subvolume (linux::same_filesystem: the same device, or btrfs with the root'sextent_space, the filesystem's UUID hash). Every subvolume has its ownst_dev, so by device-xstopped at each β every Synology share. Deliberately unlikedu -x.- Snapshots: a read-only btrfs subvolume inside the scan is left empty by default, as a mount
-xrefuses;--snapshotswalks it, the extent ledger counting what it shares once. Named as the scan root, it is scanned. Over the network a share shows its snapshots as plain folders (Synology's#snapshot, QNAP's@Recently-Snapshot, ZFS's.zfs, NetApp's.snapshot): every walker leaves those empty by name (libduscape::nas::left_out, aleft outnote in the directory,walk_would_enterrefusing a rescan of one), and--snapshotswalks them. A recycle bin (#recycle,@Recycle,.recycle) and the NAS's other folders (@docker,@eaDir,.@__thumbβ¦) hold space and are walked;nas::describesays what each is, in the status line of every viewer. Over the network no walker can see a snapshot's blocks shared with the live file's, so at a volume rootFileTree::counted_beyond_volumeβ the scan's total over the volume's used space β is what says they are, in the status line and the panel; it says "shared or compressed", since unprivileged btrfs sizes are uncompressed too. What of the volume the scan did not find (outside_scan, the windows' "Not seen by the scan" strip) is not said for a share (duscape_scan::is_network: Linux by its filesystem, macOSMNT_LOCAL, Windows a UNC path or a remote drive;FileTree::on_network, the viewer'snetwork_root): the volume is the server's, and the rest of it the server's other shares. The rule itself isDirEntries::leave_out(noted only where the walk would have gone down), and the MFT reader asks it as the kernel walkers do. Under a folder whose snapshots are left out β one listing a snapshot folder by name, or under an ancestor that does (nas::snapshots_left_out_among,snapshots_left_out_above, asked once a scan for the root's ancestors, so a rescan agrees with the scan) β the Linux walk does not probe shared extents at all: every extent there is shared with the snapshots, which are not counted, and on a Synology's kernel 4.4 the FIEMAP probe cost 0.5β1.7 ms a file, 80β90% of the walk (/volume1/homes, 200k entries: 2.0 s β 0.2 s;--issuesnotesnot probed). A reflink pair inside such a share counts twice, once each;--snapshotswalks the snapshots and probes again. Thesynologyfixture asserts both. - Bind mounts: a mount root (
STATX_ATTR_MOUNT_ROOT) is looked up in/proc/self/mountinfobystx_mnt_id(linux::mounts); if an earlier mount of the same device shows the same directory at a path inside the scan β checked by device and inode β the mount is left empty. - btrfs compression (root only):
linux::btrfs::extents::on_diskreads a file'sEXTENT_DATAitems withBTRFS_IOC_TREE_SEARCH_V2on the directory fd (tree 0 = its subvolume) and sums what they occupy; it replacesstx_blocksas the disk size. Gated byfilesystem::Compressed(decided per mount:Maybeif the superblock options saycompress,MarkedforSTATX_ATTR_COMPRESSEDfiles only,Neverif not btrfs or not permitted), since it costs ~1 Β΅s a file. The FIEMAP identity pages through long extent maps (compressed files have one extent per 128 KiB). - The saved scan (macOS): the walk cannot be made faster than the kernel's floor there
(
docs/scan-performance.md, "macOS: what is left"), so every scan after the first starts from the last one's saved stream, in three steps that follow the goals' rule (coarse now, complete after): shown as it was, streaming from the file, the first directory in milliseconds (Cache::Saved,SavedStream); caught up behind that by a whole-tree rescan throughCache::CatchUp, the FSEvents log naming the folders that changed and only those listed again, the new tree swapped in asR's is; filled in after that, the folders the file had trimmed listed again, the one in view first (fill.rs). The file keeps folders, hard-linked files and files of a megabyte and up; a folder's smaller files travel as one sum (Unlisted, held byFolder::unlisted), so every size is right from the first frame and only the small tiles arrive with the fill. Whatever walker ran, the stream is recorded as it goes, stamped with the log's id from before the walk started, so a change made during it is replayed next time. Not a cache of the tree: the tree is built from the stream as on any scan, so the ledger charges hard links as it would have. The stream's order β parent before child β is the file's order, and what the replay keeps - The idle passes (
Rescans::start_idle, called by every viewer when a tree lands and whenever a rescan reports): once nothing replaces the tree, a catch-up's fill (owed once per catch-up,fill_owed: a folder that will not list keeps its sum, and a fill started whenever one was left would never stop), then the volume's local snapshots β named at once, read as root behind that. The snapshots' folder is the last pass because it is the slowest (a walk a snapshot) and the least asked for. - Two passes: the walk probes shared extents only from 64 KiB; smaller files are noted in
DirEntries::laterand probed after the tree is shown (see therefine_Nthread). The benchmark'srefinedstage is walk + second pass, and is what the fixtures measure. This is the pattern the goals ask of every costly feature β coarse now, complete after: the probe costs more than it changes, so it waits until the tree is on screen, the folder in view first. The window's deeper nesting, its specks and its first paint's labels (Viewer::defer_to_second_pass,LABEL_DEADLINE) follow it. - Network filesystems: refused the same way, whatever
-xsays β NFS, SMB, 9p, Ceph, AFSβ¦ by magic (linux::filesystem::NETWORK), and FUSE by its subtype in/proc/self/mountinfo, found bystx_mnt_id(NETWORK_FUSE: sshfs, rclone, s3fsβ¦), since FUSE also serves local filesystems. macOS skips a mount point withoutMNT_LOCAL. Another machine's files are not this disk's space. - ManuallyDrop on FileTree: Avoids slow recursive drop on exit: freeing millions of nodes is
work nobody waits for, so quitting is immediate; the TUI leaks a replaced tree, a desktop
viewer hands it to
drop_later's thread. - Threads are not joined at quit: the TUI's
startlets its threads go when the app's loop ends, and the process's exit ends them. Joined, a quit during the scan waited for the walk to stop (a worker checksstopbetween directories, so each finished the one it was in, cold, astatxat a time) before the terminal was restored: up to 4 s on/. The desktop viewers never joined theirs. What a quit still waits for is the kernel: a thread blocked in a disk read (D) ends only when the read does, so the process lingers a few tenths of a second after the terminal is back β checkingstopmore often would not shorten that. - Folders know their ledger id:
Folder::diris the folder inHardLinks, given when a directory's path is first resolved (HardLinks::child(parent), no hashing) andNONEuntil then. Deferred sightings carry ids, not paths; a merge renumbers the folders it moves in (Folder::renumber, remapping the other tree's sightings) and so does a graft. Interning by path was 0.7 Β΅s a directory and a third of the ledger's time β see "The tree build" indocs/scan-performance.md.--benchmark --bench-profileshows the build phase by phase.
| Action | Key |
|---|---|
| Quit | q |
| Delete | d |
| Navigate | h/j/k/l or arrow keys |
| Enter folder | Enter |
| Go to parent | Esc |
| Select tile | left click |
| Enter folder | double-click (same tile, within 500 ms) |
| Switch list / treemap | Tab (β off the treemap's left edge, β from the list) |
| Jump through list | PgUp / PgDn / Home / End |
| Mark a range (copies) | Shift+β/β in the list |
| Mark / unmark (copies) | Ctrl+click, either panel |
| Mark a range (copies) | Shift+click, either panel (where the terminal reports it: most keep it for selecting text) |
| Copy relative path | right-click |
| Copy absolute path | double right-click |
| Zoom in/out | + / - |
| Disk usage / apparent size | a (no rescan) |
| Rescan selected folder / everything | r / R (not during the first scan) |
| Reset zoom | 0 |
| Confirm | y |
| Cancel | n |
- Every fence has its reason written down, so it can be taken down. A decision that is
not obvious from the code β a constant's value, a call left out, an order kept, a branch
that looks redundant, a walker that declines, a limit, a gate, a check β is a fence in a
field (Chesterton's). The point of writing down why it stands is not to keep it standing:
it is that when the situation changes (a kernel gains the call, the disk is faster, the
format grows a field) whoever finds the fence can see at once whether its reason still
holds, and remove it without fear if it does not. A fence with no reason recorded can
neither be trusted nor removed. So the reason lives where it cannot be lost: as a test
that fails when the decision is undone (preferred, since it cannot go stale β
nothing_ changed_replays_the_saved_scan_whole,the_icon_file_is_the_one_drawn, the fixture oracles,model::tests::sharded's per-folder comparison), or as text beside the code (a comment saying what was tried and what it cost, or a dated section ofdocs/scan-performance.mdwith the numbers β "What did not work: opening directories relative to their parent", the six-worker table, the-x-on-btrfs rule in "Key Patterns" above). A negative result is recorded like a positive one, so it is not tried twice (docs/scan-roadmap.md, "Not worth revisiting"). What counts as recorded: a reader who did not write it can say what breaks if the code goes back to the simple thing. A change that removes a fence says, in its commit, which reason it found written down and why it no longer holds; one that finds a fence with no reason recorded writes the reason down first, or the test, then decides. This is the file's own rule: its "Key Patterns" and the crate map are those reasons, kept where every agent reads them. - Error handling:
thiserrorderives;?propagation; distinct error enums per crate boundary. - Testing:
#[cfg(test)] mod testsin same file; temp dirs via helpers; setup β action β assert. - Concurrency: Named threads; bounded channels;
park_timeout(100ms) for polling. The thread model is what keeps the drawing thread free (see its "Why"), so new slow work gets a thread or a second pass, never a place in a frame. - Exports:
pub usere-exports inmod.rsfiles. - No async runtime: Threads + channels only.
- Cross-platform: Linux, macOS, and Windows supported. Windows consoles report key releases
as events;
TerminalEventsdrops them, so handlers only ever see presses. It drops mouse movement, drags, releases and scrolls too (is_mouse_noise): mouse capture reports every movement, and the warning modal closes on any event. CI runs on Linux only β check other targets withcargo clippy --workspace --all-targets --target <triple>. The BSDs have no native walker: they scan with the portable walk (portable.rs). The Linux window is gated to Linux and FreeBSD and type-checks forx86_64-unknown-freebsd, but has never been run there; say so rather than claim BSD support. - musl: the release is built for musl, and
libctypes differ there.ioctl's request isc_ulongon glibc butc_inton musl, so request constants arelibc::Ioctl. CI testsx86_64-unknown-linux-muslon every push (test-musl). - Docs per platform: a module exists on its platform alone, and so do its docs and its
links: a doc comment in code every platform compiles names another platform's module only in
a
#[cfg_attr(target_os = "β¦", doc = "β¦")]line (scanners/src/lib.rs's walker list andscan_directories,cache.rs's FSEvents), so Linux's docs never mention the macOS walker. A public doc does not link a private item: the item is made public if it is part of what the doc explains (Places::LINES, the treemap'sSTEADY_*,portable), else the pointer goes in a//comment rustdoc does not read (windows.rs'slinks,macos.rs'simage_left_out). The doc job runscargo doc -D warningsfor Linux, Windows and macOS. - Byte order: what a filesystem stores is little-endian on every machine β ext4, NTFS, btrfs β
and is read with
from_le_bytes; only what the kernel fills in itself (an ioctl's own structs, such as btrfs's search header) is in the CPU's order,from_ne_bytes. Mixing them up passes on x86 and fails on big-endian s390x: btrfs's extent items were read in the CPU's order until 2026-10-04 (11.6 exabytes for 108 KB). CI is x86 alone, sodocs/probes/cross-arch-tests.shruns the core and scanner tests on i686, armv7 and s390x under QEMU, no root; run it after touching a parser (docs/packaging.md).
- Add field to
KeybindConfiginviewers/tui/src/config/mod.rs - Add parsing in
viewers/tui/src/config/keybind.rs - Add to
Keybindsstruct and wire ininput/controls.rs - Update
example/config.toml
- Add variant to
UiModeinapp/mod.rs - Add
handle_keypress_<mode>()ininput/controls.rs - Add render arm in
ui/display.rs - Wire
Instructionvariants inmessages/instruction.rs
- Add field to
ScanOptionsincommon/src/scan/mod.rs - Thread it through every walker in
scanners/src/:macos.rs(macOS),linux.rs,windows.rs, andportable.rs(everywhere else, onstd::fs). The portable walk is selected only off Linux, macOS and Windows, so there it is only ever run by its tests and the benchmark'sportable-*stages β do not assume compiling it means it works. - Expose via CLI in
viewers/tui/src/cli/mod.rsand config if persistent - Add a
--benchmarkstage if it changes how the walk performs
make test-fs (root or the docker group) makes ext4, XFS, btrfs, f2fs, tmpfs, FAT32, exFAT and
NTFS on loopback images, fills them with hard links, sparse files, reflinks, snapshots and
compression, builds mount layouts (nested, proc, tmpfs, bind mounts, loopback NFS,
fuse.rclone), runs both test suites on
each with TMPDIR there, and checks totals against oracles that share no code with duscape.
See fixtures/fs/README.md. Any change to the walkers, EntryMeta, the hard-link/reflink ledger
or mount handling must pass it, and a behaviour that depends on the filesystem or the mount table
gets a fixture there. CI runs it (fs-fixtures.yml). Remember: every btrfs subvolume and snapshot
has its own st_dev and f_fsid β never key anything cross-file on the device alone there.
Test against FAT as well as APFS β it is the filesystem that misreports. docs/scan-performance.md
has the FAT section, and the volume test is:
cargo test -p libduscape --lib -- --ignored fat32The walk is the first of the performance goals β the time to first paint starts with it, and
the whole scan is the walk wherever the build hides behind it β so a change to it is measured,
not reasoned about. Read docs/scan-performance.md first, and docs/scan-roadmap.md for what is planned and the
rules each step follows: measure with docs/probes/bench-matrix.sh before and after (it writes
docs/benchmarks/<host>-<date>.md; commit it), totals identical, fixtures green. It records what was measured, what turned out not to
matter, and how to reproduce the numbers with --benchmark. The short version: on Linux the walk
is the floor (~0.40s for 4.2M entries, at the kernel's statx cost) and the tree build is hidden
behind it on parallel::SHARDS threads. On macOS and Windows the walk is the whole scan β macOS
waits on 4 KiB metadata reads and is fastest at six workers β so SHARDS is 1 there and any
serial work after the walk shows directly in the scan time. --bench-stage sharded is the app's
path; pipeline is the single-threaded build it replaced. Those are warm numbers. Cold (caches
dropped) the walk is bound by reads in flight, one directory's inode and blocks per blocked
worker, which is why Linux runs three workers a core, stats a directory in inode order, walks children
smallest inode first, and as root reads the directories' blocks ahead through the device
(linux::dirblocks, ext4 only β DUSCAPE_DIRBLOCKS_DEVICE=<file> forces the path for testing).
As root on ext4 the whole walk reads the device instead (ext4.rs, roadmap step 2: cold 1.7x
the kernel walk); --no-device-read compares;
docs/probes/bench-diskus.sh measures warm and cold against diskus β see "Cold cache" in the doc. Anything you change must keep sharded's totals identical
to pipeline's β that comparison is the correctness check, not just the speed one. On Windows the
floor is a fixed kernel and filter-driver cost per directory handle (3Γ on the system volume);
opening by file id, closing off the walker threads and skipping the last listing call were all
measured and none helped β read the 2026-09-24 section before trying them again.
- Core algorithm:
common/src/tiles/treemap.rs; the grid it lays out in isGrid - The desktop viewers lay out in pixels, so the tile count follows the window: measure a change
with
DUSCAPE_LAYOUT_PATH='E:\' cargo test --release -p duscape-viewer --test layout_speed -- --ignored --nocapture(the board and nesting at three window sizes; 2026-09-27 on E:, 240k entries: 11k nested tiles laid out in 5 ms at 2560Γ1400 pt, 1.5x;C:\Windows: 26k in 24 ms; the flat 87k-fileC:\ProgramData\Dell\SARemediation\SystemRepair\Snapshots\Backup: 23k tiles and 61k specks in 28 ms) and, on Windows,DUSCAPE_PAINT_TIMES(4k tiles painted in 13β17 ms, what 250 took before the pixel grid; the 87k-file folder in 13β19 ms) - Tile rendering:
viewers/tui/src/ui/grid/(terminal),viewers/windows/src/win/paint.rs,viewers/macos/src/mac/draw.rs(treemap) - Adjust
HEIGHT_WIDTH_RATIO,MINIMUM_HEIGHT,MINIMUM_WIDTHconstants (the terminal'sGrid), orMIN_TILE_PIXELSinviewers/shared(the windows') - Entries below the minimum tile size are never dropped: they fold into the "small files"
corner (in the terminal a box filled with
β«s β notβ‘, which many terminals draw two cells wide β in the terminal's own colours, drawn over what is there, since it can lie over the last tile's cells), clamped bySMALL_FILES_MINIMUM_WIDTH/HEIGHTso it stays visible even when the hidden entries round to zero cells - Why the layout's work is bounded by the screen, not the folder (
largest_in_folderranks only what can get a tile,Nestingcaps at what the area holds at the least tile, the corner ranks only as many as it has pixels): the goals' 60 fps relayout has to hold on a folder of a million entries as on one of ten. What the screen cannot show at once becomes a second pass (Viewer::finish_second_pass), not a slower frame
The binaries deploy.yml builds are the canonical ones (docs/packaging.md): every package
holds them byte for byte, never a build of its own β the deb and rpm (packaging/linux/nfpm.yaml)
and the Windows installer (installer/duscape.nsi, Ubuntu's makensis) are made in the job that
built the binary, from the same files as the tarball or zip. The release adds SHA256SUMS and
a build-provenance attestation per file, what a manual self-update would check. Keep the asset
names stable: they are what such an updater asks for. macOS is built there too, on
macos-latest (build-macos), so every platform's download is a CI build.
A v* tag runs deploy.yml. It builds duscape-<tag>-<target>.tar.gz for
x86_64-unknown-linux-musl (musl-gcc) and aarch64-unknown-linux-musl (cargo zigbuild,
zig 0.13.0), and duscape-<tag>-x86_64-pc-windows-gnu.zip (cargo zigbuild, against the
Universal C Runtime: only DLLs Windows 10 carries), each duscape being the terminal viewer and
the window; the zip has duscape-windows.exe beside it, the window alone and windows subsystem,
for a shortcut to start with no console flashing before Windows 11 24H2. The Linux binaries are
fully static, so they have no glibc floor and run on Alpine and busybox; the job checks it, and
that duscape.exe is console subsystem and duscape-windows.exe is not. macOS has a job of
its own on macos-latest (linking AppKit needs a Mac): make mac-app makes the universal
binary and Duscape.app (viewers/macos/Info.plist) β a bare binary opened from Finder runs
in Terminal, so Finder's way to the window is the bundle β then checks both architectures, no
AppKit in the load commands, the signature, and a scan; it ships
duscape-<tag>-universal-apple-darwin.tar.gz (the binary taken from inside the signed bundle,
since codesign on the bundle rewrites it) and Duscape-<tag>-macos.zip (ditto, which keeps
the signature). Signed ad hoc, not notarised: Gatekeeper asks before a downloaded copy's first
start. One job then publishes every archive: matrix jobs
that each create the release race. The repository's Actions permission must allow actions from
outside it (actions/checkoutβ¦): set to local actions only, every run fails to start.
The version is the workspace's (Cargo.toml), with the path dependencies' version beside it.
- Build settings are chosen by measured speed first (the performance goals), size second:
opt-level = "z": the release profile is size-optimised for the monolithic viewer binaries, shaving 455 KiB (β17.5%) off the binary (down to ~2.14 MB) under fat LTO (codegen-units = 1,panic = "abort",strip = true) while maintaining ~917kβ1M+ entries/s scan throughput (seedocs/security.md). Earlier single-threaded Linux benchmarks showed"s"faster on synthetic tree-build micro-benchmarks (docs/scan-performance.md), but in practice"z"remains well within the interactive budget. Withlto = truea per-crateopt-leveldoes nothing, the final codegen uses the top level's.--profile profilingis the release with symbols, for samplers. PGO (make pgo) is worth 2β3% wall, 6β8% CPU, and is not in the release pipeline; thin LTO is slower than fat.- Allocator: musl builds use jemalloc (
tikv-jemallocator, 64-bit musl only). musl's own malloc made the scan 7x slower and mimalloc 2x. Do not swap it without rerunning the--bench-stage shardedcomparison indocs/scan-performance.md. glibc builds use the system allocator. - aarch64 page size: jemalloc fixes its page size at build time. aarch64 builds set
JEMALLOC_SYS_WITH_LG_PAGE=16, so the binary also runs on 16K- and 64K-page kernels. - Licences: jemalloc is BSD-2-Clause and linked in, so its
COPYINGships in each tarball asLICENSE-jemalloc. - zig as the musl C compiler without zigbuild: cc-rs passes a Rust
--target=that zig rejects, and zig's debug-mode UBSan traps in jemalloc (tests die with SIGILL). Filter the flag and pass-fno-sanitize=undefined, or just usecargo zigbuild, which does both.
What is measured, where the limit is, and what to do when a change crosses it. make quality
prints the live figures; make coverage the test coverage.
- Function size and complexity.
cargo clippywarns β and CI, with-D warnings, fails β on a function over 100 lines or of cognitive complexity over 25 (clippy.toml; the lints are turned on for every crate by[workspace.lints]). Split the function, or when its length is the honest shape of the work (a widget drawn top to bottom, a listing decoded entry by entry) put#[allow(clippy::too_many_lines)] // quality debt: <why>on it. Those markers are the debt register, whichmake qualitylists; do not add one without the reason, and take one off when you split the function. Measured on all three targets, since each viewer's code is compiled on its platform alone. - Tests.
cargo test --workspacepasses on Linux (CI) and on Windows and macOS; a fixture that needs something the machine lacks (symlink creation on Windows without Developer Mode, a sparse file on a filesystem that makes none) skips with a comment saying so, never fails and never asserts less than it did. Tests are platform-correct, not platform-skipped: a path is built withPath::join, a quoted path withquote_path_for_shell, a sparse file withos::set_sparse. unsafe. Everyunsafeblock has a// SAFETY:comment above it saying what is upheld;make qualitycounts the blocks per crate and those without one, which is zero.- Coverage.
make coverage(cargo llvm-cov). The viewers that are stubs on the platform measuring show as uncovered; the row to read is the crate changed. Baseline, 2026-09-26, on Windows: 70.6% of lines and 74.4% of functions in all βcommon88.7%,viewers/tui76.2%,viewers/shared74.0%,scanners65.4% (its Linux walkers are not compiled there),viewers/windows7.1% (GDI and Win32; what it decides is inviewers/shared, and tested). - Dependencies and spelling.
cargo deny check(licences) andtypos, in CI. - Speed. The performance goals at the top are a quality measure like the others: a change
that touches the walk, the layout or the paint says what it measured (
--benchmark,tests/layout_speed.rs,DUSCAPE_PAINT_TIMES) in its commit, and one that makes a frame slower either finds the time back or moves the new work to a second pass.
cargo test --workspacecargo test -p libduscape -p duscape --target x86_64-unknown-linux-muslcargo clippy --workspace --all-targets -- -D warningscargo fmt --all -- --checkcargo deny check- typos check
fixtures/fs/run.sh(fs-fixtures.yml)
Regenerated by hand from wc -l when this file is touched; make quality prints the live figures.
| File | Purpose |
|---|---|
viewers/tui/src/lib.rs |
~480 lines β which viewer (front), terminal setup, thread/channel setup |
viewers/tui/src/app/mod.rs |
~1420 lines β the TUI's state machine |
viewers/tui/src/preview.rs |
~1300 lines β preview thread, kitty/sixel/half-block output, detection |
viewers/windows/src/win/mod.rs |
~1440 lines β the Windows window: input β Viewer, threads, messages, the start-up timeline |
viewers/windows/src/win/paint.rs |
~1320 lines β drawing by Viewer::layout: pixels into a DIB section, GDI text |
viewers/shared/src/state.rs |
~2580 lines β the desktop viewers' shared state, no toolkit; the free-space view and its toggle |
viewers/shared/src/deleting.rs |
~300 lines β a delete on a thread of its own: its outcome, its box's words and layout |
viewers/shared/src/state/tween.rs |
~180 lines β tiles sliding from one steady layout to the next |
viewers/macos/src/mac/view.rs |
~1610 lines β the macOS viewer's view, events and commands |
viewers/linux/src/wayland.rs |
~1030 lines β the Wayland backend: shm, xdg-shell, seat, clipboard |
viewers/linux/src/app.rs |
~1300 lines β the Linux viewer's loop, keys, mouse, dialogs, context menu, title bar |
viewers/linux/src/draw.rs |
~1060 lines β the Linux viewer's painting: the tree, the nesting, the menu, the dialogs |
viewers/linux/src/x11.rs |
~550 lines β the X11 backend: window, events, PutImage, keymap, clipboard |
viewers/linux/src/xkb.rs |
~360 lines β the xkb keymap reader |
common/src/tiles/board.rs |
~530 lines β tile nav/zoom, steady relayouts, the free and unscanned space's strip |
common/src/tiles/treemap.rs |
~560 lines β squarify, in a Grid; the steady layout (Plan) |
common/src/tiles/nested.rs |
~910 lines β the nesting, steady or not |
common/src/model/files/file_tree.rs |
~630 lines β folder tree, hard-link accounting, the build profile |
scanners/src/lib.rs |
~770 lines β walker selection, parallel build, environment |
scanners/src/portable.rs |
~260 lines β the portable walk on std::fs: the BSDs, the benchmark's baseline |
scanners/src/linux.rs |
~720 lines β Linux getdents64/statx walker, inode order; linux/ ~1190 more: mounts, filesystems, btrfs, reflinks, block prefetch, the fstatat fallback |
scanners/src/macos.rs |
~1140 lines β macOS getattrlistbulk walker, APFS clones |
scanners/src/disk_image.rs |
~330 lines β macOS: a mounted disk image's file, through IOKit |
scanners/src/windows.rs |
~940 lines β Windows bulk-listing walker |
viewers/tui/src/bench/mod.rs |
~480 lines β --benchmark harness |
viewers/dos/DUSCAPE.ASM |
~4700 lines β the MS-DOS viewer, one instruction a line |
viewers/dos/SOFTFP.ASM |
~810 lines β IEEE doubles on a 286 |
viewers/dos/PREVIEW.ASM |
~1300 lines β its previews: text, blocks, the palette |
scanners/src/mft.rs |
~1630 lines β NTFS read from its master file table: the parser, the running totals for the view, the tree, and the volume read (its probe, the live and seeding threads) |
scanners/src/cache/sweep.rs |
~210 lines β the saved scans kept to what can be used, within a room |
scanners/src/cache.rs |
~1290 lines β the saved scan: the trimmed format, the recorder, the stream as saved, the replay with the log's changes applied |
scanners/src/fsevents.rs |
~410 lines β macOS's change log through CoreServices, dlopened |
scanners/src/fill.rs |
~170 lines β the fill pass over the folders a saved scan trimmed |
scanners/src/snapshots.rs |
~620 lines β a volume's local snapshots read against the live volume: the narrowed walk, the tree; snapshots/ ~760 more: macOS, the change log, extents |
common/src/snapshots.rs |
~100 lines β the snapshots' virtual folder: its name, what is noted, descriptions |
viewers/tui/src/ui/display.rs |
~360 lines β the frame: what every mode shows, each mode's modal, the nesting's cache |
viewers/tui/src/ui/grid/rectangle_grid.rs |
~220 lines β the terminal's treemap: tiles, the nesting, corners, highlight frames |
common/src/scan/mod.rs |
~1270 lines β the scan protocol: options, entries, whom they are for, issues, the outline, the focus |
common/src/scan/places.rs |
~290 lines β --issues' failures by where, rolled up into a tree |
common/src/archive.rs |
~430 lines β zip archives as folders: the central directory, an entry unpacked in memory |
scanners/src/archives.rs |
~140 lines β the archives' pass: the ones on screen read, largest first |
common/src/nas.rs |
~190 lines β the folders a NAS (or macOS, Windows) keeps for itself, by name: left out, described |