hyprconf2lua 1.7.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.
- hyprconf2lua-1.8.0/PKG-INFO +193 -0
- hyprconf2lua-1.8.0/README.md +170 -0
- {hyprconf2lua-1.7.0 → hyprconf2lua-1.8.0}/pyproject.toml +1 -1
- hyprconf2lua-1.8.0/src/hyprconf2lua/__init__.py +1 -0
- {hyprconf2lua-1.7.0 → hyprconf2lua-1.8.0}/src/hyprconf2lua/codegen.py +36 -12
- {hyprconf2lua-1.7.0 → hyprconf2lua-1.8.0}/src/hyprconf2lua/mappings.py +5 -3
- hyprconf2lua-1.8.0/src/hyprconf2lua.egg-info/PKG-INFO +193 -0
- {hyprconf2lua-1.7.0 → hyprconf2lua-1.8.0}/src/hyprconf2lua.egg-info/SOURCES.txt +2 -1
- {hyprconf2lua-1.7.0 → hyprconf2lua-1.8.0}/tests/test_converter.py +5 -2
- hyprconf2lua-1.8.0/tests/test_issue54.py +11 -0
- hyprconf2lua-1.7.0/PKG-INFO +0 -245
- hyprconf2lua-1.7.0/README.md +0 -222
- hyprconf2lua-1.7.0/src/hyprconf2lua/__init__.py +0 -1
- hyprconf2lua-1.7.0/src/hyprconf2lua.egg-info/PKG-INFO +0 -245
- {hyprconf2lua-1.7.0 → hyprconf2lua-1.8.0}/LICENSE +0 -0
- {hyprconf2lua-1.7.0 → hyprconf2lua-1.8.0}/setup.cfg +0 -0
- {hyprconf2lua-1.7.0 → hyprconf2lua-1.8.0}/src/hyprconf2lua/__main__.py +0 -0
- {hyprconf2lua-1.7.0 → hyprconf2lua-1.8.0}/src/hyprconf2lua/ast.py +0 -0
- {hyprconf2lua-1.7.0 → hyprconf2lua-1.8.0}/src/hyprconf2lua/cli.py +0 -0
- {hyprconf2lua-1.7.0 → hyprconf2lua-1.8.0}/src/hyprconf2lua/converter.py +0 -0
- {hyprconf2lua-1.7.0 → hyprconf2lua-1.8.0}/src/hyprconf2lua/lexer.py +0 -0
- {hyprconf2lua-1.7.0 → hyprconf2lua-1.8.0}/src/hyprconf2lua/parser.py +0 -0
- {hyprconf2lua-1.7.0 → hyprconf2lua-1.8.0}/src/hyprconf2lua.egg-info/dependency_links.txt +0 -0
- {hyprconf2lua-1.7.0 → hyprconf2lua-1.8.0}/src/hyprconf2lua.egg-info/entry_points.txt +0 -0
- {hyprconf2lua-1.7.0 → hyprconf2lua-1.8.0}/src/hyprconf2lua.egg-info/requires.txt +0 -0
- {hyprconf2lua-1.7.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.*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "1.8.0"
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
|
+
import json
|
|
2
3
|
import os
|
|
3
4
|
import re
|
|
4
5
|
from typing import Dict, List, Optional
|
|
@@ -179,6 +180,9 @@ class Codegen:
|
|
|
179
180
|
return key.replace("-", "_")
|
|
180
181
|
|
|
181
182
|
def to_lua_val(self, val: str):
|
|
183
|
+
val = val.strip()
|
|
184
|
+
if val.endswith(";"):
|
|
185
|
+
val = val[:-1].strip()
|
|
182
186
|
val = self.resolve_val_with_env(val)
|
|
183
187
|
if val.startswith("local_var_"):
|
|
184
188
|
return val[len("local_var_"):]
|
|
@@ -305,8 +309,12 @@ class Codegen:
|
|
|
305
309
|
self.emit(f"{key} = {val},")
|
|
306
310
|
else:
|
|
307
311
|
self.translated_count += 1
|
|
308
|
-
|
|
309
|
-
|
|
312
|
+
if key == "kb_options":
|
|
313
|
+
val_str = ",".join(values)
|
|
314
|
+
self.emit(f"{key} = {self.quote(val_str)},")
|
|
315
|
+
else:
|
|
316
|
+
vals = [self.to_lua_val(v) for v in values]
|
|
317
|
+
self.emit(f"{key} = {{ {', '.join(vals)} }},")
|
|
310
318
|
|
|
311
319
|
def _group_section_body(self, directives: List[BlockStmt]) -> List[BlockStmt]:
|
|
312
320
|
grouped: List[BlockStmt] = []
|
|
@@ -384,8 +392,11 @@ class Codegen:
|
|
|
384
392
|
val = self.to_lua_val(d.value[0])
|
|
385
393
|
self.emit(f"{key} = {val},")
|
|
386
394
|
else:
|
|
387
|
-
|
|
388
|
-
|
|
395
|
+
if key == "kb_options":
|
|
396
|
+
self.emit(f"{key} = {self.quote(','.join(d.value))},")
|
|
397
|
+
else:
|
|
398
|
+
vals = [self.to_lua_val(v) for v in d.value]
|
|
399
|
+
self.emit(f"{key} = {{ {', '.join(vals)} }},")
|
|
389
400
|
self.dedent()
|
|
390
401
|
self.emit("},")
|
|
391
402
|
|
|
@@ -408,8 +419,11 @@ class Codegen:
|
|
|
408
419
|
v = self.to_lua_val(sd.value[0])
|
|
409
420
|
self.emit(f"{k} = {v},")
|
|
410
421
|
else:
|
|
411
|
-
|
|
412
|
-
|
|
422
|
+
if k == "kb_options":
|
|
423
|
+
self.emit(f"{k} = {self.quote(','.join(sd.value))},")
|
|
424
|
+
else:
|
|
425
|
+
vals = [self.to_lua_val(v) for v in sd.value]
|
|
426
|
+
self.emit(f"{k} = {{ {', '.join(vals)} }},")
|
|
413
427
|
self.dedent()
|
|
414
428
|
self.emit("end)")
|
|
415
429
|
elif isinstance(child, Directive):
|
|
@@ -504,10 +518,9 @@ class Codegen:
|
|
|
504
518
|
|
|
505
519
|
if dsp_code is None:
|
|
506
520
|
self.flag_count += 1
|
|
507
|
-
mods_str = " + ".join(stmt.mods) if stmt.mods else ""
|
|
508
521
|
self.emit(f'-- TODO: manual review (unknown dispatcher: {stmt.dispatcher})')
|
|
509
522
|
pstr = ", ".join(self.quote(self.resolve_val(p)) for p in stmt.params)
|
|
510
|
-
self.emit(f'-- hl.bind(
|
|
523
|
+
self.emit(f'-- hl.bind({combo_expr}, hl.dsp.{stmt.dispatcher}({pstr}))')
|
|
511
524
|
return
|
|
512
525
|
|
|
513
526
|
opt_parts = []
|
|
@@ -538,7 +551,7 @@ class Codegen:
|
|
|
538
551
|
if var_name in self.variables:
|
|
539
552
|
parts.append(var_name)
|
|
540
553
|
else:
|
|
541
|
-
parts.append(
|
|
554
|
+
parts.append("local_var_" + var_name)
|
|
542
555
|
else:
|
|
543
556
|
parts.append(self.quote(m))
|
|
544
557
|
|
|
@@ -547,6 +560,10 @@ class Codegen:
|
|
|
547
560
|
|
|
548
561
|
has_var = any(not p.startswith('"') for p in parts)
|
|
549
562
|
|
|
563
|
+
if not has_var and not is_key_var:
|
|
564
|
+
all_str = " + ".join(p.strip('"') for p in parts)
|
|
565
|
+
return self.quote(all_str + " + " + key_str.strip('"'))
|
|
566
|
+
|
|
550
567
|
if not has_var:
|
|
551
568
|
all_str = " + ".join(p.strip('"') for p in parts)
|
|
552
569
|
return self.quote(all_str) + ' .. " + " .. ' + key_str
|
|
@@ -582,7 +599,10 @@ class Codegen:
|
|
|
582
599
|
|
|
583
600
|
if dispatcher == "movetoworkspacesilent":
|
|
584
601
|
args = self.build_dispatcher_args(params, needs_args, func)
|
|
585
|
-
|
|
602
|
+
# Combine workspace dict with follow flag into single dict
|
|
603
|
+
if args and args.endswith("}"):
|
|
604
|
+
args = args.rstrip("}") + ", follow = false}"
|
|
605
|
+
return f'{func}({args})'
|
|
586
606
|
|
|
587
607
|
if dispatcher == "movefocus":
|
|
588
608
|
dir_map = {"l": "left", "r": "right", "u": "up", "d": "down"}
|
|
@@ -595,6 +615,9 @@ class Codegen:
|
|
|
595
615
|
return f'{func}({{ next = false }})'
|
|
596
616
|
return f'{func}()'
|
|
597
617
|
|
|
618
|
+
if dispatcher == "pass":
|
|
619
|
+
return f'{func}({{ window = {self.quote(params[0]) if params else "nil"} }})'
|
|
620
|
+
|
|
598
621
|
if dispatcher == "resizeactive":
|
|
599
622
|
nums = params[0].split() if params else []
|
|
600
623
|
x = nums[0] if len(nums) > 0 else "0"
|
|
@@ -647,7 +670,7 @@ class Codegen:
|
|
|
647
670
|
return self.build_focus_dispatcher(func, params)
|
|
648
671
|
|
|
649
672
|
if dispatcher == "focusurgentorlast":
|
|
650
|
-
return f'{func}({{
|
|
673
|
+
return f'{func}({{ urgent_or_last = true }})'
|
|
651
674
|
|
|
652
675
|
if dispatcher == "focuscurrentorlast":
|
|
653
676
|
return f'{func}({{ last = true }})'
|
|
@@ -817,6 +840,7 @@ class Codegen:
|
|
|
817
840
|
self.indent()
|
|
818
841
|
|
|
819
842
|
name_str = re.sub(r'[^a-zA-Z0-9_-]', '_', name_source[:20].lower())
|
|
843
|
+
name_str = f"{name_str}_{stmt.line}"
|
|
820
844
|
self.emit(f'name = "{name_str}",')
|
|
821
845
|
|
|
822
846
|
self.emit("match = {")
|
|
@@ -898,7 +922,7 @@ class Codegen:
|
|
|
898
922
|
if style and style != "default":
|
|
899
923
|
style_extra = f', style = {self.quote(style)}'
|
|
900
924
|
|
|
901
|
-
if curve
|
|
925
|
+
if curve:
|
|
902
926
|
if re.match(r'^\d+(\.\d+)?$', curve):
|
|
903
927
|
return self.emit(f"-- TODO: manual review (numeric curve ref in animation: {stmt.name})")
|
|
904
928
|
|
|
@@ -58,10 +58,10 @@ DISPATCHER_MAP = {
|
|
|
58
58
|
|
|
59
59
|
BIND_FLAGS_TO_OPTIONS = {
|
|
60
60
|
"l": ("locked", "true"),
|
|
61
|
-
"r": ("
|
|
61
|
+
"r": ("release", "true"),
|
|
62
62
|
"n": ("non_consuming", "true"),
|
|
63
63
|
"m": ("mouse", "true"),
|
|
64
|
-
"e": ("
|
|
64
|
+
"e": ("repeating", "true"),
|
|
65
65
|
"t": ("transparent", "true"),
|
|
66
66
|
"i": ("ignore_mods", "true"),
|
|
67
67
|
"p": ("pass", "true"),
|
|
@@ -97,6 +97,8 @@ WINDOW_RULE_PARAM_MAP = {
|
|
|
97
97
|
"minsize": ("min_size", True),
|
|
98
98
|
"maxsize": ("max_size", True),
|
|
99
99
|
"idleinhibit": ("idle_inhibit", True),
|
|
100
|
+
"stay_focused": ("stay_focused", True),
|
|
101
|
+
"dim_around": ("dim_around", True),
|
|
100
102
|
"xray": ("xray", True),
|
|
101
103
|
"center": ("center", True),
|
|
102
104
|
"keepaspectratio": ("keep_aspect_ratio", "true"),
|
|
@@ -112,7 +114,7 @@ WINDOW_RULE_PARAM_MAP = {
|
|
|
112
114
|
|
|
113
115
|
WORKSPACE_RULE_MAP = {
|
|
114
116
|
"monitor": "monitor",
|
|
115
|
-
"default": "
|
|
117
|
+
"default": "default",
|
|
116
118
|
"gapsin": "gaps_in",
|
|
117
119
|
"gapsout": "gaps_out",
|
|
118
120
|
"bordersize": "border_size",
|