m3wal 1.1.7__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. m3wal-1.1.7/LICENSE.txt +21 -0
  2. m3wal-1.1.7/MANIFEST.in +3 -0
  3. m3wal-1.1.7/PKG-INFO +658 -0
  4. m3wal-1.1.7/README.md +613 -0
  5. m3wal-1.1.7/m3wal/__init__.py +0 -0
  6. m3wal-1.1.7/m3wal/m3wal.py +1201 -0
  7. m3wal-1.1.7/m3wal/templates/colors-alacritty.toml.template +23 -0
  8. m3wal-1.1.7/m3wal/templates/colors-nvim.lua.template +199 -0
  9. m3wal-1.1.7/m3wal/templates/colors-tty.sh.template +21 -0
  10. m3wal-1.1.7/m3wal/templates/colors-waybar.css.template +28 -0
  11. m3wal-1.1.7/m3wal/templates/colors.Xresources.template +176 -0
  12. m3wal-1.1.7/m3wal/templates/colors.css.template +99 -0
  13. m3wal-1.1.7/m3wal/templates/colors.hs.template +128 -0
  14. m3wal-1.1.7/m3wal/templates/colors.json.template +71 -0
  15. m3wal-1.1.7/m3wal/templates/colors.scss.template +127 -0
  16. m3wal-1.1.7/m3wal/templates/colors.sh.template +117 -0
  17. m3wal-1.1.7/m3wal/templates/colors.template +17 -0
  18. m3wal-1.1.7/m3wal/templates/colors.yml.template +22 -0
  19. m3wal-1.1.7/m3wal/templates/dunst-config.template +20 -0
  20. m3wal-1.1.7/m3wal/templates/gtk.3.20.template +110 -0
  21. m3wal-1.1.7/m3wal/templates/gtk.css.template +91 -0
  22. m3wal-1.1.7/m3wal/templates/gtkrc.template +797 -0
  23. m3wal-1.1.7/m3wal/templates/kdeglobals.template +21 -0
  24. m3wal-1.1.7/m3wal/templates/kitty.conf.template +29 -0
  25. m3wal-1.1.7/m3wal/templates/polybar-config.template +19 -0
  26. m3wal-1.1.7/m3wal/templates/qt5ct.conf.template +15 -0
  27. m3wal-1.1.7/m3wal/templates/qt6ct.conf.template +4 -0
  28. m3wal-1.1.7/m3wal/templates/rmpc.ron.template +171 -0
  29. m3wal-1.1.7/m3wal/templates/rofi.rasi.template +133 -0
  30. m3wal-1.1.7/m3wal/templates/sequences.template +1 -0
  31. m3wal-1.1.7/m3wal/templates/zathurarc.template +77 -0
  32. m3wal-1.1.7/m3wal.egg-info/PKG-INFO +658 -0
  33. m3wal-1.1.7/m3wal.egg-info/SOURCES.txt +37 -0
  34. m3wal-1.1.7/m3wal.egg-info/dependency_links.txt +1 -0
  35. m3wal-1.1.7/m3wal.egg-info/entry_points.txt +2 -0
  36. m3wal-1.1.7/m3wal.egg-info/requires.txt +2 -0
  37. m3wal-1.1.7/m3wal.egg-info/top_level.txt +1 -0
  38. m3wal-1.1.7/setup.cfg +4 -0
  39. m3wal-1.1.7/setup.py +67 -0
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2011-2025 Diaz
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,3 @@
1
+ include README.md
2
+ include LICENSE
3
+ recursive-include m3wal/templates *.template
m3wal-1.1.7/PKG-INFO ADDED
@@ -0,0 +1,658 @@
1
+ Metadata-Version: 2.4
2
+ Name: m3wal
3
+ Version: 1.1.7
4
+ Summary: Material 3 wallpaper-based color scheme generator for Linux desktop theming
5
+ Home-page: https://github.com/MDiaznf23/m3wal
6
+ Author: Diaz
7
+ License: MIT
8
+ Project-URL: Bug Tracker, https://github.com/MDiaznf23/m3wal/issues
9
+ Project-URL: Documentation, https://github.com/MDiaznf23/m3wal#readme
10
+ Project-URL: Source Code, https://github.com/MDiaznf23/m3wal
11
+ Keywords: material-design,material3,color-scheme,wallpaper,theming,rice,ricing,linux,desktop,gtk,customization
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Intended Audience :: End Users/Desktop
15
+ Classifier: Topic :: Desktop Environment
16
+ Classifier: Topic :: System :: Installation/Setup
17
+ Classifier: Topic :: Utilities
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.7
20
+ Classifier: Programming Language :: Python :: 3.8
21
+ Classifier: Programming Language :: Python :: 3.9
22
+ Classifier: Programming Language :: Python :: 3.10
23
+ Classifier: Programming Language :: Python :: 3.11
24
+ Classifier: Programming Language :: Python :: 3.12
25
+ Classifier: License :: OSI Approved :: MIT License
26
+ Classifier: Operating System :: POSIX :: Linux
27
+ Classifier: Environment :: Console
28
+ Requires-Python: >=3.7
29
+ Description-Content-Type: text/markdown
30
+ License-File: LICENSE.txt
31
+ Requires-Dist: material-color-utilities
32
+ Requires-Dist: Pillow
33
+ Dynamic: author
34
+ Dynamic: classifier
35
+ Dynamic: description
36
+ Dynamic: description-content-type
37
+ Dynamic: home-page
38
+ Dynamic: keywords
39
+ Dynamic: license
40
+ Dynamic: license-file
41
+ Dynamic: project-url
42
+ Dynamic: requires-dist
43
+ Dynamic: requires-python
44
+ Dynamic: summary
45
+
46
+ # M3WAL
47
+
48
+ > Material 3 Wallpaper-based Color Scheme Generator
49
+
50
+ <p align="center">
51
+ <img src="screenshots/demo-1.png" alt="M3WAL Palette 1" width="800">
52
+ </p>
53
+
54
+ <p align="center">
55
+ <img src="screenshots/demo-2.png" alt="M3WAL Palette 2" width="800">
56
+ </p>
57
+
58
+ <p align="center">
59
+ <img src="screenshots/demo-3.png" alt="M3WAL Palette 3" width="800">
60
+ </p>
61
+
62
+
63
+ Generate beautiful Material 3 color schemes from your wallpapers and apply them system-wide to your Linux desktop.
64
+
65
+ ## Features
66
+
67
+ - Extract Material 3 color schemes from any wallpaper
68
+ - Auto-detect light/dark mode based on wallpaper brightness
69
+ - 7 Material Color Variants (Content, Vibrant, Expressive, etc.) + AUTO variant
70
+ - Export to multiple formats (JSON, CSS)
71
+ - **Smart template system** with bundled templates and custom override support
72
+ - **Two operation modes:** Generator-only or Full ricing mode
73
+ - Automatic wallpaper setting with `feh`
74
+ - Deploy configs to multiple applications automatically
75
+ - **Parallel template processing** for faster execution (ThreadPoolExecutor with 4 workers)
76
+ - **RGB color format support** for KDE and other applications
77
+ - **Hook scripts system** for custom actions with environment variables
78
+ - **Improved terminal color contrast** for light mode
79
+ - **GTK theme reloading** via gsettings and xsettingsd
80
+
81
+ ## Installation
82
+
83
+ ### From PyPI
84
+
85
+ ```bash
86
+ pip install m3wal
87
+ ```
88
+
89
+ ### From Source
90
+
91
+ ```bash
92
+ git clone https://github.com/MDiaznf23/m3wal.git
93
+ cd m3wal
94
+ pip install -e .
95
+ ```
96
+
97
+ ### Dependencies
98
+
99
+ ```bash
100
+ pip install material-color-utilities Pillow
101
+ ```
102
+
103
+ **Optional system dependencies:**
104
+ - `feh` - for setting wallpapers
105
+ - `xrdb` - for applying Xresources
106
+ - `xsettingsd` - for GTK theme reloading
107
+ - `gsettings` - for GNOME/GTK theme management
108
+
109
+ ## Quick Start
110
+
111
+ ```bash
112
+ # Basic usage (auto-detect mode, uses config default)
113
+ m3wal /path/to/wallpaper.jpg
114
+
115
+ # Generator-only mode (no system changes)
116
+ m3wal wallpaper.jpg --generator-only
117
+
118
+ # Full mode (apply all configurations)
119
+ m3wal wallpaper.jpg --full
120
+
121
+ # Auto-select best variant based on wallpaper
122
+ m3wal wallpaper.jpg --variant AUTO
123
+
124
+ # Specify mode and variant
125
+ m3wal wallpaper.jpg --mode dark --variant VIBRANT
126
+ ```
127
+
128
+ ## Usage
129
+
130
+ ### Command Line
131
+
132
+ ```bash
133
+ m3wal <wallpaper_path> [options]
134
+ ```
135
+
136
+ **Options:**
137
+
138
+ | Option | Short | Description |
139
+ |--------|-------|-------------|
140
+ | `--mode` | `-m` | Color scheme mode: `light`, `dark`, or `auto` |
141
+ | `--variant` | `-v` | Material 3 variant (see below) |
142
+ | `--generator-only` | `-g` | Only generate colors, skip ricing |
143
+ | `--full` | `-f` | Apply all configurations (ricing mode) |
144
+
145
+ **Variants:**
146
+ - `AUTO` - **NEW!** Automatically selects best variant based on wallpaper analysis
147
+ - `CONTENT` (default) - Based on wallpaper content
148
+ - `VIBRANT` - More saturated colors
149
+ - `EXPRESSIVE` - Maximum chroma
150
+ - `NEUTRAL` - Subdued, neutral colors
151
+ - `TONALSPOT` - Single accent color
152
+ - `FIDELITY` - Closest to source color
153
+ - `MONOCHROME` - Grayscale palette
154
+
155
+ ### AUTO Variant Selection
156
+
157
+ The `AUTO` variant intelligently analyzes your wallpaper to select the best color variant:
158
+
159
+ ```bash
160
+ m3wal wallpaper.jpg --variant AUTO
161
+ ```
162
+
163
+ **Selection Logic:**
164
+ - **MONOCHROME** - For grayscale wallpapers (saturation < 0.10)
165
+ - **NEUTRAL** - For muted, consistent tones (saturation < 0.30, low variance)
166
+ - **EXPRESSIVE** - For diverse, colorful images (saturation > 0.40, high hue variety)
167
+ - **FIDELITY** - For natural color palettes (saturation 0.25-0.50, consistent)
168
+ - **VIBRANT** - For bold, saturated wallpapers (saturation > 0.60)
169
+ - **CONTENT** - Default safe choice for balanced images
170
+
171
+ The AUTO selection will print the chosen variant and reasoning:
172
+ ```
173
+ [AUTO] Selected variant: VIBRANT
174
+ [AUTO] Reason: Bold colors (sat=0.68)
175
+ ```
176
+
177
+ ### Operation Modes
178
+
179
+ M3WAL supports two operation modes:
180
+
181
+ #### 1. Generator Mode (`--generator-only` or `-g`)
182
+ Only generates color schemes without applying them to your system:
183
+ - Analyzes wallpaper
184
+ - Generates color scheme
185
+ - Exports JSON and CSS files
186
+ - Creates palette preview
187
+ - **No system modifications**
188
+
189
+ Perfect for:
190
+ - Testing color schemes
191
+ - Generating colors for manual use
192
+ - CI/CD pipelines
193
+ - Color scheme preview
194
+
195
+ #### 2. Full Mode (`--full` or `-f`)
196
+ Generates colors AND applies them system-wide:
197
+ - All generator mode features
198
+ - Applies colors to all templates
199
+ - Deploys configs to applications
200
+ - Reloads GTK themes
201
+ - Runs hook scripts
202
+ - Applies Xresources
203
+ - Sets wallpaper with feh
204
+ - Creates wallpaper symlink
205
+ - Runs post scripts
206
+
207
+ Perfect for:
208
+ - Complete rice setup
209
+ - Automatic theming
210
+ - Daily wallpaper changes
211
+
212
+ ### Configuration
213
+
214
+ Config file: `~/.config/m3-colors/m3-colors.conf`
215
+
216
+ ```ini
217
+ [General]
218
+ mode = auto
219
+ variant = AUTO
220
+ brightness_threshold = 128
221
+ operation_mode = full # 'generator' or 'full'
222
+
223
+ [Paths]
224
+ templates_dir = templates
225
+ cache_dir = ~/.cache/m3-colors
226
+ config_dir = ~/.config/m3-colors
227
+
228
+ [Features]
229
+ set_wallpaper = true
230
+ apply_xresources = true
231
+ generate_palette_preview = true
232
+ run_post_script = true
233
+ create_symlink = true
234
+
235
+ [PostScript]
236
+ script_path = m3wal-post.sh
237
+
238
+ [Hooks]
239
+ scripts_dir = ~/.config/m3-colors/hooks
240
+
241
+ [Hook.Scripts]
242
+ enabled = false
243
+ scripts = eww.sh
244
+ ```
245
+
246
+ **Configuration Options:**
247
+
248
+ - `operation_mode`: Default operation mode when no flag is specified
249
+ - `generator`: Only generate colors
250
+ - `full`: Generate and apply (default)
251
+
252
+ - `variant`: Can now be set to `AUTO` for automatic variant selection
253
+
254
+ - **Hook Scripts:** Custom scripts that run with color environment variables
255
+ - Enable with `[Hook.Scripts] enabled = true`
256
+ - Scripts receive all colors as environment variables (e.g., `$M3_M3PRIMARY`)
257
+ - Access metadata: `$M3_MODE`, `$M3_WALLPAPER`
258
+
259
+ ### Templates System
260
+
261
+ M3WAL now features a **smart template system** with bundled templates and custom override support.
262
+
263
+ #### Template Loading Priority:
264
+
265
+ 1. **Bundled Templates** (shipped with m3wal package) - loaded as fallback
266
+ 2. **Custom Templates** (`~/.config/m3-colors/templates/`) - override bundled templates
267
+ 3. **Specified Directory** (via `--templates-dir` argument) - highest priority
268
+
269
+ **How it works:**
270
+
271
+ ```bash
272
+ # Uses bundled templates + custom overrides
273
+ m3wal wallpaper.jpg --full
274
+
275
+ # Found 15 bundled template(s)
276
+ # Found 3 custom template(s)
277
+ # Using custom override: kitty.conf.template
278
+ # Using custom override: i3.config.template
279
+ ```
280
+
281
+ **Custom templates with the same name will override bundled templates**, allowing you to:
282
+ - Use bundled templates out-of-the-box
283
+ - Customize only specific templates you need
284
+ - Keep your modifications while getting new bundled templates in updates
285
+
286
+ #### Creating Custom Templates
287
+
288
+ Create templates in `~/.config/m3-colors/templates/`
289
+
290
+ **Example template** (`myapp.conf.template`):
291
+
292
+ ```
293
+ background={{m3surface}}
294
+ foreground={{m3onSurface}}
295
+ primary={{m3primary}}
296
+ accent={{m3secondary}}
297
+
298
+ # RGB format (for KDE)
299
+ background_rgb={{m3surface_rgb}}
300
+
301
+ # Metadata
302
+ wallpaper={{wallpaper_path}}
303
+ mode={{mode}}
304
+ ```
305
+
306
+ **Available color variables:**
307
+
308
+ **Material 3 Colors:**
309
+ - Primary: `m3primary`, `m3onPrimary`, `m3primaryContainer`, `m3onPrimaryContainer`, `m3primaryFixed`, `m3primaryFixedDim`, `m3onPrimaryFixed`, `m3onPrimaryFixedVariant`
310
+ - Secondary: `m3secondary`, `m3onSecondary`, `m3secondaryContainer`, `m3onSecondaryContainer`, `m3secondaryFixed`, `m3secondaryFixedDim`, `m3onSecondaryFixed`, `m3onSecondaryFixedVariant`
311
+ - Tertiary: `m3tertiary`, `m3onTertiary`, `m3tertiaryContainer`, `m3onTertiaryContainer`, `m3tertiaryFixed`, `m3tertiaryFixedDim`, `m3onTertiaryFixed`, `m3onTertiaryFixedVariant`
312
+ - Error: `m3error`, `m3onError`, `m3errorContainer`, `m3onErrorContainer`
313
+ - Surface: `m3surface`, `m3onSurface`, `m3surfaceVariant`, `m3onSurfaceVariant`, `m3surfaceDim`, `m3surfaceBright`, `m3surfaceContainerLowest`, `m3surfaceContainerLow`, `m3surfaceContainer`, `m3surfaceContainerHigh`, `m3surfaceContainerHighest`
314
+ - Outline: `m3outline`, `m3outlineVariant`
315
+ - Inverse: `m3inverseSurface`, `m3inverseOnSurface`, `m3inversePrimary`
316
+ - Other: `m3shadow`, `m3scrim`
317
+
318
+ **Terminal Colors:** `term0` to `term15`
319
+
320
+ **RGB Format:** Add `_rgb` suffix to any color (e.g., `m3primary_rgb` outputs `255,0,128`)
321
+
322
+ **Metadata:** `wallpaper_path`, `mode`, `source_color`
323
+
324
+ ### Deployment
325
+
326
+ Configure deployment in `~/.config/m3-colors/deploy.json`:
327
+
328
+ ```json
329
+ {
330
+ "deployments": [
331
+ {
332
+ "source": "colors-nvim.lua",
333
+ "destination": "~/.config/nvim/lua/themes/material3.lua"
334
+ },
335
+ {
336
+ "source": "kitty.conf",
337
+ "destination": "~/.config/kitty/colors.conf"
338
+ },
339
+ {
340
+ "source": "gtkrc",
341
+ "destination": "~/.local/share/themes/FlatColor/gtk-2.0/gtkrc"
342
+ }
343
+ ]
344
+ }
345
+ ```
346
+
347
+ The `source` field refers to the **output filename** (template name without `.template` extension).
348
+
349
+ ### Hook Scripts
350
+
351
+ Create custom hook scripts in `~/.config/m3-colors/hooks/`:
352
+
353
+ **Example hook script** (`reload-apps.sh`):
354
+
355
+ ```bash
356
+ #!/bin/bash
357
+
358
+ # Colors are available as environment variables
359
+ echo "Primary color: $M3_M3PRIMARY"
360
+ echo "Mode: $M3_MODE"
361
+ echo "Wallpaper: $M3_WALLPAPER"
362
+
363
+ # Reload applications
364
+ killall -USR1 kitty
365
+ i3-msg reload
366
+ notify-send "Theme Updated" "Applied $M3_MODE mode"
367
+ ```
368
+
369
+ **Available environment variables in hook scripts:**
370
+ - `M3_MODE` - Current mode (light/dark)
371
+ - `M3_WALLPAPER` - Wallpaper path
372
+ - `M3_M3PRIMARY`, `M3_M3SECONDARY`, etc. - All color values (uppercase)
373
+ - All RGB values: `M3_M3PRIMARY_RGB`, etc.
374
+
375
+ Enable hook scripts in config:
376
+ ```ini
377
+ [Hook.Scripts]
378
+ enabled = true
379
+ scripts = reload-apps.sh, notify.sh
380
+
381
+ [Hooks]
382
+ scripts_dir = ~/.config/m3-colors/hooks
383
+ ```
384
+
385
+ ### Post Script
386
+
387
+ Add custom actions in `~/.config/m3-colors/m3wal-post.sh`:
388
+
389
+ ```bash
390
+ #!/bin/bash
391
+ # Reload applications
392
+ killall -USR1 kitty
393
+ i3-msg reload
394
+ ```
395
+
396
+ **Difference between Hook Scripts and Post Script:**
397
+ - **Hook Scripts**: Run with color environment variables, multiple scripts supported, enable/disable per script
398
+ - **Post Script**: Single script, runs at the end, no environment variables
399
+
400
+ ## Output Files
401
+
402
+ Generated files are saved in multiple locations:
403
+
404
+ ### `~/.config/m3-colors/output/`
405
+ - `{wallpaper}_{variant}_scheme.json` - Full color scheme in JSON
406
+ - `{wallpaper}_{variant}_scheme.css` - CSS variables for web projects
407
+
408
+ ### `~/.config/m3-colors/sample/`
409
+ - `{wallpaper}_{variant}_palette.png` - Visual palette preview (16-column grid)
410
+ - `{wallpaper}_all_variants.png` - **NEW!** Preview of all 7 variants in one image
411
+
412
+ ### `~/.cache/m3-colors/`
413
+ - Template-generated config files (output from templates)
414
+ - Deployed to applications via deploy.json
415
+
416
+ ### `~/.config/m3-colors/`
417
+ - `current_wallpaper` - Symlink to currently active wallpaper
418
+
419
+ ## Supported Applications
420
+
421
+ Out-of-the-box bundled templates for:
422
+
423
+ - **Terminals:** Kitty, Alacritty, TTY
424
+ - **WM/DE:** i3, Polybar, Waybar, Dunst
425
+ - **Editors:** Neovim, Zathura
426
+ - **Launchers:** Rofi
427
+ - **Music:** RMPC
428
+ - **Themes:** GTK 2/3/4, KDE
429
+ - **X11:** Xresources
430
+
431
+ **You can override any bundled template** by creating a file with the same name in `~/.config/m3-colors/templates/`.
432
+
433
+ ## Python API
434
+
435
+ ```python
436
+ from m3wal import M3WAL, M3Color
437
+
438
+ # Generator mode (M3Color class)
439
+ m3 = M3Color("wallpaper.jpg")
440
+ analysis = m3.analyze_wallpaper()
441
+
442
+ # Auto-select variant
443
+ variant, reason = m3.auto_select_variant()
444
+ print(f"Selected: {variant}, Reason: {reason}")
445
+
446
+ # Generate scheme
447
+ colors = m3.generate_scheme(mode="dark", variant="AUTO")
448
+ m3.export_json(variant="VIBRANT")
449
+ m3.export_css(variant="VIBRANT")
450
+ m3.generate_palette_preview()
451
+
452
+ # Generate all variants preview
453
+ m3.generate_all_variants_preview()
454
+
455
+ # Full mode (M3WAL class - extends M3Color)
456
+ m3wal = M3WAL("wallpaper.jpg")
457
+ m3wal.analyze_wallpaper()
458
+ m3wal.generate_scheme(mode="dark", variant="CONTENT")
459
+
460
+ # Apply to all templates (parallel processing with fallback system)
461
+ # Automatically uses bundled templates + custom overrides
462
+ generated_files = m3wal.apply_all_templates()
463
+
464
+ # Or specify custom templates directory
465
+ generated_files = m3wal.apply_all_templates(templates_dir="/path/to/templates")
466
+
467
+ # Deploy configs
468
+ m3wal.deploy_configs()
469
+
470
+ # Reload GTK theme
471
+ m3wal.reload_gtk_theme()
472
+
473
+ # Run hook scripts
474
+ m3wal.run_hook_scripts()
475
+
476
+ # Apply Xresources
477
+ m3wal.apply_xresources()
478
+
479
+ # Set wallpaper
480
+ m3wal.set_wallpaper()
481
+
482
+ # Create symlink
483
+ m3wal.create_wallpaper_symlink()
484
+
485
+ # Run post script
486
+ m3wal.run_post_script()
487
+ ```
488
+
489
+ ## Examples
490
+
491
+ ```bash
492
+ # Auto mode with AUTO variant (intelligent selection)
493
+ m3wal ~/Pictures/sunset.jpg --variant AUTO
494
+
495
+ # Generator-only mode (no system changes)
496
+ m3wal ~/Pictures/sunset.jpg -g
497
+
498
+ # Full mode with dark theme and auto-selected variant
499
+ m3wal ~/Pictures/landscape.jpg --full --mode dark --variant AUTO
500
+
501
+ # Light mode with expressive variant
502
+ m3wal ~/Pictures/abstract.jpg -f -m light -v EXPRESSIVE
503
+
504
+ # Auto-detect everything
505
+ m3wal ~/Pictures/wallpaper.jpg --full --variant AUTO
506
+ ```
507
+
508
+ ## How It Works
509
+
510
+ ### Generator Mode Flow:
511
+ 1. **Analyze** wallpaper brightness to determine light/dark mode
512
+ 2. **Auto-select variant** (if `AUTO` is specified) based on saturation, hue variety, and color characteristics
513
+ 3. **Extract** dominant colors using Material Color Utilities
514
+ 4. **Generate** complete Material 3 color scheme (50+ colors + 16 terminal colors)
515
+ 5. **Export** JSON and CSS files to `~/.config/m3-colors/output/`
516
+ 6. **Create** visual palette preview (16-column grid, dynamic rows)
517
+
518
+ ### Full Mode Flow:
519
+ 1. All generator mode steps
520
+ 2. **Load templates** with smart fallback system:
521
+ - Load bundled templates (from package)
522
+ - Load custom templates (override bundled if same name)
523
+ - Load from specified directory (highest priority)
524
+ 3. **Apply** colors to all templates (parallel processing with ThreadPoolExecutor, 4 workers)
525
+ 4. **Deploy** configs to target applications via deploy.json
526
+ 5. **Reload** GTK themes (gsettings + xsettingsd)
527
+ 6. **Execute** hook scripts with color environment variables
528
+ 7. **Apply** Xresources with xrdb
529
+ 8. **Set** wallpaper with feh
530
+ 9. **Create** symlink to current wallpaper
531
+ 10. **Run** post script for additional actions
532
+
533
+ ## Performance Improvements
534
+
535
+ - **Parallel template processing:** Uses ThreadPoolExecutor with 4 workers for I/O-bound tasks
536
+ - **Smart template loading:** Single pass through template directories with deduplication
537
+ - **Single color extraction:** Colors extracted once and reused across all operations
538
+ - **Efficient RGB conversion:** RGB values pre-calculated and cached with `_rgb` suffix
539
+ - **Optimized palette preview:** 16-column grid layout with dynamic row calculation
540
+ - **Bundled templates:** No need to copy templates manually, works out-of-the-box
541
+
542
+ ## Template System Details
543
+
544
+ ### Bundled Templates
545
+ M3WAL ships with pre-configured templates for popular applications. These are loaded automatically from the package.
546
+
547
+ ### Custom Templates
548
+ Place your custom templates in `~/.config/m3-colors/templates/`. Files with the same name as bundled templates will override them.
549
+
550
+ ### Template Discovery Flow:
551
+ ```
552
+ 1. Load bundled templates (fallback)
553
+ └─> Found 15 bundled template(s)
554
+
555
+ 2. Load custom templates (override)
556
+ └─> Found 3 custom template(s)
557
+ └─> Using custom override: kitty.conf.template
558
+
559
+ 3. Load specified directory (highest priority)
560
+ └─> Using specified directory: /path/to/templates
561
+ ```
562
+
563
+ ### Benefits:
564
+ - ✅ Works out-of-the-box with bundled templates
565
+ - ✅ Customize only what you need
566
+ - ✅ Keep custom modifications across updates
567
+ - ✅ Easy to share custom templates
568
+ - ✅ No manual template copying required
569
+
570
+ ## Terminal Colors
571
+
572
+ Terminal color mapping optimized for both modes:
573
+
574
+ **Dark Mode:** High-contrast mapping for readability
575
+ **Light Mode:** Enhanced visibility with proper contrast:
576
+ - `term0`: Surface container (background)
577
+ - `term1-6`: Primary, secondary, tertiary variants
578
+ - `term7`: On surface variant (foreground)
579
+ - `term8-15`: Accent colors with adequate contrast
580
+
581
+ ## GTK Theme Reloading
582
+
583
+ M3WAL automatically reloads GTK themes using two methods:
584
+
585
+ 1. **gsettings:** Toggles GTK theme to trigger reload
586
+ 2. **xsettingsd:** Restarts xsettingsd daemon with new config
587
+
588
+ This ensures GTK applications pick up theme changes without manual restart.
589
+
590
+ ## Troubleshooting
591
+
592
+ ### Templates not found
593
+ **Solution:** M3WAL now ships with bundled templates, so this should rarely occur. If you want custom templates, create them in `~/.config/m3-colors/templates/`.
594
+
595
+ ### No templates loaded
596
+ **Solution:** Check if package is properly installed:
597
+ ```bash
598
+ pip install --upgrade m3wal
599
+ ```
600
+
601
+ ### Custom template not being used
602
+ **Solution:** Ensure the filename matches exactly (including `.template` extension). Check output:
603
+ ```
604
+ Using custom override: kitty.conf.template
605
+ ```
606
+
607
+ ### Wallpaper not setting
608
+ **Solution:** Check if `feh` is installed: `which feh`
609
+
610
+ ### GTK theme not reloading
611
+ **Solution:**
612
+ 1. Check if xsettingsd config exists: `~/.config/xsettingsd/xsettingsd.conf`
613
+ 2. Verify xsettingsd is installed: `which xsettingsd`
614
+ 3. Check gsettings: `gsettings get org.gnome.desktop.interface gtk-theme`
615
+
616
+ ### Hook scripts not running
617
+ **Solution:**
618
+ 1. Ensure scripts have execute permission: `chmod +x ~/.config/m3-colors/hooks/*.sh`
619
+ 2. Enable in config: `[Hook.Scripts] enabled = true`
620
+ 3. Check script paths in config
621
+ 4. Verify scripts are listed: `scripts = reload-apps.sh, notify.sh`
622
+
623
+ ### AUTO variant not selecting expected variant
624
+ **Solution:** The AUTO selection is based on saturation and hue analysis. You can:
625
+ 1. Check the selection reason in output: `[AUTO] Reason: ...`
626
+ 2. Manually specify a variant if needed: `--variant VIBRANT`
627
+ 3. Adjust the wallpaper or try a different image
628
+
629
+ ### Operation mode confusion
630
+ **Solution:**
631
+ - Use `--generator-only` for color generation only
632
+ - Use `--full` for complete rice setup
633
+ - Or set default in config: `operation_mode = generator` or `full`
634
+
635
+ ## Contributing
636
+
637
+ Contributions welcome! Please feel free to submit a Pull Request.
638
+
639
+ **Areas for contribution:**
640
+ - New bundled templates for popular applications
641
+ - Improved AUTO variant selection algorithm
642
+ - Additional export formats
643
+ - Performance optimizations
644
+ - Documentation improvements
645
+
646
+ ## License
647
+
648
+ MIT License - see [LICENSE](LICENSE.txt) file for details.
649
+
650
+ ## Credits
651
+
652
+ Built with [material-color-utilities](https://github.com/material-foundation/material-color-utilities) by Google.
653
+
654
+ ## Links
655
+
656
+ - GitHub: https://github.com/MDiaznf23/m3wal
657
+ - PyPI: https://pypi.org/project/m3wal/
658
+ - Issues: https://github.com/MDiaznf23/m3wal/issues