hyprconf2lua 1.2.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.
@@ -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,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,221 @@
1
+ # hyprconf2lua
2
+
3
+ **Your `hyprland.conf` is going away. Here's the one-liner to migrate.**
4
+
5
+ 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.
6
+
7
+ ```bash
8
+ git clone https://github.com/Prateek-squadron/hyprconf2lua.git
9
+ cd hyprconf2lua
10
+ ./install.sh
11
+ hyprconf2lua ~/.config/hypr/hyprland.conf -o hyprland.lua
12
+ ```
13
+
14
+ That's it. ~97% of your config converts cleanly. The rest gets flagged with `-- TODO` comments telling you exactly what to touch up.
15
+
16
+ > **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.
17
+
18
+ ---
19
+
20
+ ## What it looks like
21
+
22
+ **Before** (old `hyprland.conf`):
23
+ ```ini
24
+ $mainMod = SUPER
25
+
26
+ general {
27
+ gaps_in = 5
28
+ gaps_out = 20
29
+ }
30
+
31
+ bind = $mainMod, Q, exec, kitty
32
+ bind = $mainMod, F, fullscreen
33
+
34
+ windowrule = float, ^(pavucontrol)$
35
+
36
+ exec-once = waybar
37
+ exec-once = mako
38
+ ```
39
+
40
+ **After** (new `hyprland.lua`):
41
+ ```lua
42
+ local mainMod = "SUPER"
43
+
44
+ hl.config({
45
+ general = {
46
+ gaps_in = 5,
47
+ gaps_out = 20,
48
+ },
49
+ })
50
+
51
+ hl.bind(mainMod .. " + " .. "Q", hl.dsp.exec_cmd("kitty"))
52
+ hl.bind(mainMod .. " + " .. "F", hl.dsp.window.fullscreen())
53
+
54
+ hl.window_rule({
55
+ name = "float",
56
+ match = { class = "^(pavucontrol)$" },
57
+ float = true,
58
+ })
59
+
60
+ hl.on("hyprland.start", function()
61
+ hl.exec_cmd("waybar")
62
+ hl.exec_cmd("mako")
63
+ end)
64
+ ```
65
+
66
+ ---
67
+
68
+ ## Installation
69
+
70
+ ### Quick install (recommended)
71
+
72
+ ```bash
73
+ git clone https://github.com/Prateek-squadron/hyprconf2lua.git
74
+ cd hyprconf2lua
75
+ ./install.sh # symlinks hyprconf2lua -> ~/.local/bin
76
+ hyprconf2lua ~/.config/hypr/hyprland.conf -o hyprland.lua
77
+ ```
78
+
79
+ ### One-shot (no install)
80
+
81
+ ```bash
82
+ git clone https://github.com/Prateek-squadron/hyprconf2lua.git
83
+ cd hyprconf2lua
84
+ PYTHONPATH=src python3 -m hyprconf2lua ~/.config/hypr/hyprland.conf > hyprland.lua
85
+ ```
86
+
87
+ ### pip install (if your distro allows it)
88
+
89
+ ```bash
90
+ pip install --user .
91
+ # or
92
+ pip install --break-system-packages .
93
+ ```
94
+
95
+ > **"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.
96
+
97
+ ---
98
+
99
+ ## Full migration guide
100
+
101
+ 1. **Backup** your current config:
102
+ ```bash
103
+ cp -r ~/.config/hypr ~/.config/hypr.bak
104
+ ```
105
+
106
+ 2. **Convert your main config**:
107
+ ```bash
108
+ hyprconf2lua ~/.config/hypr/hyprland.conf -o ~/.config/hypr/hyprland.lua
109
+ ```
110
+
111
+ 3. **Check for flags** — run with `--check` to find anything that needs manual review:
112
+ ```bash
113
+ hyprconf2lua --check ~/.config/hypr/hyprland.conf
114
+ # exits 0 if clean, 3 if anything flagged
115
+ ```
116
+
117
+ 4. **Convert sourced files** — if your config has `source = somefile.conf`, convert those too:
118
+ ```bash
119
+ hyprconf2lua --dir ~/.config/hypr --in-place
120
+ ```
121
+ This converts every `.conf` in the directory to `.lua`.
122
+
123
+ 5. **Review `-- TODO` markers** — search for these in the generated `.lua` files and handle them manually.
124
+
125
+ 6. **Test** — restart Hyprland and make sure everything works:
126
+ ```bash
127
+ hyprctl reload
128
+ ```
129
+
130
+ ---
131
+
132
+ ## What works
133
+
134
+ | Category | Status |
135
+ |----------|--------|
136
+ | Keybinds (`bind`, `bindl`, `bindr`, `bindm`, `binde`, `bindd`, etc.) | ✅ All flags and combined forms |
137
+ | Monitors | ✅ 100% |
138
+ | Window rules (`windowrule`, `windowrulev2`) | ✅ Regex patterns, opacity, all rule types |
139
+ | Autostart (`exec-once`, `exec`, `exec-shutdown`) | ✅ Preserves spaces, `&`, pipes |
140
+ | Environment (`env`) | ✅ Commas in values preserved |
141
+ | Animations and beziers | ✅ Named curves, animation presets |
142
+ | Device sections (`device:name { }`) | ✅ |
143
+ | Gestures | ✅ |
144
+ | Workspace rules | ✅ default, monitor, gaps, etc. |
145
+ | Layer rules | ✅ blur, ignorealpha, noanim |
146
+ | Submap blocks (`submap = name` … `submap = reset`) | ✅ `hl.define_submap()` |
147
+ | Config sections (`general`, `decoration`, `input`, …) | ✅ Includes nested subsections (shadow, blur, touchpad) |
148
+ | Variables (`$var = value`) | ✅ Resolved in binds and execs |
149
+ | Comments (`#`) | ✅ Preserved as `--` |
150
+ | `plugin { }` | ⚠️ Flagged with TODO — plugin APIs are plugin-specific |
151
+ | `source = *.conf` | ⚠️ Flagged with conversion reminder |
152
+ | `$` glob patterns in sources | ⚠️ Needs manual handling |
153
+
154
+ **Coverage:** ~97% on standard configs, 90%+ on complex setups like Omarchy, **0% false positives** — everything flagged genuinely needs attention.
155
+
156
+ ---
157
+
158
+ ## Why this over the Go tool?
159
+
160
+ There's another converter (`hyprlang2lua` by EIonTusk) written in Go. Here's why this one exists:
161
+
162
+ - **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.
163
+ - **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.
164
+ - **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.
165
+ - **CI-friendly** — `--check` mode exits 3 if anything needs review. Great for git hooks and automated pipelines.
166
+
167
+ ---
168
+
169
+ ## Usage reference
170
+
171
+ ```bash
172
+ # Convert a single file to stdout
173
+ hyprconf2lua hyprland.conf > hyprland.lua
174
+
175
+ # Convert and write to file
176
+ hyprconf2lua hyprland.conf -o hyprland.lua
177
+
178
+ # Convert from stdin
179
+ cat hyprland.conf | hyprconf2lua > hyprland.lua
180
+
181
+ # Convert all .conf files in a directory tree
182
+ hyprconf2lua --dir ~/.config/hypr --in-place
183
+
184
+ # Check mode (CI): exits 3 if anything needs manual review
185
+ hyprconf2lua --check hyprland.conf
186
+
187
+ # Show translation statistics
188
+ hyprconf2lua hyprland.conf --report
189
+
190
+ # Print version
191
+ hyprconf2lua --version
192
+ ```
193
+
194
+ If you didn't install via `./install.sh`, prefix commands with `PYTHONPATH=src python3 -m`:
195
+ ```bash
196
+ cd hyprconf2lua
197
+ PYTHONPATH=src python3 -m hyprconf2lua ~/.config/hypr/hyprland.conf -o ~/.config/hypr/hyprland.lua
198
+ ```
199
+
200
+ ---
201
+
202
+ ## Manual review checklist
203
+
204
+ After conversion, search your `.lua` files for `TODO`:
205
+
206
+ - **`plugin { }`** — these need `hl.plugin.*` APIs specific to each plugin. See your plugin docs.
207
+ - **`source = path`** — each sourced `.conf` needs individual conversion. Run `hyprconf2lua` on each one.
208
+ - **`submap` bindings** — now handled automatically with `hl.define_submap()`.
209
+ - **Unknown dispatchers** — rare or custom dispatchers are flagged. Check the [Hyprland wiki](https://wiki.hyprland.org) for the Lua equivalent.
210
+
211
+ ---
212
+
213
+ ## Project
214
+
215
+ - **GitHub:** [github.com/Prateek-squadron/hyprconf2lua](https://github.com/Prateek-squadron/hyprconf2lua)
216
+ - **License:** MIT
217
+ - **Contributions welcome** — Python, simple codebase, ~400 lines of core logic. If your config doesn't convert cleanly, open an issue or send a PR.
218
+
219
+ ---
220
+
221
+ *Made because Hyprland 0.55 broke everyone's config and someone had to write the migration tool.*
@@ -0,0 +1,34 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "hyprconf2lua"
7
+ version = "1.2.0"
8
+ description = "Convert Hyprland hyprlang .conf files to Lua .lua config format (v0.55+)"
9
+ readme = "README.md"
10
+ license = {text = "MIT"}
11
+ authors = [
12
+ {name = "hyprconf2lua contributors"}
13
+ ]
14
+ requires-python = ">=3.10"
15
+ keywords = ["hyprland", "hyprlang", "lua", "config", "converter"]
16
+ classifiers = [
17
+ "Development Status :: 4 - Beta",
18
+ "Environment :: Console",
19
+ "Intended Audience :: End Users/Desktop",
20
+ "License :: OSI Approved :: MIT License",
21
+ "Operating System :: POSIX :: Linux",
22
+ "Programming Language :: Python :: 3",
23
+ "Topic :: Utilities",
24
+ ]
25
+
26
+ [project.urls]
27
+ Homepage = "https://github.com/Prateek-squadron/hyprconf2lua"
28
+ Repository = "https://github.com/Prateek-squadron/hyprconf2lua"
29
+
30
+ [project.scripts]
31
+ hyprconf2lua = "hyprconf2lua.cli:main"
32
+
33
+ [tool.setuptools.packages.find]
34
+ where = ["src"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1 @@
1
+ __version__ = "1.0.0"
@@ -0,0 +1,4 @@
1
+ from hyprconf2lua.cli import main
2
+
3
+ if __name__ == "__main__":
4
+ main()
@@ -0,0 +1,171 @@
1
+ from __future__ import annotations
2
+ from dataclasses import dataclass, field
3
+ from typing import Dict, List, Optional, Union
4
+
5
+
6
+ Value = Union[str, List["Value"]]
7
+
8
+
9
+ @dataclass
10
+ class Comment:
11
+ text: str
12
+ line: int
13
+
14
+ def __str__(self) -> str:
15
+ return self.text
16
+
17
+
18
+ @dataclass
19
+ class Directive:
20
+ key: str
21
+ value: List[str]
22
+ line: int
23
+ col: int
24
+
25
+
26
+ @dataclass
27
+ class Section:
28
+ name: str
29
+ body: Block
30
+ line: int
31
+
32
+
33
+ @dataclass
34
+ class VariableDef:
35
+ name: str
36
+ value: str
37
+ line: int
38
+
39
+
40
+ @dataclass
41
+ class ExecDirective:
42
+ kind: str
43
+ command: str
44
+ line: int
45
+
46
+
47
+ @dataclass
48
+ class BindDirective:
49
+ mods: List[str]
50
+ key: str
51
+ dispatcher: str
52
+ params: List[str]
53
+ flags: str
54
+ line: int
55
+
56
+
57
+ @dataclass
58
+ class MonitorDirective:
59
+ name: str
60
+ mode: str
61
+ position: str
62
+ scale: str
63
+ line: int
64
+ extra: Dict[str, str] = field(default_factory=dict)
65
+
66
+
67
+ @dataclass
68
+ class WindowRule:
69
+ is_v2: bool
70
+ rule: str
71
+ match_params: List[str]
72
+ line: int
73
+
74
+
75
+ @dataclass
76
+ class AnimationDirective:
77
+ name: str
78
+ style: str
79
+ speed: str
80
+ curve: str
81
+ line: int
82
+
83
+
84
+ @dataclass
85
+ class BezierDirective:
86
+ name: str
87
+ p1x: str
88
+ p1y: str
89
+ p2x: str
90
+ p2y: str
91
+ line: int
92
+
93
+
94
+ @dataclass
95
+ class EnvDirective:
96
+ name: str
97
+ value: str
98
+ line: int
99
+
100
+
101
+ @dataclass
102
+ class SourceDirective:
103
+ path: str
104
+ line: int
105
+
106
+
107
+ @dataclass
108
+ class DeviceSection:
109
+ name: str
110
+ body: List[Directive]
111
+ line: int
112
+
113
+
114
+ @dataclass
115
+ class GestureDirective:
116
+ body: List[Directive]
117
+ line: int
118
+
119
+
120
+ @dataclass
121
+ class WorkspaceDirective:
122
+ name: str
123
+ params: List[str]
124
+ line: int
125
+
126
+
127
+ @dataclass
128
+ class LayerRuleDirective:
129
+ rule: str
130
+ namespace: str
131
+ line: int
132
+
133
+
134
+ @dataclass
135
+ class SubmapDef:
136
+ name: str
137
+ body: List[BlockStmt]
138
+ line: int
139
+
140
+
141
+ @dataclass
142
+ class WindowRuleBlock:
143
+ is_v2: bool
144
+ name: str
145
+ match: Dict[str, str]
146
+ effects: Dict[str, List[str]]
147
+ line: int
148
+
149
+
150
+ @dataclass
151
+ class LayerRuleBlock:
152
+ name: str
153
+ match: Dict[str, str]
154
+ effects: Dict[str, List[str]]
155
+ line: int
156
+
157
+
158
+ BlockStmt = Union[
159
+ Directive, Section, VariableDef, ExecDirective, BindDirective,
160
+ MonitorDirective, WindowRule, AnimationDirective, BezierDirective,
161
+ EnvDirective, SourceDirective, DeviceSection, GestureDirective,
162
+ WorkspaceDirective, LayerRuleDirective, SubmapDef, Comment,
163
+ WindowRuleBlock, LayerRuleBlock,
164
+ ]
165
+
166
+ Block = List[BlockStmt]
167
+
168
+
169
+ @dataclass
170
+ class ConfigFile:
171
+ body: Block