A Qt GUI application for Linux that scans for and removes broken desktop application entries (.desktop files) whose executables no longer exist.
- 🔍 Scan for broken desktop files: Automatically searches standard desktop file locations
- 🔐 Superuser support: Uses sudo credentials to read and delete system-owned files
- 🗑️ Batch deletion: Select multiple broken files and delete them all at once
- 🎨 Visual indicators: Root-owned files are highlighted in red
- ✅ Select/deselect all: Easily manage multiple files with a single click
- 📋 Detailed information: Shows application names and file paths with tooltips
~/.local/share/applications//usr/share/applications//usr/local/share/applications//var/lib/flatpak/exports/share/applications/~/.local/share/flatpak/exports/share/applications/
- Qt 5 or Qt 6 with development packages
- C++ compiler with C++11 support
- Make or Ninja build system
- qmake (usually included with Qt)
sudo apt install qtbase5-dev qt5-qmake g++ makesudo dnf install qt5-qtbase-devel gcc-c++ makesudo pacman -S qt5-basesudofor managing root-owned files- Standard Linux desktop environment
git clone https://github.com/ArtNazarov/DesktopFileCleaner.git
cd DesktopFileCleaner# Clean previous builds (if any)
make clean 2>/dev/null || true
rm -f DesktopFileCleaner moc_* 2>/dev/null || true
# Generate Makefile and build
qmake DesktopFileCleaner.pro
makemkdir build
cd build
cmake ..
make# Copy executable to /usr/local/bin
sudo cp DesktopFileCleaner /usr/local/bin/
# Or run directly from build directory
./DesktopFileCleaner-
Launch the application
./DesktopFileCleaner
-
Enter credentials (if checking system files)
- Username: Your sudo username (defaults to current user)
- Password: Your sudo password
-
Scan for broken files
- Click "Find Broken Desktop Files" button
- The application will scan all desktop file locations
- Broken files will appear in the list with checkboxes
-
Review and select files
- Files requiring sudo permissions are shown in red
- Hover over files to see full paths
- Use "Select/Deselect All" checkbox to manage multiple files
-
Delete selected files
- Select the files you want to remove
- Click "Delete Selected Files" button
- Confirm the deletion when prompted
- File Discovery: The app scans standard desktop file directories
- Permission Handling:
- User-owned files are read directly
- Root-owned files are read using sudo credentials
- Broken File Detection:
- Extracts the
Exec=line from each .desktop file - Checks if the executable exists and is executable
- Accounts for both absolute paths and PATH-resolved executables
- Extracts the
- File Deletion:
- User-owned files are deleted directly
- Root-owned files are deleted using sudo
- Password handling: The application temporarily stores your sudo password in memory while scanning and deleting files
- File operations: The app only modifies .desktop files, not executables
- Superuser access: Requires sudo privileges to manage system-wide desktop files
- Recommendation: Review the source code before entering sensitive credentials
For enhanced security, consider:
- Running the application in a sandboxed environment
- Using a dedicated sudo configuration with limited permissions
- Reviewing which files will be deleted before confirming
-
"No desktop files found"
- Ensure you have read permissions for desktop directories
- Enter sudo credentials if checking system files
-
"Permission denied" when deleting
- Make sure sudo credentials are correct
- Check if the file still exists
- Verify you have appropriate permissions
-
Build errors
- Ensure all Qt development packages are installed
- Check Qt version compatibility
- Clean build directory and rebuild
-
Missing system desktop files
- The app shows system files only when sudo credentials are provided
- Enter your sudo password to see all files
Enable debug output by rebuilding with:
qmake "CONFIG+=debug" DesktopFileCleaner.pro
make clean
makeNazarov A.A., Orenburg, Russia, 2025
This project is licensed under the MIT License
Note: Always back up important files before using cleanup utilities. Use this tool at your own risk.
