Phase 1: Core Foundation
Goal
Establish the basic infrastructure for garbg: project structure, X11 connection, static image rendering, and a minimal CLI.
Tasks
1.1 Project Scaffolding
- Create workspace Cargo.toml with garbg and garbgctl members
- Define workspace dependencies (x11rb, image, tokio, clap, etc.)
- Create module structure under garbg/src/
1.2 X11 Connection
- Connect to X server using x11rb
- Intern required atoms (_XROOTPMAP_ID, ESETROOT_PMAP_ID)
- Create graphics context for drawing
- Handle connection errors gracefully
1.3 Root Window Pixmap Rendering
- Create pixmap from image data
- Convert RGBA to BGRA (X11 native format)
- Set pixmap as root window background
- Set standard atoms for compatibility with other tools
- Clear root window to display new background
- Free old pixmap on wallpaper change
1.4 Static Image Loading
- Load PNG images
- Load JPEG images
- Load WebP images
- Implement scale modes: fill, fit, stretch, center, tile
1.5 Basic CLI
- Parse commands with clap
-
garbg set <source>command -
--modeflag for scale mode -
--monitorflag for target monitor -
--verboselogging support
Deliverables
garbg set ~/path/to/image.pngsets wallpaper- Static images display correctly at screen resolution
- Scale modes work as expected
Files Modified/Created
/garbg/Cargo.toml- workspace config/garbg/garbg/Cargo.toml- main crate config/garbg/garbgctl/Cargo.toml- CLI tool config/garbg/garbg/src/lib.rs- library root/garbg/garbg/src/main.rs- CLI entry point/garbg/garbg/src/x11/mod.rs- X11 module/garbg/garbg/src/x11/connection.rs- X11 connection/garbg/garbg/src/x11/renderer.rs- Pixmap rendering/garbg/garbg/src/x11/monitors.rs- RandR monitor detection/garbg/garbg/src/media/mod.rs- Media module/garbg/garbg/src/media/loader.rs- Image loading/garbg/garbg/src/media/scaler.rs- Image scaling/garbg/garbg/src/config/mod.rs- Config types
View source
| 1 | # Phase 1: Core Foundation |
| 2 | |
| 3 | ## Goal |
| 4 | Establish the basic infrastructure for garbg: project structure, X11 connection, static image rendering, and a minimal CLI. |
| 5 | |
| 6 | ## Tasks |
| 7 | |
| 8 | ### 1.1 Project Scaffolding |
| 9 | - [x] Create workspace Cargo.toml with garbg and garbgctl members |
| 10 | - [x] Define workspace dependencies (x11rb, image, tokio, clap, etc.) |
| 11 | - [x] Create module structure under garbg/src/ |
| 12 | |
| 13 | ### 1.2 X11 Connection |
| 14 | - [x] Connect to X server using x11rb |
| 15 | - [x] Intern required atoms (_XROOTPMAP_ID, ESETROOT_PMAP_ID) |
| 16 | - [x] Create graphics context for drawing |
| 17 | - [ ] Handle connection errors gracefully |
| 18 | |
| 19 | ### 1.3 Root Window Pixmap Rendering |
| 20 | - [x] Create pixmap from image data |
| 21 | - [x] Convert RGBA to BGRA (X11 native format) |
| 22 | - [x] Set pixmap as root window background |
| 23 | - [x] Set standard atoms for compatibility with other tools |
| 24 | - [x] Clear root window to display new background |
| 25 | - [ ] Free old pixmap on wallpaper change |
| 26 | |
| 27 | ### 1.4 Static Image Loading |
| 28 | - [ ] Load PNG images |
| 29 | - [ ] Load JPEG images |
| 30 | - [ ] Load WebP images |
| 31 | - [ ] Implement scale modes: fill, fit, stretch, center, tile |
| 32 | |
| 33 | ### 1.5 Basic CLI |
| 34 | - [x] Parse commands with clap |
| 35 | - [x] `garbg set <source>` command |
| 36 | - [x] `--mode` flag for scale mode |
| 37 | - [x] `--monitor` flag for target monitor |
| 38 | - [ ] `--verbose` logging support |
| 39 | |
| 40 | ## Deliverables |
| 41 | - `garbg set ~/path/to/image.png` sets wallpaper |
| 42 | - Static images display correctly at screen resolution |
| 43 | - Scale modes work as expected |
| 44 | |
| 45 | ## Files Modified/Created |
| 46 | - `/garbg/Cargo.toml` - workspace config |
| 47 | - `/garbg/garbg/Cargo.toml` - main crate config |
| 48 | - `/garbg/garbgctl/Cargo.toml` - CLI tool config |
| 49 | - `/garbg/garbg/src/lib.rs` - library root |
| 50 | - `/garbg/garbg/src/main.rs` - CLI entry point |
| 51 | - `/garbg/garbg/src/x11/mod.rs` - X11 module |
| 52 | - `/garbg/garbg/src/x11/connection.rs` - X11 connection |
| 53 | - `/garbg/garbg/src/x11/renderer.rs` - Pixmap rendering |
| 54 | - `/garbg/garbg/src/x11/monitors.rs` - RandR monitor detection |
| 55 | - `/garbg/garbg/src/media/mod.rs` - Media module |
| 56 | - `/garbg/garbg/src/media/loader.rs` - Image loading |
| 57 | - `/garbg/garbg/src/media/scaler.rs` - Image scaling |
| 58 | - `/garbg/garbg/src/config/mod.rs` - Config types |