hyprconf2lua 1.6.0__tar.gz → 1.8.0__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 (26) hide show
  1. hyprconf2lua-1.8.0/PKG-INFO +193 -0
  2. hyprconf2lua-1.8.0/README.md +170 -0
  3. {hyprconf2lua-1.6.0 → hyprconf2lua-1.8.0}/pyproject.toml +1 -1
  4. hyprconf2lua-1.8.0/src/hyprconf2lua/__init__.py +1 -0
  5. {hyprconf2lua-1.6.0 → hyprconf2lua-1.8.0}/src/hyprconf2lua/ast.py +1 -0
  6. {hyprconf2lua-1.6.0 → hyprconf2lua-1.8.0}/src/hyprconf2lua/codegen.py +178 -84
  7. {hyprconf2lua-1.6.0 → hyprconf2lua-1.8.0}/src/hyprconf2lua/mappings.py +7 -3
  8. {hyprconf2lua-1.6.0 → hyprconf2lua-1.8.0}/src/hyprconf2lua/parser.py +33 -11
  9. hyprconf2lua-1.8.0/src/hyprconf2lua.egg-info/PKG-INFO +193 -0
  10. {hyprconf2lua-1.6.0 → hyprconf2lua-1.8.0}/src/hyprconf2lua.egg-info/SOURCES.txt +2 -1
  11. {hyprconf2lua-1.6.0 → hyprconf2lua-1.8.0}/tests/test_converter.py +120 -2
  12. hyprconf2lua-1.8.0/tests/test_issue54.py +11 -0
  13. hyprconf2lua-1.6.0/PKG-INFO +0 -245
  14. hyprconf2lua-1.6.0/README.md +0 -222
  15. hyprconf2lua-1.6.0/src/hyprconf2lua/__init__.py +0 -1
  16. hyprconf2lua-1.6.0/src/hyprconf2lua.egg-info/PKG-INFO +0 -245
  17. {hyprconf2lua-1.6.0 → hyprconf2lua-1.8.0}/LICENSE +0 -0
  18. {hyprconf2lua-1.6.0 → hyprconf2lua-1.8.0}/setup.cfg +0 -0
  19. {hyprconf2lua-1.6.0 → hyprconf2lua-1.8.0}/src/hyprconf2lua/__main__.py +0 -0
  20. {hyprconf2lua-1.6.0 → hyprconf2lua-1.8.0}/src/hyprconf2lua/cli.py +0 -0
  21. {hyprconf2lua-1.6.0 → hyprconf2lua-1.8.0}/src/hyprconf2lua/converter.py +0 -0
  22. {hyprconf2lua-1.6.0 → hyprconf2lua-1.8.0}/src/hyprconf2lua/lexer.py +0 -0
  23. {hyprconf2lua-1.6.0 → hyprconf2lua-1.8.0}/src/hyprconf2lua.egg-info/dependency_links.txt +0 -0
  24. {hyprconf2lua-1.6.0 → hyprconf2lua-1.8.0}/src/hyprconf2lua.egg-info/entry_points.txt +0 -0
  25. {hyprconf2lua-1.6.0 → hyprconf2lua-1.8.0}/src/hyprconf2lua.egg-info/requires.txt +0 -0
  26. {hyprconf2lua-1.6.0 → hyprconf2lua-1.8.0}/src/hyprconf2lua.egg-info/top_level.txt +0 -0
@@ -0,0 +1,193 @@
1
+ Metadata-Version: 2.4
2
+ Name: hyprconf2lua
3
+ Version: 1.8.0
4
+ Summary: Convert Hyprland hyprlang .conf files to Lua .lua config format (v0.55+)
5
+ Author: hyprconf2lua contributors
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/Prateek-squadron/hyprconf2lua
8
+ Project-URL: Repository, https://github.com/Prateek-squadron/hyprconf2lua
9
+ Keywords: hyprland,hyprlang,lua,config,converter
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Environment :: Console
12
+ Classifier: Intended Audience :: End Users/Desktop
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Operating System :: POSIX :: Linux
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Topic :: Utilities
17
+ Requires-Python: >=3.10
18
+ Description-Content-Type: text/markdown
19
+ License-File: LICENSE
20
+ Provides-Extra: dev
21
+ Requires-Dist: pytest; extra == "dev"
22
+ Dynamic: license-file
23
+
24
+ # hyprconf2lua - Knowledge Base
25
+
26
+ **Project:** hyprconf2lua
27
+ **Version:** 1.7.0
28
+ **Description:** Convert Hyprland hyprlang `.conf` files to Lua `.lua` config format (v0.55+)
29
+ **Maintainer:** Prateek-squadron
30
+ **License:** MIT
31
+
32
+ ---
33
+
34
+ ## Project Overview
35
+
36
+ hyprconf2lua is a converter that transforms Hyprland configuration files (`.conf` using hyprlang syntax) into Lua configuration files (`.lua`) compatible with Hyprland v0.55+.
37
+
38
+ The converter uses a pipeline architecture:
39
+ ```
40
+ Input (.conf source)
41
+ ├── lexer.py → tokenize source into tokens
42
+ ├── parser.py → parse tokens into AST
43
+ ├── codegen.py → generate Lua code from AST
44
+ └── Output (.lua)
45
+ ```
46
+
47
+ ---
48
+
49
+ ## Project Structure
50
+
51
+ ```
52
+ hyprconf2lua/
53
+ ├── README.md ← This knowledge base
54
+ ├── pyproject.toml ← Package metadata, version 1.7.0
55
+ ├── src/
56
+ │ ├── hyprconf2lua/
57
+ │ │ ├── __init__.py ← __version__ = "1.7.0"
58
+ │ │ ├── __main__.py ← Entry point: cli.main()
59
+ │ │ ├── cli.py ← CLI: argparse, file I/O, --check, --version
60
+ │ │ ├── converter.py ← Pipeline orchestrator: tokenize → parse → codegen
61
+ │ │ ├── codegen.py ← Code generator: AST → Lua string output
62
+ │ │ ├── lexer.py ← Regex-based tokenizer: 17 token types
63
+ │ │ ├── parser.py ← Recursive descent parser: 20+ parse methods
64
+ │ │ ├── ast.py ← 21 AST node dataclasses
65
+ │ │ ├── mappings.py ← Dispatcher maps, rule maps, flag mappings
66
+ │ │ └── mappings.py ← 5 mapping dicts (DISPATCHER_MAP, etc.)
67
+ │ └── tests/
68
+ │ ├── __init__.py
69
+ │ └── test_converter.py ← 106 tests passing
70
+ ├── dist/ ← Built wheels and sdist
71
+ ├── example/ ← Example hyprland.conf
72
+ ├── hyprconf2lua.sh ← Shell wrapper to run without pip install
73
+ ├── install.sh ← Symlinks hyprconf2lua.sh into PATH
74
+ ├── LICENSE
75
+ ├── README.md ← This knowledge base
76
+ └── README_kb.md ← (this file)
77
+ ```
78
+
79
+ ---
80
+
81
+ ## v1.7.0 Fixes (Released)
82
+
83
+ All issues from the open PRs have been resolved in release **1.7.0**. Here's what was fixed:
84
+
85
+ ### #35 - 7 Bug Fixes
86
+ 1. **Window rules: match/swap** - match criteria and properties were swapped; now correctly separates `match:`-prefixed criteria from property rules
87
+ 2. **Layer rules**: `blur=on = true` invalid Lua fixed; now emits `blur = true`
88
+ 3. **Gestures**: nested inside `hl.config()` instead of `hl.gesture()` → now emitted as dedicated `hl.gesture({...})` calls
89
+ 4. **Window move binds**: emitted raw tables instead of `hl.dsp.window.move()`; direction shorthand (`l`/`r`/`u`/`d`) expanded to `left`/`right`/`up`/`down`
90
+ 5. **resizeactive binds**: now maps to `hl.dsp.window.resize({ x, y, relative = true })`
91
+ 6. **Workspace-restore `+0`**: `+0` mapped to `workspace = "+0"` instead of `direction = "+0"`
92
+ 7. **layoutmsg with trailing comment**: `layoutmsg, # dwindle` no longer parses argument as `nil`; flagged for manual review instead of crashing
93
+
94
+ ### #38 - Windowrule/Layerrule Multi-word Values
95
+ - `workspace = "3 silent"` stays as string (not split into array)
96
+ - `size = 700 600`, `move 100%-433 53`, `opacity 0.9 0.8` → arrays `{700, 600}`, `{100%-433, 53}`, `{0.9, 0.8}`
97
+
98
+ ### #39 - Animations Inside Sections
99
+ - `animation =`, `bezier =` directives inside `animations {}` now translate to `hl.animation()`/`hl.curve()` statements
100
+ - on/off flag → `enabled = true/false`
101
+ - styles like `popin 87%` preserved as `style = "popin 87%"`
102
+ - Statements emitted **outside** the `hl.config({})` table (valid Lua)
103
+
104
+ ### #40 - Stdin Hyphen Whitespace
105
+ - `grim -c -g "$(slurp)" - | satty --filename -` preserves spaces around `-` and `|`
106
+ - Before: `grim -c -g \"$(slurp)\"-| satty --filename-` (spaces stripped)
107
+
108
+ ### #33 - Comma in Variable Values
109
+ - `$kbNextWs = Ctrl+Super, right` parses correctly → `local kbNextWs = "Ctrl+Super, right"`
110
+ - Before: `kbNextWs = { }` (empty table)
111
+
112
+ ### #32 - rgba() Color Parsing
113
+ - `shadow:color = rgba(0,0,0,0.85)` parses correctly
114
+ - Colon-paths expand to nested tables: `shadow = { color = "rgba(0,0,0,0.85)" }`
115
+
116
+ ### #42 - movecurrentworkspacetomonitor Dispatcher
117
+ - New dispatcher: `hl.dsp.workspace.move({ monitor = "l" })`
118
+
119
+ ---
120
+
121
+ ## Test Results
122
+
123
+ - **106 tests passing** (only pre-existing `test_cli_help` fails due to module not being installed in /usr/bin/python path)
124
+ - All fixes verified against real-world hyprland configs
125
+ - Regressions: 0 (all existing tests continue to pass)
126
+
127
+ ---
128
+
129
+ ## How to Build & Test
130
+
131
+ ```bash
132
+ # From project root
133
+ python -m build # Build sdist + wheel
134
+ python -m pytest tests/ # Run all 106 tests
135
+ python -m hyprconf2lua # CLI help
136
+
137
+ # Example conversions
138
+ hyprconf2lua example/hyprland.conf
139
+ ```
140
+
141
+ ---
142
+
143
+ ## Guidelines for AI Agents Working on This Project
144
+
145
+ ### Code Style
146
+ - Follow existing patterns in `src/hyprconf2lua/`
147
+ - Use `no_space_before` / `no_space_after` sets in `_join_tokens` for consistent spacing
148
+ - Keep `MULTI_VALUE_EFFECT_KEYS = {"move", "size", "opacity", "alpha"}` for multi-word effect values
149
+ - Dispatcher maps in `mappings.py` - add new dispatchers there
150
+
151
+ ### Adding New Dispatchers
152
+ 1. Add to `DISPATCHER_MAP` in `mappings.py` with `(func_string, needs_args)`
153
+ 2. Handle in `build_dispatcher()` and `build_dispatcher_args()` in `codegen.py`
154
+ 3. Add special cases for known patterns (e.g., `+0` → workspace, `l/r/u/d` → directions)
155
+
156
+ ### Adding New Rule Types
157
+ 1. Add to `WINDOW_RULE_MAP` or `LAYER_RULE_MAP` in `mappings.py`
158
+ 2. Handle in `visit_windowrule()` / `visit_layerrule()` in `codegen.py`
159
+ 3. Support both old-style (`rule, match:X`) and new-style (`match:key X`) syntax
160
+
161
+ ### Adding New Animations/Beziers
162
+ 1. Add `enabled` field to `AnimationDirective` in `ast.py`
163
+ 2. Update `parse_animation()` in `parser.py` to extract `enabled`, `style` from comma values
164
+ 3. Update `visit_animation()` in `codegen.py` to use `stmt.enabled` and `stmt.style`
165
+ 4. Ensure statements are emitted **outside** `hl.config({})` table (see `emit_section_config`)
166
+
167
+ ### Testing
168
+ - Run `python -m pytest tests/` to verify all 106 tests pass
169
+ - Add regression tests in `tests/test_converter.py` for new fixes
170
+ - Test with real hyprland configs via `hyprctl configerrors`
171
+
172
+ ---
173
+
174
+ ## Recent Changes History
175
+
176
+ | Version | Date | Key Fixes |
177
+ |---------|------|-----------|
178
+ | **1.7.0** | 2026-08-24 | All 7 bugs from #35, #38, #39, #40, #33, #32 fixed |
179
+ | **1.6.0** | 2026-08-20 | #26-#29 (source path, hyphens, ${} syntax, multiline exec) |
180
+ | **1.5.0** | 2026-08-28 | #24/#25 (hyphen→underscore, $HOME→os.getenv) |
181
+
182
+ ---
183
+
184
+ ## Contact & Support
185
+
186
+ - **GitHub:** https://github.com/Prateek-squadron/hyprconf2lua
187
+ - **PyPI:** https://pypi.org/project/hyprconf2lua/
188
+ - **Issues:** Use GitHub Issues for bug reports and feature requests
189
+ - **IRC/Slack:** #hyprland on Libera.Chat (project maintainer)
190
+
191
+ ---
192
+
193
+ *This knowledge base was created for the v1.7.0 release cycle. For the latest updates, check the GitHub repository.*
@@ -0,0 +1,170 @@
1
+ # hyprconf2lua - Knowledge Base
2
+
3
+ **Project:** hyprconf2lua
4
+ **Version:** 1.7.0
5
+ **Description:** Convert Hyprland hyprlang `.conf` files to Lua `.lua` config format (v0.55+)
6
+ **Maintainer:** Prateek-squadron
7
+ **License:** MIT
8
+
9
+ ---
10
+
11
+ ## Project Overview
12
+
13
+ hyprconf2lua is a converter that transforms Hyprland configuration files (`.conf` using hyprlang syntax) into Lua configuration files (`.lua`) compatible with Hyprland v0.55+.
14
+
15
+ The converter uses a pipeline architecture:
16
+ ```
17
+ Input (.conf source)
18
+ ├── lexer.py → tokenize source into tokens
19
+ ├── parser.py → parse tokens into AST
20
+ ├── codegen.py → generate Lua code from AST
21
+ └── Output (.lua)
22
+ ```
23
+
24
+ ---
25
+
26
+ ## Project Structure
27
+
28
+ ```
29
+ hyprconf2lua/
30
+ ├── README.md ← This knowledge base
31
+ ├── pyproject.toml ← Package metadata, version 1.7.0
32
+ ├── src/
33
+ │ ├── hyprconf2lua/
34
+ │ │ ├── __init__.py ← __version__ = "1.7.0"
35
+ │ │ ├── __main__.py ← Entry point: cli.main()
36
+ │ │ ├── cli.py ← CLI: argparse, file I/O, --check, --version
37
+ │ │ ├── converter.py ← Pipeline orchestrator: tokenize → parse → codegen
38
+ │ │ ├── codegen.py ← Code generator: AST → Lua string output
39
+ │ │ ├── lexer.py ← Regex-based tokenizer: 17 token types
40
+ │ │ ├── parser.py ← Recursive descent parser: 20+ parse methods
41
+ │ │ ├── ast.py ← 21 AST node dataclasses
42
+ │ │ ├── mappings.py ← Dispatcher maps, rule maps, flag mappings
43
+ │ │ └── mappings.py ← 5 mapping dicts (DISPATCHER_MAP, etc.)
44
+ │ └── tests/
45
+ │ ├── __init__.py
46
+ │ └── test_converter.py ← 106 tests passing
47
+ ├── dist/ ← Built wheels and sdist
48
+ ├── example/ ← Example hyprland.conf
49
+ ├── hyprconf2lua.sh ← Shell wrapper to run without pip install
50
+ ├── install.sh ← Symlinks hyprconf2lua.sh into PATH
51
+ ├── LICENSE
52
+ ├── README.md ← This knowledge base
53
+ └── README_kb.md ← (this file)
54
+ ```
55
+
56
+ ---
57
+
58
+ ## v1.7.0 Fixes (Released)
59
+
60
+ All issues from the open PRs have been resolved in release **1.7.0**. Here's what was fixed:
61
+
62
+ ### #35 - 7 Bug Fixes
63
+ 1. **Window rules: match/swap** - match criteria and properties were swapped; now correctly separates `match:`-prefixed criteria from property rules
64
+ 2. **Layer rules**: `blur=on = true` invalid Lua fixed; now emits `blur = true`
65
+ 3. **Gestures**: nested inside `hl.config()` instead of `hl.gesture()` → now emitted as dedicated `hl.gesture({...})` calls
66
+ 4. **Window move binds**: emitted raw tables instead of `hl.dsp.window.move()`; direction shorthand (`l`/`r`/`u`/`d`) expanded to `left`/`right`/`up`/`down`
67
+ 5. **resizeactive binds**: now maps to `hl.dsp.window.resize({ x, y, relative = true })`
68
+ 6. **Workspace-restore `+0`**: `+0` mapped to `workspace = "+0"` instead of `direction = "+0"`
69
+ 7. **layoutmsg with trailing comment**: `layoutmsg, # dwindle` no longer parses argument as `nil`; flagged for manual review instead of crashing
70
+
71
+ ### #38 - Windowrule/Layerrule Multi-word Values
72
+ - `workspace = "3 silent"` stays as string (not split into array)
73
+ - `size = 700 600`, `move 100%-433 53`, `opacity 0.9 0.8` → arrays `{700, 600}`, `{100%-433, 53}`, `{0.9, 0.8}`
74
+
75
+ ### #39 - Animations Inside Sections
76
+ - `animation =`, `bezier =` directives inside `animations {}` now translate to `hl.animation()`/`hl.curve()` statements
77
+ - on/off flag → `enabled = true/false`
78
+ - styles like `popin 87%` preserved as `style = "popin 87%"`
79
+ - Statements emitted **outside** the `hl.config({})` table (valid Lua)
80
+
81
+ ### #40 - Stdin Hyphen Whitespace
82
+ - `grim -c -g "$(slurp)" - | satty --filename -` preserves spaces around `-` and `|`
83
+ - Before: `grim -c -g \"$(slurp)\"-| satty --filename-` (spaces stripped)
84
+
85
+ ### #33 - Comma in Variable Values
86
+ - `$kbNextWs = Ctrl+Super, right` parses correctly → `local kbNextWs = "Ctrl+Super, right"`
87
+ - Before: `kbNextWs = { }` (empty table)
88
+
89
+ ### #32 - rgba() Color Parsing
90
+ - `shadow:color = rgba(0,0,0,0.85)` parses correctly
91
+ - Colon-paths expand to nested tables: `shadow = { color = "rgba(0,0,0,0.85)" }`
92
+
93
+ ### #42 - movecurrentworkspacetomonitor Dispatcher
94
+ - New dispatcher: `hl.dsp.workspace.move({ monitor = "l" })`
95
+
96
+ ---
97
+
98
+ ## Test Results
99
+
100
+ - **106 tests passing** (only pre-existing `test_cli_help` fails due to module not being installed in /usr/bin/python path)
101
+ - All fixes verified against real-world hyprland configs
102
+ - Regressions: 0 (all existing tests continue to pass)
103
+
104
+ ---
105
+
106
+ ## How to Build & Test
107
+
108
+ ```bash
109
+ # From project root
110
+ python -m build # Build sdist + wheel
111
+ python -m pytest tests/ # Run all 106 tests
112
+ python -m hyprconf2lua # CLI help
113
+
114
+ # Example conversions
115
+ hyprconf2lua example/hyprland.conf
116
+ ```
117
+
118
+ ---
119
+
120
+ ## Guidelines for AI Agents Working on This Project
121
+
122
+ ### Code Style
123
+ - Follow existing patterns in `src/hyprconf2lua/`
124
+ - Use `no_space_before` / `no_space_after` sets in `_join_tokens` for consistent spacing
125
+ - Keep `MULTI_VALUE_EFFECT_KEYS = {"move", "size", "opacity", "alpha"}` for multi-word effect values
126
+ - Dispatcher maps in `mappings.py` - add new dispatchers there
127
+
128
+ ### Adding New Dispatchers
129
+ 1. Add to `DISPATCHER_MAP` in `mappings.py` with `(func_string, needs_args)`
130
+ 2. Handle in `build_dispatcher()` and `build_dispatcher_args()` in `codegen.py`
131
+ 3. Add special cases for known patterns (e.g., `+0` → workspace, `l/r/u/d` → directions)
132
+
133
+ ### Adding New Rule Types
134
+ 1. Add to `WINDOW_RULE_MAP` or `LAYER_RULE_MAP` in `mappings.py`
135
+ 2. Handle in `visit_windowrule()` / `visit_layerrule()` in `codegen.py`
136
+ 3. Support both old-style (`rule, match:X`) and new-style (`match:key X`) syntax
137
+
138
+ ### Adding New Animations/Beziers
139
+ 1. Add `enabled` field to `AnimationDirective` in `ast.py`
140
+ 2. Update `parse_animation()` in `parser.py` to extract `enabled`, `style` from comma values
141
+ 3. Update `visit_animation()` in `codegen.py` to use `stmt.enabled` and `stmt.style`
142
+ 4. Ensure statements are emitted **outside** `hl.config({})` table (see `emit_section_config`)
143
+
144
+ ### Testing
145
+ - Run `python -m pytest tests/` to verify all 106 tests pass
146
+ - Add regression tests in `tests/test_converter.py` for new fixes
147
+ - Test with real hyprland configs via `hyprctl configerrors`
148
+
149
+ ---
150
+
151
+ ## Recent Changes History
152
+
153
+ | Version | Date | Key Fixes |
154
+ |---------|------|-----------|
155
+ | **1.7.0** | 2026-08-24 | All 7 bugs from #35, #38, #39, #40, #33, #32 fixed |
156
+ | **1.6.0** | 2026-08-20 | #26-#29 (source path, hyphens, ${} syntax, multiline exec) |
157
+ | **1.5.0** | 2026-08-28 | #24/#25 (hyphen→underscore, $HOME→os.getenv) |
158
+
159
+ ---
160
+
161
+ ## Contact & Support
162
+
163
+ - **GitHub:** https://github.com/Prateek-squadron/hyprconf2lua
164
+ - **PyPI:** https://pypi.org/project/hyprconf2lua/
165
+ - **Issues:** Use GitHub Issues for bug reports and feature requests
166
+ - **IRC/Slack:** #hyprland on Libera.Chat (project maintainer)
167
+
168
+ ---
169
+
170
+ *This knowledge base was created for the v1.7.0 release cycle. For the latest updates, check the GitHub repository.*
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "hyprconf2lua"
7
- version = "1.6.0"
7
+ version = "1.8.0"
8
8
  description = "Convert Hyprland hyprlang .conf files to Lua .lua config format (v0.55+)"
9
9
  readme = "README.md"
10
10
  license = {text = "MIT"}
@@ -0,0 +1 @@
1
+ __version__ = "1.8.0"
@@ -79,6 +79,7 @@ class AnimationDirective:
79
79
  speed: str
80
80
  curve: str
81
81
  line: int
82
+ enabled: str = "1"
82
83
 
83
84
 
84
85
  @dataclass