|
| 1 | +### Future Features |
| 2 | + |
| 3 | +- [x] Execute custom scripts on wallpaper change |
| 4 | +- [ ] Time-recalibration for system hibernation/sleep recovery |
| 5 | +- [ ] Interruptible Sleep Cycle |
| 6 | +- [ ] Randomization Scopes: |
| 7 | + - [x] Within Current Group |
| 8 | + - [ ] Within Current Collection |
| 9 | + - [ ] Across all Collections (excluding Special) |
| 10 | + - [ ] Across all Wallpapers (excluding Special) |
| 11 | +- [ ] Spread collection of wallpapers throughout the day |
| 12 | +- [x] Spread group of wallpapers throughout an hour |
| 13 | +- [ ] Efficient, event-driven execution (no polling or sleeps) |
| 14 | +- [ ] Interactive Terminal User Interface (TUI) / Slint UI Configurator |
| 15 | +- [ ] Inter Process Communication (IPC) support for external control or dynamic updates |
| 16 | +- [ ] Expression kill / restart IPC |
| 17 | +- [ ] Collection switching API |
| 18 | + - Root-level: Collections (e.g., Wallpapers, Catppuccin, Gruvbox, Not_SFW, Dark_Mode) |
| 19 | + - Mid-level: Time-based Wallpaper Items (Entries and Groups) |
| 20 | + - Leaf-level: Wallpapers (image files) |
| 21 | + |
| 22 | + |
| 23 | +```toml |
| 24 | +[backend.custom] |
| 25 | +cmd_check_availability = "backend --version" |
| 26 | +cmd_wallpaper_change = "backend set <img_arguments>" |
| 27 | +supported_extensions = ["jpg", "jpeg", "png", "gif"] |
| 28 | + |
| 29 | +[backend.swww] |
| 30 | +post_command = "~/.config/waypaper/post_wallpaper_change.sh $wallpaper" |
| 31 | +img_arguments = "--transition-type fade" |
| 32 | +``` |
| 33 | + |
| 34 | +## Project Requirements |
| 35 | + |
| 36 | +### Core Features |
| 37 | + |
| 38 | +- [x] 1. Multi-backend support (swww, feh, etc.) |
| 39 | +- [x] 2. 24-hour wallpaper cycling with dedicated wallpaper for each hour |
| 40 | +- [x] 3. Priority-based wallpaper overrides |
| 41 | +- [ ] 4. Collection management for organizing wallpapers by theme |
| 42 | +- [ ] 5. Collection flow control (time-based collection switching) |
| 43 | +- [ ] 6. IPC interface for programmatic wallpaper control |
| 44 | +- [x] 7. Sub-collections for optional wallpaper sets within each hour |
| 45 | +- [ ] 8. Custom script execution support (notifications, pywal integration, etc.) |
| 46 | +- [ ] 9. Randomization with configurable scopes |
| 47 | +- [ ] 10. Per-collection configuration |
| 48 | +- [ ] 11. Time recalibration for system hibernation/sleep recovery |
| 49 | +- [ ] 12. Wallpaper Sourcing Strategies |
| 50 | + - [x] 12.1. Special Collection Strategy |
| 51 | + - [x] 12.2. Time-based Collection Strategy |
| 52 | + - [ ] 12.3. Theme-based Collection Strategy |
| 53 | + - [ ] 12.4. Root Strategy (Wallpaper Dir) |
| 54 | + - [ ] 12.5. Randomized Scope Strategy |
| 55 | +- [ ] 13. Wallpaper Application Algorithms |
| 56 | + - [x] 13.1. 24-hour cycle: Fixed time based on filename |
| 57 | + - [x] 13.2. Spread out (ordered | random): n/m (n = number of wallpapers, m = number of hours) |
| 58 | + - [ ] 13.3. Randomized Scope (Within Collection) |
| 59 | + |
| 60 | +## Design Considerations |
| 61 | + |
| 62 | +### Pseudocode |
| 63 | + |
| 64 | +```c |
| 65 | +// Backend Initialization |
| 66 | +backend = get_backend("backend_name"); |
| 67 | +backend.init() { |
| 68 | + check_if_available(); |
| 69 | + initialize(); |
| 70 | +} |
| 71 | + |
| 72 | +// Wallpaper Sourcing |
| 73 | +wallpaper_dir = config.get("wallpaper_dir"); // Default |
| 74 | +special_dir = config.get("special_dir"); // User-specified |
| 75 | +collection_dir = config.get("collection_dir"); // User-specified |
| 76 | + |
| 77 | +if (wallpapers.empty()) { |
| 78 | + exit(); |
| 79 | +} |
| 80 | + |
| 81 | +// Wallpaper Selection |
| 82 | +String select_wallpaper() { |
| 83 | + hour = get_current_time.hour(); |
| 84 | + |
| 85 | + // Special Collection - High-priority |
| 86 | + special_wallpaper = find_wallpaper_in(special_dir, hour); |
| 87 | + if (special_wallpaper.exists()) return special_wallpaper; |
| 88 | + |
| 89 | + // Randomization |
| 90 | + random_wallpaper = get_random_wallpaper(); |
| 91 | + if (random_wallpaper.exists()) return random_wallpaper; |
| 92 | + |
| 93 | + // Time-based Collection - User specified |
| 94 | + collection_wallpaper = find_wallpaper_in(collection_dir, hour); |
| 95 | + if (collection_wallpaper.exists()) return collection_wallpaper; |
| 96 | + |
| 97 | + // Time-based Default |
| 98 | + wallpaper = find_wallpaper_in(wallpaper_dir, hour); |
| 99 | + if (wallpaper.exists()) return wallpaper; |
| 100 | + |
| 101 | + return null; |
| 102 | +} |
| 103 | + |
| 104 | +backend.apply_wallpaper("wallpaper_path"); |
| 105 | + |
| 106 | +// HELPER FUNCTIONS |
| 107 | + |
| 108 | +String find_wallpaper_in(dir, hour) { |
| 109 | + entry = dir.get(hour); |
| 110 | + if (!entry.exists()) return ""; |
| 111 | + |
| 112 | + // sub-collection |
| 113 | + if (entry.is_dir()) { |
| 114 | + if (randomization.scope == "sub-collection") { |
| 115 | + return entry.get_random_file(); |
| 116 | + } else { |
| 117 | + return entry[0]; // first file |
| 118 | + } |
| 119 | + } |
| 120 | + // wallpaper file |
| 121 | + return entry; |
| 122 | +} |
| 123 | + |
| 124 | +String get_random_wallpaper() { |
| 125 | + if (randomization.scope == "all") { |
| 126 | + return wallpapers.get_random_file(); |
| 127 | + } |
| 128 | + if (randomization.scope == "collection") { |
| 129 | + return collection_dir.get_random_file(); |
| 130 | + } |
| 131 | + return ""; |
| 132 | +} |
| 133 | +``` |
| 134 | +
|
| 135 | +### Priority and Collections |
| 136 | +
|
| 137 | +The system will implement a hierarchical approach to wallpaper selection: |
| 138 | +
|
| 139 | +1. **Collections**: Logical groups of wallpapers sharing a common theme (work, gaming, dark mode, etc.) |
| 140 | +2. **Priority Levels**: |
| 141 | + - High-priority override directories |
| 142 | + - Standard 24-hour cycle directories |
| 143 | + - Default fallback wallpapers |
| 144 | +3. **Collection Flow**: Automatic switching between collections based on time of day |
| 145 | + - Example: Light wallpapers during day, dark wallpapers at night |
| 146 | +
|
| 147 | +### Randomization |
| 148 | +
|
| 149 | +Wallpaper randomization will be implemented with configurable scopes: |
| 150 | +
|
| 151 | +- Within a specific hour's sub-collection |
| 152 | +- Across an entire collection |
| 153 | +- Across all available wallpapers |
| 154 | +
|
| 155 | +### Time Management |
| 156 | +
|
| 157 | +The system will handle time-related challenges: |
| 158 | +
|
| 159 | +- Recalibration after system sleep/hibernation |
| 160 | +- Scheduling next wallpaper change |
| 161 | +- Time-based collection transitions |
| 162 | +
|
| 163 | +## Dataflow |
| 164 | +
|
| 165 | +Initialization -> Decision -> Execution -> Waiting |
| 166 | +
|
| 167 | +### Initialization |
| 168 | +
|
| 169 | +- Load system configuration |
| 170 | +- Initialize logging system |
| 171 | +- Initialize backend interface |
| 172 | +
|
| 173 | +### Decision |
| 174 | +
|
| 175 | +- If special collection is active, use it |
| 176 | +- Else If time-based collection is active, use it |
| 177 | + - If sub-collection is available, use it |
| 178 | + - Else use default collection |
| 179 | +- Else skip |
| 180 | +
|
| 181 | +## Implementation Strategy |
| 182 | +
|
| 183 | +### Backend Architecture |
| 184 | +
|
| 185 | +- Standardized backend interface with consistent I/O format |
| 186 | +- Each backend implementation must provide: |
| 187 | + - Initialization function (availability check, setup) |
| 188 | + - Wallpaper application function |
| 189 | + - Configuration options |
| 190 | + - Supported extensions |
| 191 | +
|
| 192 | +### Wallpaper Application Algorithms |
| 193 | +
|
| 194 | +- 24-hour cycle: Fixed time based on filename |
| 195 | +- Spread out (ordered | random): n/m (n = number of wallpapers, m = number of hours) |
| 196 | + - Special Collection could conflict with this due to inconsistent timings |
| 197 | + - Would be problematic on large collections |
| 198 | +
|
| 199 | +### Sub-collection Structure |
| 200 | +
|
| 201 | +- Directory-based organization following the pattern: |
| 202 | + ``` |
| 203 | + wallpaper_dir/ |
| 204 | + ├── 0000.jpg # Standard wallpaper for midnight (00:00) |
| 205 | + ├── 0500.jpg # Standard wallpaper for 5:00 |
| 206 | + ├── 2100.jpg # Standard wallpaper for 21:00 |
| 207 | + ├── 2100/ # Sub-collection for 21:00 |
| 208 | + │ ├── E.jpg # Alternative wallpapers |
| 209 | + │ ├── Zucc.jpg # for midnight hour |
| 210 | + │ └── ... |
| 211 | + ├── 2200.jpg # Standard wallpaper for 1:00 |
| 212 | + └── ... |
| 213 | + ``` |
| 214 | + - Follow this pattern for multiple collections: |
| 215 | + ``` |
| 216 | + wallpaper_dir/ |
| 217 | + │ special/ # High-priority override directory |
| 218 | + │ └── 0500.jpg # Wallpaper override for 5:00 |
| 219 | + │ collection1/ # Standard wallpaper collection |
| 220 | + │ └── ... |
| 221 | + │ collection2/ |
| 222 | + │ ├── 0000.jpg # Standard wallpaper for midnight (00:00) |
| 223 | + │ ├── 0000/ # Sub-collection for midnight |
| 224 | + │ │ ├── E.jpg # Alternative wallpapers |
| 225 | + │ │ ├── Zucc.jpg # for midnight hour |
| 226 | + │ │ └── ... |
| 227 | + │ ├── 0100.jpg # Standard wallpaper for 1:00 |
| 228 | + │ └── ... |
| 229 | + └── ... |
| 230 | + ``` |
| 231 | +- Sub-collections can be used in both standard and high-priority directories |
| 232 | +- Dir names with `HHMM` format are treated as sub-collections |
| 233 | +- Dir names with any other format are treated as collections |
| 234 | +
|
| 235 | +### Collection Flow |
| 236 | +
|
| 237 | +- This can be achieved via cli commands to switch between collections. |
| 238 | +
|
| 239 | +### Configuration System |
| 240 | +
|
| 241 | +- Hierarchical configuration: |
| 242 | + - System-wide defaults |
| 243 | + - Per-collection settings |
| 244 | + - Time-specific overrides |
| 245 | +- Support for external script integration |
| 246 | +- Backend-specific parameters |
| 247 | +
|
| 248 | +### IPC Interface |
| 249 | +
|
| 250 | +- Socket-based communication protocol |
| 251 | +- Command API for: |
| 252 | + - Immediate wallpaper changes |
| 253 | + - Collection switching |
| 254 | + - Configuration updates |
| 255 | + - Status queries |
0 commit comments