Treemonger
disk usage visualizer
Install / Use
/learn @alanbernstein/TreemongerREADME
what
treemonger is a disk space usage visualizer, inspired by the old version of spacemonger
I like spacemonger because of a few details of its treemap rendering method, all of which contribute to considerably better "readability" than every other related tool I have tried.
- it uses the squarify subdivision rules (or similar),
- it shows the directory hierarchy with thin but nonzero margins,
- it does not use "cushion" or "profile" gradients, but rather color for depth, and filename labels for maximum glanceable information,
- it displays directory labels, at the cost of a bit of accuracy in relative sizing (IMO sizing in this sort of tool is mainly useful for ranking, rather than fine comparison, so the loss of accuracy isn't a problem).
The main motivation for treemonger is to replicate this treemap method. Unlike spacemonger, It is intended to work on Linux and Mac, in addition to Windows.
treemonger is a GUI app out of necessity; TUI tools like ncdu also have their place, but the pixel-level effect I'm looking for requires a canvas.
In lieu of a fully-featured GUI, the app window is just a canvas. UI actions are accessible via keyboard/mouse shortcuts and a context menu.
example:

install
pip install -r requirements.txt
one hard requirement:
- tkinter (
brew install python-tkon mac, maybe)
can be used if available:
- pyperclip (clipboard functionality)
- magic (additional file details)
- send2trash (multi-platform support to trash files from within GUI)
run
./treemonger.py # run in current directory
./treemonger.py ~/Downloads # specify directory
./treemonger.py --file="/path/to/archive-file" # display previously archived scan
./treemonger.py --file # display most recent archived scan
./treemonger.py --skip-mount # try to avoid scanning things like network drives
./treemonger.py --exclude-dir="foo" # can be repeated
./treemonger.py --exclude-file="bar" # can be repeated
./treemonger.py --exclude-filter="regex" # can be repeated
Default values for certain flags can be defined via the configuration file.
config
treemonger looks for a local configuration file at ~/.config/treemonger.json.
If that file is not found, it uses the default config.json file included in the repository.
Values in the config file are replaced or extended (for list-valued flags) by any supplied command-line flags.
Config sections include:
- flags: basic program behavior flags
- mouse: UI mouse event definitions
- keyboard: UI keyboard event definitions
- tk_renderer: low-level rendering parameters; adjust these at your own risk
- colormap (not yet implemented)
Renderers
treemonger supports multiple renderer options, including:
tktkinter GUI appsvg-basicoutput to a basic SVG filesvg-interactiveoutput to an interactive SVG file (work in progress)matplotlibdraw to matplotlib plot window, use for testing
to use:
- set the
renderervalue in the 'flags' section of your config file - pass
-r=svg-basicat the command line
TK UI
UI actions are customizable, with default configuration:
- mouse<1>:
info(left click in ubuntu) - ctrl+mouse<1>:
info - mouse<2>:
copy_path(middle click in ubuntu) - mouse<3>:
context_menu(right click in ubuntu) - mouse<4>:
zoom_out(wheel up in ubuntu) - mouse<5>:
zoom_in(wheel down in ubuntu) - "Down":
zoom_in(down arrow) - "Up":
zoom_out(up arrow) - "c":
copy_path - "i":
info - "m":
cycle_mode(not yet implemented) - "o":
open_location - "q":
quit - "r":
refresh - "ctrl+r":
refresh - "t":
trash
Actions are simple member functions in renderers/tk.py:TreemongerApp.
(Mouse button mapping in tk is platform-dependent. Rather than try to interpret what they mean in a coherent way, I chose to make the interface fully customizable: update the config file to whatever works for you.)
Modifier keys are supported. Check config.json for examples.
future work
- fix glitchy rendering/clipping (probably requires a new rendering engine)
- different display/sizing modes
Related Skills
node-connect
344.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
96.8kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
344.1kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
344.1kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
