Background Picker
A fast, efficient Rust GUI application for scanning directories and selecting desktop backgrounds from image thumbnails. Features intelligent caching and seamless integration with file manager thumbnails.
Features
🖼️ Smart Image Management
- Recursively scans directories for image files
- Displays images as thumbnails in collapsible folder hierarchy
- Supports common formats: JPG, JPEG, PNG, GIF, BMP, WebP
- Configurable thumbnail sizes
⚡ Performance & Caching
- Intelligent thumbnail caching using freedesktop.org standard
- Shares cache with pcmanfm, nautilus, and other file managers
- Parallel thumbnail generation for maximum speed
- Instant loading for previously cached images
- Progressive loading with visual feedback
🚀 Flexible Operation Modes
- GUI Mode (default): Interactive thumbnail browser
- Pregenerate Mode (
--pregenerate): Batch cache generation and exit - Debug Mode (
--debug): Detailed operation logging
🎛️ Configurable
- Customizable background setting command (defaults to
feh --bg-max) - Persistent state saving (window size, last selection)
- All settings configurable via command line
Installation
# Clone and build
# Or run directly
Usage
Interactive Mode (Default)
# Browse current directory
# Browse specific directory with custom settings
# Built binary
Batch Cache Generation
# Pre-generate thumbnails for faster browsing later
# With detailed progress output
Two-Step Workflow (Recommended for Large Collections)
# Step 1: Generate all thumbnails (runs in background)
# Step 2: Browse with instant thumbnails
Command Line Options
| Option | Short | Default | Description |
|---|---|---|---|
--directory |
-d |
. |
Directory to scan for images |
--thumbnail-size |
-t |
150 |
Thumbnail size in pixels |
--command |
-c |
"feh --bg-max" |
Command to set background |
--state-file |
-s |
background-picker-state.yaml |
State file path |
--debug |
Enable detailed debug output | ||
--pregenerate |
Generate thumbnails and exit (no GUI) | ||
--help |
-h |
Show help information |
Background Setting Commands
The application supports any command-line wallpaper tool:
# feh (default - maintains aspect ratio)
# feh (fills screen, may crop)
# nitrogen
# Custom script
User Interface
- Click thumbnail: Set as desktop background and exit application
- Expand folders: Click folder names to show/hide thumbnails
- Hover tooltips: See full file paths
- Progress indicators: Visual feedback during thumbnail loading
- Responsive design: Handles collections of any size
Performance Features
Thumbnail Caching
- Uses standard
~/.cache/thumbnails/directory - Compatible with pcmanfm, nautilus, thunar, and other file managers
- Automatic cache validation (regenerates if file modified)
- Supports both normal (128x128) and large (256x256) thumbnail sizes
Parallel Processing
- Multi-threaded thumbnail generation using Rayon
- Efficient batch processing for large collections
- Non-blocking UI updates
- Smart memory management
Cache Integration
# Browse images in file manager first (creates thumbnails)
# Then use background picker (instant thumbnails!)
Dependencies
Built with modern Rust ecosystem:
- egui/eframe - Immediate mode GUI framework
- image - Fast image processing and format support
- rayon - Data parallelism for thumbnail generation
- clap - Command line argument parsing
- serde/serde_yaml - Configuration and state persistence
- walkdir - Efficient directory traversal
- dirs - Cross-platform directory locations
- sha1 - Thumbnail cache key generation
Requirements
- Rust toolchain (2021 edition)
- Wallpaper utility:
feh,nitrogen, or custom command - Linux/Unix environment (uses freedesktop.org standards)
Examples
Basic Usage
# Quick browse and select
# Browse specific folder
Large Collections
# Pre-generate cache for 1000+ images
# Later: instant browsing
Custom Workflows
# Use with different wallpaper tools
# Custom thumbnail size for high-DPI displays
# Debug thumbnail cache behavior
Scripting
#!/bin/bash
# Batch generate thumbnails for multiple directories
for; do
done
The application automatically quits after setting a background, making it perfect for quick wallpaper changes and integration with desktop shortcuts or scripts.