Skip to content
alaahedhlyPublic

About

GTK3 system cleaner for Linux Mint and Ubuntu

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

MintSweep

Warning: This project is no longer actively maintained. I am migrating away from Linux Mint, and this app was built specifically for that environment. No further updates or bug fixes are planned. Feel free to fork and continue development.

MintSweep is a GTK3 system cleaner for Debian-based Linux distributions. It scans eight categories of reclaimable disk space, lets you preview what will be removed, and cleans selected categories with a single click. Root-level operations are batched into a single pkexec prompt so you only authenticate once.

Catppuccin Mocha themed Python 3 GTK 3 License MIT


Features

  • Single-window dashboard with disk usage bar, stats row, category cards, selection summary, clean button, and cleaning history
  • 8 cleaning categories, each with independent scan, preview, and clean:
    Category What it cleans Privilege
    APT Package Cache .deb files in /var/cache/apt/archives Root
    Orphaned Packages apt autoremove candidates Root
    Old Kernels Unused kernel packages (running + latest always protected) Root
    Thumbnail Cache ~/.cache/thumbnails User
    Browser Caches Firefox and Chrome/Chromium cache directories User
    System Logs / Journal Rotated logs (*.gz, *.1) and journald vacuum Root
    Trash ~/.local/share/Trash User
    Temp Files Old files in /tmp and /var/tmp (age-based) Mixed
  • Parallel scanning via ThreadPoolExecutor (4 workers) -- all categories scan concurrently
  • Batch privilege escalation -- all root commands are written to a single temporary script and executed through one pkexec prompt
  • Confirmation dialog before every clean operation, listing categories and sizes
  • Cleaning history stored in SQLite, displayed at the bottom of the dashboard
  • Auto-scan on launch so the dashboard is populated immediately
  • Catppuccin Mocha dark theme applied via targeted CSS classes (.ms-* prefix)
  • Debug mode (--debug) for verbose logging

Safety Features

MintSweep tries to be conservative and transparent:

  • Running kernel protection -- the currently booted kernel is never marked for removal
  • Latest kernel protection -- the newest installed kernel is always preserved, even if it is not the running one
  • Temp file age filter -- only files older than a configurable threshold (default: 7 days) are flagged
  • Journal vacuum, not delete -- journald is vacuumed by time (default: 14 days), not wiped
  • Dry-run detection -- orphaned packages are identified via apt-get --dry-run autoremove, not by heuristic
  • Per-item preview -- scan results show item counts and sizes before any cleaning happens
  • Confirmation dialog -- every clean operation requires explicit user confirmation
  • Root command batching -- root operations are collected into a single script and executed in one pkexec call; cancelling authentication aborts all root operations cleanly
  • User-owned vs root-owned separation -- temp file cleanup separates user-owned files (deleted directly) from root-owned files (deleted via pkexec)
  • Graceful partial failure -- if root operations fail or are cancelled, user-level cleaning results are still recorded

Dependencies

System packages

sudo apt install python3 python3-gi gir1.2-gtk-3.0 gir1.2-glib-2.0 policykit-1

Runtime tools (used by services)

Tool Used by Notes
apt-get APT cache, orphaned packages, old kernels Standard on Debian/Ubuntu/Mint
dpkg / dpkg-query Kernel size estimation, orphan detection Standard on Debian/Ubuntu/Mint
journalctl System logs service Part of systemd
pkexec Privilege escalation for root operations Part of PolicyKit

Python (standard library only -- no pip packages required)

MintSweep uses only the Python standard library plus PyGObject (GI bindings). There are no third-party pip dependencies.


Installation

Quick install (recommended)

git clone https://github.com/your-username/mintsweep.git
cd mintsweep
chmod +x install.sh
./install.sh

This will:

  1. Copy the application to /opt/mintsweep/
  2. Create a launcher at /usr/local/bin/mintsweep
  3. Install a .desktop file at /usr/share/applications/mintsweep.desktop

Manual install

# Copy source
sudo mkdir -p /opt/mintsweep
sudo cp -r *.py backend core services ui /opt/mintsweep/
sudo find /opt/mintsweep -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true

# Create launcher
sudo tee /usr/local/bin/mintsweep > /dev/null << 'EOF'
#!/usr/bin/env bash
export PYTHONPATH="/opt:${PYTHONPATH:-}"
cd /opt
exec python3 -m mintsweep "$@"
EOF
sudo chmod +x /usr/local/bin/mintsweep

Run from source (no install)

cd /path/to/mintsweep/..
python3 -m mintsweep
python3 -m mintsweep --debug   # verbose logging

Usage

Launch

mintsweep           # normal mode
mintsweep --debug   # enable debug logging to stderr

Workflow

  1. Scan -- the app automatically scans all 8 categories on launch. Click Scan in the header to re-scan at any time.
  2. Review -- each category card shows the number of items found and total reclaimable size. Categories with nothing to clean are automatically unchecked and disabled.
  3. Select -- check or uncheck categories. The selection summary updates in real time showing the total size of selected categories.
  4. Clean -- click Clean Selected. A confirmation dialog lists every category and its size. If any selected category requires root, the button label indicates "(requires password)".
  5. Authenticate -- if root operations are included, a single pkexec password prompt appears. Cancelling skips only the root operations; user-level cleaning still completes.
  6. Done -- a summary dialog shows total space freed. The dashboard re-scans automatically and the cleaning history updates.

Configuration

Configuration is stored as JSON at:

~/.config/mintsweep/config.json

Default values

{
  "categories": {
    "apt_cache": true,
    "orphaned_packages": true,
    "old_kernels": true,
    "thumbnails": true,
    "browser_caches": true,
    "system_logs": true,
    "trash": true,
    "temp_files": true
  },
  "journal_vacuum_days": 14,
  "temp_max_age_days": 7,
  "kernels_to_keep": 2
}
Key Type Default Description
categories.* boolean true Enable/disable individual cleaning categories
journal_vacuum_days integer 14 Days to retain when vacuuming journald
temp_max_age_days integer 7 Only flag temp files older than this many days
kernels_to_keep integer 2 Number of kernel versions to retain

Data files

File Path
Config ~/.config/mintsweep/config.json
History DB ~/.local/share/mintsweep/mintsweep.db

Architecture

mintsweep/
├── __init__.py            # Version and app ID
├── __main__.py            # CLI entry point (argparse, logging setup)
├── app.py                 # GtkApplication — wires config, DB, scanner, cleaner, UI
├── install.sh             # Installer script
│
├── backend/
│   ├── config.py          # ConfigManager — JSON config with defaults
│   └── database.py        # Database — SQLite cleaning history (clean_history table)
│
├── core/
│   ├── scanner.py         # Scanner — ThreadPoolExecutor parallel scan, GObject signals
│   ├── cleaner.py         # Cleaner — threaded clean, user/root separation, DB recording
│   └── privilege.py       # run_root_commands() — batch pkexec via temp script
│
├── services/
│   ├── __init__.py        # ScanResult dataclass
│   ├── apt_service.py     # APT package cache (/var/cache/apt/archives)
│   ├── orphan_service.py  # Orphaned packages (apt autoremove candidates)
│   ├── kernel_service.py  # Old kernels (protects running + latest)
│   ├── cache_service.py   # Thumbnail cache (~/.cache/thumbnails)
│   ├── browser_service.py # Firefox + Chrome/Chromium caches
│   ├── log_service.py     # System logs + journald vacuum
│   ├── trash_service.py   # Trash (~/.local/share/Trash)
│   └── temp_service.py    # Temp files (/tmp, /var/tmp, age-based)
│
└── ui/
    ├── theme.py           # Catppuccin Mocha CSS (apply_theme())
    └── main_window.py     # MainWindow — dashboard, cards, progress, history

Design principles

  • Service pattern -- each cleaning category is a standalone module exposing scan(), clean(items), and root_commands(items). This makes it easy to add new categories.
  • User/root separation -- the Cleaner first runs all user-level operations, then batches all root commands into a single pkexec invocation.
  • GObject signals -- Scanner and Cleaner emit progress and completion signals; the UI connects to these and updates via GLib.idle_add for thread safety.
  • No pip dependencies -- the entire app runs on Python standard library plus system-installed PyGObject.

Uninstalling

sudo rm -rf /opt/mintsweep
sudo rm -f /usr/local/bin/mintsweep
sudo rm -f /usr/share/applications/mintsweep.desktop

# Optional: remove user data
rm -rf ~/.config/mintsweep
rm -rf ~/.local/share/mintsweep

License

MIT License. See LICENSE for details.

About

GTK3 system cleaner for Linux Mint and Ubuntu

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages