Skip to content

A treemap for finding and removing what fills your disk, for Omarchy. Rust + GPUI.

Rust

Install with make: binary, desktop entry and icon

Tobi Lutke1b5588f11470
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..1e86866
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,86 @@
+# disktree: build, check, and install.
+#
+# `make install` puts the binary, a desktop entry and an icon under PREFIX
+# (default: ~/.local), so disktree shows up in the Omarchy launcher and in
+# "Open with" for directories. The default needs no root:
+#
+# make install # ~/.local/bin/disktree
+# sudo make install PREFIX=/usr/local # system-wide
+
+PREFIX ?= $(HOME)/.local
+BINDIR ?= $(PREFIX)/bin
+APPDIR ?= $(PREFIX)/share/applications
+ICONDIR ?= $(PREFIX)/share/icons/hicolor/scalable/apps
+
+MANIFEST = Cargo.toml
+CARGO ?= cargo
+TARGET = target/release/disktree
+ICON = assets/disktree.svg
+DESKTOP = packaging/disktree.desktop.in
+
+.PHONY: help build run install uninstall lint test ci fmt clean
+
+help:
+ @echo "disktree"
+ @echo
+ @echo " make build release build"
+ @echo " make run build and run, scanning $$HOME"
+ @echo " make install install to $(PREFIX): binary, desktop entry, icon"
+ @echo " make uninstall remove what install put there"
+ @echo " make lint rustfmt --check and clippy -D warnings"
+ @echo " make test core and window-harness tests"
+ @echo " make ci lint, then test"
+ @echo " make fmt format in place"
+ @echo " make clean cargo clean"
+
+# Always ask cargo: it is incremental and knows every source file, where a
+# make file-target would only compare the binary against the manifest and
+# happily install a stale build.
+build:
+ $(CARGO) build --release
+
+run: build
+ $(TARGET)
+
+lint:
+ $(CARGO) xtask lint
+
+test:
+ $(CARGO) xtask test
+
+ci: lint test
+
+fmt:
+ $(CARGO) xtask fmt-fix
+
+install: build
+ install -d $(BINDIR) $(APPDIR) $(ICONDIR)
+ install -m755 $(TARGET) $(BINDIR)/disktree
+ install -m644 $(ICON) $(ICONDIR)/disktree.svg
+ VERSION=$$(sed -n 's/^version = "\(.*\)"/\1/p' $(MANIFEST) | head -1) && \
+ sed -e 's|@BINDIR@|$(BINDIR)|' -e "s|@VERSION@|$$VERSION|" \
+ $(DESKTOP) > $(APPDIR)/disktree.desktop && \
+ chmod 644 $(APPDIR)/disktree.desktop
+ @if command -v update-desktop-database >/dev/null 2>&1; then \
+ update-desktop-database $(APPDIR) 2>/dev/null || true; \
+ fi
+ @echo
+ @echo "installed:"
+ @echo " $(BINDIR)/disktree"
+ @echo " $(APPDIR)/disktree.desktop"
+ @echo " $(ICONDIR)/disktree.svg"
+ @if command -v desktop-file-validate >/dev/null 2>&1; then \
+ desktop-file-validate $(APPDIR)/disktree.desktop || true; \
+ fi
+ @case ":$$PATH:" in *":$(BINDIR):"*) ;; *) \
+ echo; echo "note: $(BINDIR) is not on PATH in this shell";; esac
+
+uninstall:
+ rm -f $(BINDIR)/disktree $(APPDIR)/disktree.desktop $(ICONDIR)/disktree.svg
+ @if command -v update-desktop-database >/dev/null 2>&1; then \
+ update-desktop-database $(APPDIR) 2>/dev/null || true; \
+ fi
+ @echo "removed"
+
+clean:
+ $(CARGO) clean
diff --git a/assets/disktree.svg b/assets/disktree.svg
new file mode 100644
index 0000000..b66a11a
--- /dev/null
+++ b/assets/disktree.svg
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- disktree's mark: a treemap, with the band a directory keeps for its name. -->
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64">
+ <rect width="64" height="64" fill="#1a1b26"/>
+ <rect x="5" y="5" width="54" height="54" fill="#3a4152"/>
+ <rect x="5" y="5" width="54" height="9" fill="#7aa2f7"/>
+ <rect x="8" y="17" width="30" height="39" fill="#2a653b"/>
+ <rect x="8" y="17" width="30" height="7" fill="#9ece6a"/>
+ <rect x="41" y="17" width="15" height="24" fill="#362f5e"/>
+ <rect x="41" y="17" width="15" height="6" fill="#bb9af7"/>
+ <rect x="41" y="44" width="15" height="12" fill="#e0af68"/>
+</svg>
diff --git a/packaging/disktree.desktop.in b/packaging/disktree.desktop.in
new file mode 100644
index 0000000..b83df8d
--- /dev/null
+++ b/packaging/disktree.desktop.in
@@ -0,0 +1,17 @@
+[Desktop Entry]
+Type=Application
+Version=1.0
+Name=disktree
+GenericName=Disk space treemap
+Comment=Find what is using a volume, mark what should go, remove it
+Exec=@BINDIR@/disktree %U
+Icon=disktree
+Terminal=false
+Categories=System;Filesystem;
+Keywords=disk;space;usage;du;treemap;cleanup;
+StartupNotify=true
+StartupWMClass=disktree
+# Registered for directories, so a file manager can offer "Open with disktree".
+# This adds a handler; it does not become the default.
+MimeType=inode/directory;
+X-AppVersion=@VERSION@