disktree README

The project's README from github.com/tobi/disktree. As one markdown file: README.md.

disktree

disktree: a home directory as a treemap, coloured by kind of data, with reclaimable space hatched and the selection, findings and free space in the side panel

Find what is filling a disk, mark what should go, and remove it — with the volume's free space in view the whole time.

disktree is a treemap for Omarchy. It scans your home directory by default, draws every directory as a nested mosaic sized by what it really costs on disk, and lets you walk into it with the keyboard or the mouse. Mark as much as you like; nothing happens until you review the list and commit, and the permanent path always asks first.

Built with GPUI through gpui-omarchy, so it follows your Omarchy theme and behaves like the rest of the desktop.

Install

Download disktree-*-x86_64-linux.tar.gz (aarch64-linux on ARM) from the latest release, unpack it, and run ./install.sh inside (or just copy disktree onto your PATH). Or build it:

git clone https://github.com/tobi/disktree
cd disktree
make install

make install builds a release binary and puts three things under ~/.local (no root needed):

sudo make install PREFIX=/usr/local installs system-wide; make uninstall removes exactly what was installed.

You need Rust 1.97 or newer and a Wayland or X11 session with a GPU that GPUI can drive (Vulkan). Distributions often package an older Rust; rustup installs a current one.

macOS

Download disktree-*-aarch64-macos.zip (x86_64-macos for an Intel Mac) from the latest release, unzip it, and drag disktree.app into Applications. macOS 11 or newer.

A release that was not signed and notarized is stopped by Gatekeeper: macOS says it "is damaged and can't be opened" or "cannot be verified". The app is fine; the browser marked the download as quarantined. Clear the mark once:

xattr -dr com.apple.quarantine /Applications/disktree.app

(Or open it once, then choose Open Anyway in System Settings › Privacy & Security.)

Or build it, with Rust 1.97 or newer and Xcode or its Command Line Tools. macOS does not come with Rust; install it with rustup.

make install     # ~/Applications/disktree.app, and ~/.local/bin/disktree
make uninstall

To see everything, give disktree Full Disk Access in System Settings › Privacy & Security (the panel offers a button when it is missing), then reopen it. Without it macOS hides Mail, Messages, Safari, other apps' data and the Trash, and disktree counts them as unreadable. Started from a terminal, it is the terminal that needs the access. macOS also asks once each for Desktop, Documents and Downloads.

What is different from Linux:

To sign and notarize a build for others, with a Developer ID certificate in the keychain and credentials saved by xcrun notarytool store-credentials:

NOTARY_PROFILE=<profile> cargo xtask bundle \
  --sign "Developer ID Application: Name (TEAMID)" --notarize

Windows

On Windows 10 or 11, download disktree-*-x86_64-windows.zip (aarch64-windows on ARM) from the same release, unpack it anywhere and run disktree.exe. Or build it with Rust 1.97 or newer, from rustup, and the MSVC toolchain (Visual Studio Build Tools, C++ workload):

git clone https://github.com/tobi/disktree
cd disktree
cargo build --release    # target\release\disktree.exe

See On Windows for what differs there.

Use

disktree            # scan the home directory
disktree --disk     # the whole disk it lives on
disktree ~/src      # or any directory
disktree --help     # options: apparent size, follow links, skip hidden, …

The screen

One colour is kept apart: amber marks the selection, the main action, and what can be had back.

The kinds come from directory names and a few shapes (a bare git repository, target beside a Cargo.toml). Some of the names are specific to one machine; see crates/disktree-core/src/classify.rs.

Marking

Space, X, Enter and the arrows act on the tile under the mouse if the mouse moved last, and on the keyboard selection after you use an arrow or Tab.

A marked tile takes the danger colour, and so does everything inside it: removing a directory takes its contents with it. Marking a directory absorbs any marks already inside it, and something inside a marked directory cannot be marked or kept on its own; its panel offers to unmark the directory instead. Marking is reversible — press it again — and the saving is never counted twice.

Zooming and going in

Scroll to magnify toward the pointer. The wheel magnifies until the directory under the pointer fills the view, and the next notch goes into it — one continuous motion, with the directory's contents growing into place. Scroll the other way to come back out. Enter goes into the selected directory at any depth, and Backspace or Escape goes up one level. < and >, beside the Size / Files / Age switch, go back and forward through the directories visited, as do alt ← alt → (also ⌘[ ⌘] on macOS) and the mouse's side buttons. + and - magnify without going in; 0 resets.

Removing

c (or Review…) opens the list of everything marked. Unmark anything there, then choose:

When it finishes, disktree scans again so the numbers on screen match the disk, and shows how much free space was actually gained.

Keys

key does
space / x mark or unmark the tile you point at
ctrl-click (⌘-click on macOS) mark without moving the selection
enter open that directory, at any depth
⌫ / esc go up one directory
alt ← alt → back and forward through where you have been
← ↑ ↓ → move between tiles at this level
tab next largest sibling
scroll zoom toward a directory, then go into it
shift-scroll pan the magnified view
[ ] draw fewer or more levels at once
- = 0 magnify, shrink, reset the view
ctrl = ctrl - ctrl 0 (⌘ on macOS) interface zoom
/ filter by name: only matches keep their colour; enter shows only them, esc clears
c review the marked list
t rank by size or by file count
d disk usage or apparent size
i include or skip hidden entries
r scan again
ctrl o (⌘O on macOS) choose another directory to scan
g the whole disk
p show or hide the selection line
o show it in Finder, File Explorer or the file manager
? every key
q quit

On macOS the menu bar also has ⌘⇧R to show the selection in Finder, ⌘R to rescan, ⌘[ and ⌘] for back and forward, and ⌘Q, ⌘H and ⌘W (closing the window quits); other ⌘ chords are left to the system. On Linux and Windows the same work with ctrl, with F5 to rescan too.

On the review screen: m trash, p permanent, ! unmark all, enter commits, esc goes back. Or hand the list on instead of acting on it: s saves it as a text file, one path per line, and a copies a prompt for a coding agent: free the space by removing what you picked, checking each path first (git work that exists nowhere else, a tool's own clean command) and touching nothing else. A name holding a newline is left out of the list and escaped in the prompt, so it cannot pass for another path.

What it measures

The scan follows dust's approach: one rayon scope per root, a completion counter per directory so no directory is built before its last subdirectory lands, and one bottom-up pass that aggregates sizes and removes duplicate hardlinks.

The whole disk

Click / (or any directory above the scanned root) in the trail, press g, run disktree --disk, or use the launcher's Scan the whole disk action. g and --disk scan the disk your home directory lives on — / on Omarchy and on macOS. On macOS the Data volume's second mount, /System/Volumes/Data, is skipped: it is /Users, /Applications and the rest again under other names.

Widening is memoized: the tree already measured is handed to the wider walk and reused where it is reached, so going from ~ to / reads only what is outside ~ (on this machine, seconds instead of a full rescan). The current view stays on screen until the wider tree lands, which then opens with the directory you came from selected. Going back down is just navigation.

A scan stays on one volume, and a volume is the mount source, not the device number: btrfs gives each subvolume its own st_dev, so /home, /var/log and /var/cache/pacman/pkg are included, while /proc, /sys, /run, tmpfs, /boot, other disks, network shares and automount points are left out (checked by path, so an automounted NAS is never mounted just to be measured). Snapshot subvolumes are left out too: their files share blocks with the live ones, and counting them would count the disk twice. -X crosses into everything.

Without root, some system directories cannot be read; they are counted as unreadable in the top bar rather than guessed at.

On Windows

The same program, with Windows' answers to the questions above:

What it refuses to do

The removal rules live in crates/disktree-core/src/removal.rs, and each one is tested:

On Hyprland

Hyprland tiles new windows, so disktree opens into whatever tile it is given. It is designed for a roomy window; float it, or give it a rule. The window class is disktree.

windowrule = float, class:^(disktree)$
windowrule = size 1400 900, class:^(disktree)$

Develop

make run      # release build, scanning $HOME
make lint     # rustfmt --check, then clippy with every warning an error
make test     # scanner, layout and removal tests, plus window-harness tests
make ci       # lint, then test

The lint gate is strict on purpose: clippy::all and clippy::pedantic are errors, and every exception is written down with its reason in Cargo.toml. The window-harness tests draw real frames and press real keys — including one that marks a directory, confirms the deletion and checks that the files are gone while their neighbours are not.

path what lives there
crates/disktree-core scanning, the tree, the squarified layout, free space and removal — no UI
crates/disktree-app/src/state.rs every action the interface can take, and the key map
crates/disktree-app/src/views.rs the screens
crates/disktree-app/src/treemap_view.rs painting the mosaic and its labels
crates/disktree-app/src/ui.rs the spacing, type and size scale, in rem
crates/disktree-app/src/tests.rs end-to-end tests through a real window
packaging/, assets/, Makefile the desktop entry, the icon, and install

The interface follows the GPUI Kit design guides: every size is on one rem scale so interface zoom keeps its proportions, primary is reserved for what Enter does, and the only question the app asks is the one it cannot take back.

License

MIT

disktree (tobi/disktree)

Searching Database…

Что это такое?disktree — это визуализатор treemap для поиска того, чем забит ваш диск: он рисует каждую директорию как вложенную мозаику, размер которой зависит от реально занятого места, позволяет помечать файлы или папки на удаление и всё время держит на виду свободное место всего тома.
Это CLI-инструмент или графическое приложение?Это графическое десктоп-приложение, а не консольный инструмент — написано на Rust с GPUI через gpui-omarchy, что заодно заставляет его следовать теме Omarchy и вести себя как остальная часть этого десктопа. При этом у каждого действия есть горячая клавиша, если не хотите пользоваться мышью.
Удаление происходит сразу и безвозвратно?Нет — пометка файла или папки лишь выделяет её; ничего не происходит, пока вы не откроете список на проверку и не выберете Move to trash (восстановимо) или Delete permanently, причём безвозвратный вариант всегда сначала показывает диалог подтверждения.
Нужен ли Omarchy, или это работает на любой машине с Linux, Mac или Windows?Несмотря на Omarchy-антураж, он поставляется с готовыми бинарниками и для обычного Linux, macOS и Windows, с отдельным поведением для корзины, отчёта о диске и защищённых системных папок каждой ОС.
Почему он не видит некоторые папки на моём Mac?На macOS disktree нужен Full Disk Access, выданный в System Settings, чтобы видеть Mail, Messages, Safari, данные других приложений и Корзину; без этого они считаются нечитаемыми, а если запустить его из терминала, разрешение нужно выдать самому терминалу.
В чём разница между Disk usage и Apparent size?Disk usage — режим по умолчанию, отражающий то, что показывает du и что вы реально вернёте при удалении (stblocks × 512); Apparent size, переключаемый одной клавишей, — это «сырой» размер файла, как его показывает `ls -l`, что может сильно отличаться для разреженных или сжатых файлов.
Можно ли просканировать весь диск, а не только домашнюю папку?Да — нажмите g, запустите `disktree --disk` или используйте действие 'Scan the whole disk' в лаунчере; сканирование кэшируется, поэтому расширение с ~ до / читает только то, что вне вашей домашней директории, вместо повторного сканирования всего.
А если я хочу получить список того, что удалить, вместо того чтобы удалять самому?На экране проверки нажатие s сохраняет помеченные пути в простой текстовый файл, а нажатие a копирует готовый промпт для агента для кодинга с указанием освободить место, удалив ровно эти пути и ничего больше.
Почему macOS может показывать меньше свободного места, чем Finder?disktree показывает то, что говорит `df`, а цифра Finder учитывает ещё и очищаемое место (кэши и локальные снимки, которые macOS может удалить сама), поэтому показатель свободного места у Finder обычно больше.
Creator
tobi
Size
2 MB
Stars
3K
Age
23d
Commits · 90 Days