A treemap for finding and removing what fills your disk, for Omarchy. Rust + GPUI.
Rust
CI and releases on Windows; README
Oleg Shevchuk82d73fbcf875
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex 9d14d6e..058c6c0 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -43,3 +43,27 @@ jobs:- name: Testrun: cargo xtask test++ windows:+ name: Lint and test (Windows)+ runs-on: windows-2025+ steps:+ # Check out with the repository's own line endings, as on Linux.+ - run: git config --global core.autocrlf false++ - uses: actions/checkout@v5++ # Pinned with the Linux job, for the same reason. GPUI needs nothing+ # beyond the Windows SDK the runner already has.+ - uses: dtolnay/rust-toolchain@master+ with:+ toolchain: "1.97"+ components: clippy, rustfmt++ - uses: Swatinem/rust-cache@v2++ - name: Lint+ run: cargo xtask lint++ - name: Test+ run: cargo xtask testdiff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex ed382d8..1802562 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -23,6 +23,9 @@ jobs:# The oldest supported runner: its glibc is what the binary needs at# least, so building here runs on the most systems.runs-on: ubuntu-22.04+ outputs:+ tag: ${{ steps.version.outputs.tag }}+ version: ${{ steps.version.outputs.version }}steps:- uses: actions/checkout@v5with:@@ -86,3 +89,53 @@ jobs:gh release create "$TAG" "$ARCHIVE" "$ARCHIVE.sha256" \--title "disktree ${TAG#v}" --generate-notesfi++ windows:+ name: Build and publish (Windows)+ # After the Linux job, which checks the tag and creates the release.+ needs: release+ runs-on: windows-2025+ env:+ # The C runtime linked in, so disktree.exe also runs where the Visual+ # C++ runtime was never installed. For the tests too, so both steps+ # share one build.+ RUSTFLAGS: -C target-feature=+crt-static+ steps:+ - run: git config --global core.autocrlf false++ - uses: actions/checkout@v5+ with:+ ref: ${{ inputs.tag || github.ref }}++ - uses: dtolnay/rust-toolchain@master+ with:+ toolchain: "1.97"++ - uses: Swatinem/rust-cache@v2++ - name: Test+ run: cargo xtask test++ - name: Build+ run: cargo build --release --locked -p disktree-app++ - name: Package+ id: package+ shell: pwsh+ run: |+ $name = "disktree-${{ needs.release.outputs.version }}-x86_64-windows"+ New-Item -ItemType Directory -Force "dist/$name" | Out-Null+ Copy-Item target/release/disktree.exe, README.md, LICENSE "dist/$name/"+ Compress-Archive -Path "dist/$name" -DestinationPath "dist/$name.zip"+ $hash = (Get-FileHash "dist/$name.zip" -Algorithm SHA256).Hash.ToLower()+ # The format `sha256sum -c` reads, with a Unix line ending.+ [IO.File]::WriteAllText("dist/$name.zip.sha256", "$hash $name.zip`n")+ "archive=dist/$name.zip" >> $env:GITHUB_OUTPUT++ - name: Publish+ shell: bash+ env:+ GH_TOKEN: ${{ github.token }}+ TAG: ${{ needs.release.outputs.tag }}+ ARCHIVE: ${{ steps.package.outputs.archive }}+ run: gh release upload "$TAG" "$ARCHIVE" "$ARCHIVE.sha256" --clobberdiff --git a/AGENTS.md b/AGENTS.mdindex 3dd73b0..d1ad868 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -32,6 +32,8 @@ entry's `Categories` to a single main category plus additional ones, or`cargo xtask lint` is the gate. It must be green before anything is calleddone, and it must not fix anything: a red local run is the same signal CI gives.+On Windows, where there is no make, run `cargo xtask lint`, `cargo xtask test`+and `cargo build --release` directly; CI runs the gate on both systems.## House rules@@ -54,7 +56,8 @@ done, and it must not fix anything: a red local run is the same signal CI gives.## Invariants1. **Sizes come from `st_blocks * 512` unless apparent size was asked for.**- That is the number that comes back when a file is deleted.+ That is the number that comes back when a file is deleted. On Windows it+ is the allocation the directory listing reports; see `windows.rs`.2. **`own_bytes`/`own_files` are derived, never tracked.** `tree::aggregate`computes the totals from the children. Hardlink de-duplication rewrites aleaf's weight and re-aggregates; anything that patches `bytes` directly will@@ -89,6 +92,7 @@ done, and it must not fix anything: a red local run is the same signal CI gives.| tile geometry, nesting, the merged tail | `crates/disktree-core/src/treemap.rs` || anything that deletes, or refuses to | `crates/disktree-core/src/removal.rs` || free space and projections | `crates/disktree-core/src/space.rs` |+| what Windows lists, measures and compares differently | `crates/disktree-core/src/windows.rs` — the only `unsafe` || a key, a screen transition, a mark | `crates/disktree-app/src/state.rs` || spacing, type and size | `crates/disktree-app/src/ui.rs` — tokens only, no `px` in layout || the mosaic's painting or labels | `crates/disktree-app/src/treemap_view.rs` |diff --git a/README.md b/README.mdindex 5c2b37c..afc9aca 100644--- a/README.md+++ b/README.md@@ -43,6 +43,18 @@ removes exactly what was installed.You need Rust 1.97 or newer and a Wayland or X11 session with a GPU that GPUIcan drive (Vulkan).+On Windows 10 or 11, download `disktree-*-x86_64-windows.zip` from the same+release, unpack it anywhere and run `disktree.exe`. Or build it with the MSVC+toolchain (Visual Studio Build Tools, C++ workload):++```powershell+git clone https://github.com/tobi/disktree+cd disktree+cargo build --release # target\release\disktree.exe+```++See [On Windows](#on-windows) for what differs there.+## Use```sh@@ -184,6 +196,31 @@ twice. `-X` crosses into everything.Without root, some system directories cannot be read; they are counted asunreadable in the top bar rather than guessed at.+## On Windows++The same program, with Windows' answers to the questions above:++- **Disk usage** is the allocation NTFS reports for each file: whole+ clusters, less for a compressed or sparse file, nothing for one small+ enough to live in its file record. It arrives with the directory listing+ itself (`FileIdExtdDirectoryInfo`), so it costs no more than the walk.+ Hardlinks count once on NTFS.+- **The whole disk** is the drive your profile is on, usually `C:\`. A+ folder another volume is mounted on is a link, like a junction, and is+ not entered, so a scan stays on one volume; `-l` follows links, and with+ them mounted folders.+- **Move to trash** is the Recycle Bin, through the shell, which asks+ before destroying anything it cannot recycle.+- **Refused besides the rules below:** Windows, Program Files and+ ProgramData, what Windows keeps at the top of its drive (System Volume+ Information, Recovery, Boot), and any folder holding your profile, such as+ `C:\Users`. Names compare without regard to case, as Windows compares+ them.+- **Hidden** still means a name starting with a dot; the hidden attribute is+ not consulted, so `-H` does not drop `AppData`.+- **The theme** is gpui-omarchy's default, since there is no Omarchy theme+ to follow.+## What it refuses to doThe removal rules live in `crates/disktree-core/src/removal.rs`, and each one is