hyprconf2lua 1.2.0__py3-none-any.whl

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.
@@ -0,0 +1,242 @@
1
+ Metadata-Version: 2.4
2
+ Name: hyprconf2lua
3
+ Version: 1.2.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
+ Dynamic: license-file
21
+
22
+ # hyprconf2lua
23
+
24
+ **Your `hyprland.conf` is going away. Here's the one-liner to migrate.**
25
+
26
+ Hyprland 0.55+ replaced the old hyprlang config with Lua. The old format will be dropped in a future release. **hyprconf2lua** converts your existing config automatically — no manual rewrite needed.
27
+
28
+ ```bash
29
+ git clone https://github.com/Prateek-squadron/hyprconf2lua.git
30
+ cd hyprconf2lua
31
+ ./install.sh
32
+ hyprconf2lua ~/.config/hypr/hyprland.conf -o hyprland.lua
33
+ ```
34
+
35
+ That's it. ~97% of your config converts cleanly. The rest gets flagged with `-- TODO` comments telling you exactly what to touch up.
36
+
37
+ > **Not on PyPI yet** — the `pip install hyprconf2lua` command you might see in older posts doesn't work because the package hasn't been published there. Use the clone+install method above. It's zero-dependency, works on every distro, and sidesteps PEP 668 ("externally managed environment") completely. If your distro blocks pip, this is the way.
38
+
39
+ ---
40
+
41
+ ## What it looks like
42
+
43
+ **Before** (old `hyprland.conf`):
44
+ ```ini
45
+ $mainMod = SUPER
46
+
47
+ general {
48
+ gaps_in = 5
49
+ gaps_out = 20
50
+ }
51
+
52
+ bind = $mainMod, Q, exec, kitty
53
+ bind = $mainMod, F, fullscreen
54
+
55
+ windowrule = float, ^(pavucontrol)$
56
+
57
+ exec-once = waybar
58
+ exec-once = mako
59
+ ```
60
+
61
+ **After** (new `hyprland.lua`):
62
+ ```lua
63
+ local mainMod = "SUPER"
64
+
65
+ hl.config({
66
+ general = {
67
+ gaps_in = 5,
68
+ gaps_out = 20,
69
+ },
70
+ })
71
+
72
+ hl.bind(mainMod .. " + " .. "Q", hl.dsp.exec_cmd("kitty"))
73
+ hl.bind(mainMod .. " + " .. "F", hl.dsp.window.fullscreen())
74
+
75
+ hl.window_rule({
76
+ name = "float",
77
+ match = { class = "^(pavucontrol)$" },
78
+ float = true,
79
+ })
80
+
81
+ hl.on("hyprland.start", function()
82
+ hl.exec_cmd("waybar")
83
+ hl.exec_cmd("mako")
84
+ end)
85
+ ```
86
+
87
+ ---
88
+
89
+ ## Installation
90
+
91
+ ### Quick install (recommended)
92
+
93
+ ```bash
94
+ git clone https://github.com/Prateek-squadron/hyprconf2lua.git
95
+ cd hyprconf2lua
96
+ ./install.sh # symlinks hyprconf2lua -> ~/.local/bin
97
+ hyprconf2lua ~/.config/hypr/hyprland.conf -o hyprland.lua
98
+ ```
99
+
100
+ ### One-shot (no install)
101
+
102
+ ```bash
103
+ git clone https://github.com/Prateek-squadron/hyprconf2lua.git
104
+ cd hyprconf2lua
105
+ PYTHONPATH=src python3 -m hyprconf2lua ~/.config/hypr/hyprland.conf > hyprland.lua
106
+ ```
107
+
108
+ ### pip install (if your distro allows it)
109
+
110
+ ```bash
111
+ pip install --user .
112
+ # or
113
+ pip install --break-system-packages .
114
+ ```
115
+
116
+ > **"externally managed environment" error?** That's PEP 668 — modern distros protect the system Python from pip. Use the clone+install method above instead — zero pip required.
117
+
118
+ ---
119
+
120
+ ## Full migration guide
121
+
122
+ 1. **Backup** your current config:
123
+ ```bash
124
+ cp -r ~/.config/hypr ~/.config/hypr.bak
125
+ ```
126
+
127
+ 2. **Convert your main config**:
128
+ ```bash
129
+ hyprconf2lua ~/.config/hypr/hyprland.conf -o ~/.config/hypr/hyprland.lua
130
+ ```
131
+
132
+ 3. **Check for flags** — run with `--check` to find anything that needs manual review:
133
+ ```bash
134
+ hyprconf2lua --check ~/.config/hypr/hyprland.conf
135
+ # exits 0 if clean, 3 if anything flagged
136
+ ```
137
+
138
+ 4. **Convert sourced files** — if your config has `source = somefile.conf`, convert those too:
139
+ ```bash
140
+ hyprconf2lua --dir ~/.config/hypr --in-place
141
+ ```
142
+ This converts every `.conf` in the directory to `.lua`.
143
+
144
+ 5. **Review `-- TODO` markers** — search for these in the generated `.lua` files and handle them manually.
145
+
146
+ 6. **Test** — restart Hyprland and make sure everything works:
147
+ ```bash
148
+ hyprctl reload
149
+ ```
150
+
151
+ ---
152
+
153
+ ## What works
154
+
155
+ | Category | Status |
156
+ |----------|--------|
157
+ | Keybinds (`bind`, `bindl`, `bindr`, `bindm`, `binde`, `bindd`, etc.) | ✅ All flags and combined forms |
158
+ | Monitors | ✅ 100% |
159
+ | Window rules (`windowrule`, `windowrulev2`) | ✅ Regex patterns, opacity, all rule types |
160
+ | Autostart (`exec-once`, `exec`, `exec-shutdown`) | ✅ Preserves spaces, `&`, pipes |
161
+ | Environment (`env`) | ✅ Commas in values preserved |
162
+ | Animations and beziers | ✅ Named curves, animation presets |
163
+ | Device sections (`device:name { }`) | ✅ |
164
+ | Gestures | ✅ |
165
+ | Workspace rules | ✅ default, monitor, gaps, etc. |
166
+ | Layer rules | ✅ blur, ignorealpha, noanim |
167
+ | Submap blocks (`submap = name` … `submap = reset`) | ✅ `hl.define_submap()` |
168
+ | Config sections (`general`, `decoration`, `input`, …) | ✅ Includes nested subsections (shadow, blur, touchpad) |
169
+ | Variables (`$var = value`) | ✅ Resolved in binds and execs |
170
+ | Comments (`#`) | ✅ Preserved as `--` |
171
+ | `plugin { }` | ⚠️ Flagged with TODO — plugin APIs are plugin-specific |
172
+ | `source = *.conf` | ⚠️ Flagged with conversion reminder |
173
+ | `$` glob patterns in sources | ⚠️ Needs manual handling |
174
+
175
+ **Coverage:** ~97% on standard configs, 90%+ on complex setups like Omarchy, **0% false positives** — everything flagged genuinely needs attention.
176
+
177
+ ---
178
+
179
+ ## Why this over the Go tool?
180
+
181
+ There's another converter (`hyprlang2lua` by EIonTusk) written in Go. Here's why this one exists:
182
+
183
+ - **No compile step** — Go binaries need to be downloaded or compiled. This is `pip install` (or just `python3 -m`) and done. Arch ships Python, you already have it.
184
+ - **Easier to contribute** — Python has a lower barrier. If your config hits an edge case, you or someone else can fix it in minutes without learning Go.
185
+ - **Better coverage** — Handles Omarchy's `bindd` with description labels, nested config sections (shadow/blur inside decoration), combined bind flags (`bindle`, `bindm`), mouse binds, commas inside env values, and submap blocks. The Go tool is more basic.
186
+ - **CI-friendly** — `--check` mode exits 3 if anything needs review. Great for git hooks and automated pipelines.
187
+
188
+ ---
189
+
190
+ ## Usage reference
191
+
192
+ ```bash
193
+ # Convert a single file to stdout
194
+ hyprconf2lua hyprland.conf > hyprland.lua
195
+
196
+ # Convert and write to file
197
+ hyprconf2lua hyprland.conf -o hyprland.lua
198
+
199
+ # Convert from stdin
200
+ cat hyprland.conf | hyprconf2lua > hyprland.lua
201
+
202
+ # Convert all .conf files in a directory tree
203
+ hyprconf2lua --dir ~/.config/hypr --in-place
204
+
205
+ # Check mode (CI): exits 3 if anything needs manual review
206
+ hyprconf2lua --check hyprland.conf
207
+
208
+ # Show translation statistics
209
+ hyprconf2lua hyprland.conf --report
210
+
211
+ # Print version
212
+ hyprconf2lua --version
213
+ ```
214
+
215
+ If you didn't install via `./install.sh`, prefix commands with `PYTHONPATH=src python3 -m`:
216
+ ```bash
217
+ cd hyprconf2lua
218
+ PYTHONPATH=src python3 -m hyprconf2lua ~/.config/hypr/hyprland.conf -o ~/.config/hypr/hyprland.lua
219
+ ```
220
+
221
+ ---
222
+
223
+ ## Manual review checklist
224
+
225
+ After conversion, search your `.lua` files for `TODO`:
226
+
227
+ - **`plugin { }`** — these need `hl.plugin.*` APIs specific to each plugin. See your plugin docs.
228
+ - **`source = path`** — each sourced `.conf` needs individual conversion. Run `hyprconf2lua` on each one.
229
+ - **`submap` bindings** — now handled automatically with `hl.define_submap()`.
230
+ - **Unknown dispatchers** — rare or custom dispatchers are flagged. Check the [Hyprland wiki](https://wiki.hyprland.org) for the Lua equivalent.
231
+
232
+ ---
233
+
234
+ ## Project
235
+
236
+ - **GitHub:** [github.com/Prateek-squadron/hyprconf2lua](https://github.com/Prateek-squadron/hyprconf2lua)
237
+ - **License:** MIT
238
+ - **Contributions welcome** — Python, simple codebase, ~400 lines of core logic. If your config doesn't convert cleanly, open an issue or send a PR.
239
+
240
+ ---
241
+
242
+ *Made because Hyprland 0.55 broke everyone's config and someone had to write the migration tool.*
@@ -0,0 +1,15 @@
1
+ hyprconf2lua/__init__.py,sha256=J-j-u0itpEFT6irdmWmixQqYMadNl1X91TxUmoiLHMI,22
2
+ hyprconf2lua/__main__.py,sha256=yL7JuAodb4maYAl2zmMpO9fzBMazPEa-jeS1l1yPQXY,73
3
+ hyprconf2lua/ast.py,sha256=cJ0FSC9k6KnHq-OFbr4wyjZZ_-xyAuILPDVgN1DJMxU,2454
4
+ hyprconf2lua/cli.py,sha256=KbXGLBwO8NauSCTlcwc8RC914nAbet45m3Mm3GgL7BM,5583
5
+ hyprconf2lua/codegen.py,sha256=43cKDBd6Pu-vFKv3n27eMVIxOtJGHiD55CZX8jkmQKQ,35702
6
+ hyprconf2lua/converter.py,sha256=G0iw_T-KxJTP23IyX7ZnTRs_L40LiUcDAt-3UGtFShI,1831
7
+ hyprconf2lua/lexer.py,sha256=0SG8iR3DJPMLXlVasHrMrdlcFHZRncV-iV-p5JfQibQ,1965
8
+ hyprconf2lua/mappings.py,sha256=hy1nqnqb_LMNrtY5dkC-w_VjvBWuTNguOFwyImqri70,5440
9
+ hyprconf2lua/parser.py,sha256=3RoYJqBIlQGdHrUH1O-X0-OLg1EDea-IEBg3AwQ36yU,18254
10
+ hyprconf2lua-1.2.0.dist-info/licenses/LICENSE,sha256=9u-l5DeotnovTmctRGUbLQsKlsOpPoe2sfEcn70Uxp4,1082
11
+ hyprconf2lua-1.2.0.dist-info/METADATA,sha256=w4msOZnaJMraEZlZH695PsnVATFhf3_OPuxLIpq6UlY,8024
12
+ hyprconf2lua-1.2.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
13
+ hyprconf2lua-1.2.0.dist-info/entry_points.txt,sha256=sYbmxMM-cfHT2tMZEFiRoNxIuj5Geh7EK3Xwkh80zlk,55
14
+ hyprconf2lua-1.2.0.dist-info/top_level.txt,sha256=khOSfo2D_1Ryij_NL7idrUPrA4PXzgBZVXWjRERlEek,13
15
+ hyprconf2lua-1.2.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (82.0.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ hyprconf2lua = hyprconf2lua.cli:main
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 hyprconf2lua contributors
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 all
13
+ 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 THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ hyprconf2lua