hyprconf2lua 1.3.1__tar.gz → 1.4.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.3.1/src/hyprconf2lua.egg-info → hyprconf2lua-1.4.0}/PKG-INFO +3 -1
- {hyprconf2lua-1.3.1 → hyprconf2lua-1.4.0}/pyproject.toml +4 -1
- hyprconf2lua-1.4.0/src/hyprconf2lua/__init__.py +1 -0
- {hyprconf2lua-1.3.1 → hyprconf2lua-1.4.0}/src/hyprconf2lua/codegen.py +12 -19
- {hyprconf2lua-1.3.1 → hyprconf2lua-1.4.0}/src/hyprconf2lua/mappings.py +0 -3
- {hyprconf2lua-1.3.1 → hyprconf2lua-1.4.0}/src/hyprconf2lua/parser.py +17 -0
- {hyprconf2lua-1.3.1 → hyprconf2lua-1.4.0/src/hyprconf2lua.egg-info}/PKG-INFO +3 -1
- {hyprconf2lua-1.3.1 → hyprconf2lua-1.4.0}/src/hyprconf2lua.egg-info/SOURCES.txt +1 -0
- hyprconf2lua-1.4.0/src/hyprconf2lua.egg-info/requires.txt +3 -0
- {hyprconf2lua-1.3.1 → hyprconf2lua-1.4.0}/tests/test_converter.py +66 -63
- hyprconf2lua-1.3.1/src/hyprconf2lua/__init__.py +0 -1
- {hyprconf2lua-1.3.1 → hyprconf2lua-1.4.0}/LICENSE +0 -0
- {hyprconf2lua-1.3.1 → hyprconf2lua-1.4.0}/README.md +0 -0
- {hyprconf2lua-1.3.1 → hyprconf2lua-1.4.0}/setup.cfg +0 -0
- {hyprconf2lua-1.3.1 → hyprconf2lua-1.4.0}/src/hyprconf2lua/__main__.py +0 -0
- {hyprconf2lua-1.3.1 → hyprconf2lua-1.4.0}/src/hyprconf2lua/ast.py +0 -0
- {hyprconf2lua-1.3.1 → hyprconf2lua-1.4.0}/src/hyprconf2lua/cli.py +0 -0
- {hyprconf2lua-1.3.1 → hyprconf2lua-1.4.0}/src/hyprconf2lua/converter.py +0 -0
- {hyprconf2lua-1.3.1 → hyprconf2lua-1.4.0}/src/hyprconf2lua/lexer.py +0 -0
- {hyprconf2lua-1.3.1 → hyprconf2lua-1.4.0}/src/hyprconf2lua.egg-info/dependency_links.txt +0 -0
- {hyprconf2lua-1.3.1 → hyprconf2lua-1.4.0}/src/hyprconf2lua.egg-info/entry_points.txt +0 -0
- {hyprconf2lua-1.3.1 → hyprconf2lua-1.4.0}/src/hyprconf2lua.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: hyprconf2lua
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.4.0
|
|
4
4
|
Summary: Convert Hyprland hyprlang .conf files to Lua .lua config format (v0.55+)
|
|
5
5
|
Author: hyprconf2lua contributors
|
|
6
6
|
License: MIT
|
|
@@ -17,6 +17,8 @@ Classifier: Topic :: Utilities
|
|
|
17
17
|
Requires-Python: >=3.10
|
|
18
18
|
Description-Content-Type: text/markdown
|
|
19
19
|
License-File: LICENSE
|
|
20
|
+
Provides-Extra: dev
|
|
21
|
+
Requires-Dist: pytest; extra == "dev"
|
|
20
22
|
Dynamic: license-file
|
|
21
23
|
|
|
22
24
|
# hyprconf2lua
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "hyprconf2lua"
|
|
7
|
-
version = "1.
|
|
7
|
+
version = "1.4.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"}
|
|
@@ -23,6 +23,9 @@ classifiers = [
|
|
|
23
23
|
"Topic :: Utilities",
|
|
24
24
|
]
|
|
25
25
|
|
|
26
|
+
[project.optional-dependencies]
|
|
27
|
+
dev = ["pytest"]
|
|
28
|
+
|
|
26
29
|
[project.urls]
|
|
27
30
|
Homepage = "https://github.com/Prateek-squadron/hyprconf2lua"
|
|
28
31
|
Repository = "https://github.com/Prateek-squadron/hyprconf2lua"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "1.4.0"
|
|
@@ -51,8 +51,8 @@ class Codegen:
|
|
|
51
51
|
|
|
52
52
|
def generate(self, config: ConfigFile) -> str:
|
|
53
53
|
self.lines = []
|
|
54
|
-
self.emit("-- Generated by hyprconf2lua v1.
|
|
55
|
-
self.emit("-- https://github.com/
|
|
54
|
+
self.emit("-- Generated by hyprconf2lua v1.4.0")
|
|
55
|
+
self.emit("-- https://github.com/Prateek-squadron/hyprconf2lua")
|
|
56
56
|
self.emit("-- Manual review may be needed for complex directives")
|
|
57
57
|
self.emit("")
|
|
58
58
|
self.emit('---@module \'hl\'')
|
|
@@ -550,6 +550,16 @@ class Codegen:
|
|
|
550
550
|
return f'{func}({{ forward = false }})'
|
|
551
551
|
return f'{func}({{ forward = true }})'
|
|
552
552
|
|
|
553
|
+
if dispatcher == "moveintogroup":
|
|
554
|
+
if params:
|
|
555
|
+
dir_map = {"l": "left", "r": "right", "u": "up", "d": "down"}
|
|
556
|
+
d = dir_map.get(params[0], params[0])
|
|
557
|
+
return f'{func}({{ into_group = "{d}" }})'
|
|
558
|
+
return None
|
|
559
|
+
|
|
560
|
+
if dispatcher == "moveoutofgroup":
|
|
561
|
+
return f'{func}({{ out_of_group = true }})'
|
|
562
|
+
|
|
553
563
|
if dispatcher == "workspace":
|
|
554
564
|
return self.build_workspace_dispatcher(func, params)
|
|
555
565
|
|
|
@@ -565,12 +575,6 @@ class Codegen:
|
|
|
565
575
|
if dispatcher == "focusonemonitor":
|
|
566
576
|
return f'{func}({{ on_monitor = true }})'
|
|
567
577
|
|
|
568
|
-
if dispatcher == "mouse":
|
|
569
|
-
mouse_actions = {"272": "drag", "273": "resize"}
|
|
570
|
-
if params and params[0] in mouse_actions:
|
|
571
|
-
return f'hl.dsp.window.{mouse_actions[params[0]]}()'
|
|
572
|
-
return None
|
|
573
|
-
|
|
574
578
|
if dispatcher in ("exec", "execr"):
|
|
575
579
|
resolved = self.resolve_val(params[0]) if params else ""
|
|
576
580
|
return f'{func}({self.quote(resolved)})'
|
|
@@ -584,16 +588,6 @@ class Codegen:
|
|
|
584
588
|
return f'hl.dsp.window.{mouse_actions[params[0]]}()'
|
|
585
589
|
return None
|
|
586
590
|
|
|
587
|
-
if dispatcher in ("moveintogroup",):
|
|
588
|
-
if params:
|
|
589
|
-
dir_map = {"l": "left", "r": "right", "u": "up", "d": "down"}
|
|
590
|
-
d = dir_map.get(params[0], params[0])
|
|
591
|
-
return f'hl.dsp.window.move({{ into_group = "{d}" }})'
|
|
592
|
-
return None
|
|
593
|
-
|
|
594
|
-
elif dispatcher in ("moveoutofgroup",):
|
|
595
|
-
return f'hl.dsp.window.move({{ out_of_group = true }})'
|
|
596
|
-
|
|
597
591
|
return None
|
|
598
592
|
|
|
599
593
|
def build_workspace_dispatcher(self, func: str, params: List[str]) -> str:
|
|
@@ -835,7 +829,6 @@ class Codegen:
|
|
|
835
829
|
return
|
|
836
830
|
|
|
837
831
|
self.emit(f'-- source = {path} -> requires manual conversion')
|
|
838
|
-
home_relative = path.replace("~", "").replace(os_path := "", ".hypr/")
|
|
839
832
|
|
|
840
833
|
import os as _os
|
|
841
834
|
just_name = _os.path.splitext(_os.path.basename(path))[0]
|
|
@@ -75,8 +75,6 @@ WINDOW_RULE_MAP = {
|
|
|
75
75
|
"noshadow": ("shadow", "false"),
|
|
76
76
|
"noanim": ("no_anim", "true"),
|
|
77
77
|
"dimaround": ("dim_around", "true"),
|
|
78
|
-
"noblur": ("blur", "false"),
|
|
79
|
-
"noshadow": ("shadow", "false"),
|
|
80
78
|
"nomaxsize": ("max_size", "false"),
|
|
81
79
|
"fakefullscreen": ("fake_fullscreen", "true"),
|
|
82
80
|
"noinitialfocus": ("no_initial_focus", "true"),
|
|
@@ -96,7 +94,6 @@ WINDOW_RULE_PARAM_MAP = {
|
|
|
96
94
|
"size": ("size", True),
|
|
97
95
|
"minsize": ("min_size", True),
|
|
98
96
|
"maxsize": ("max_size", True),
|
|
99
|
-
"maxsize": ("max_size", True),
|
|
100
97
|
"idleinhibit": ("idle_inhibit", True),
|
|
101
98
|
"xray": ("xray", True),
|
|
102
99
|
"center": ("center", True),
|
|
@@ -172,6 +172,23 @@ class Parser:
|
|
|
172
172
|
current = []
|
|
173
173
|
while self.peek().type not in ("NEWLINE", "EOF") and \
|
|
174
174
|
self.peek().type != "COMMENT":
|
|
175
|
+
if self.peek().type == "BLOCK_CLOSE":
|
|
176
|
+
break
|
|
177
|
+
if self.peek().type == "BLOCK_OPEN":
|
|
178
|
+
self.advance()
|
|
179
|
+
current.append("{")
|
|
180
|
+
depth = 1
|
|
181
|
+
while depth > 0 and self.peek().type not in ("EOF", "NEWLINE"):
|
|
182
|
+
t = self.advance()
|
|
183
|
+
if t.type == "BLOCK_OPEN":
|
|
184
|
+
depth += 1
|
|
185
|
+
elif t.type == "BLOCK_CLOSE":
|
|
186
|
+
depth -= 1
|
|
187
|
+
if depth > 0:
|
|
188
|
+
current.append(t.value)
|
|
189
|
+
if depth == 0:
|
|
190
|
+
current.append("}")
|
|
191
|
+
continue
|
|
175
192
|
if self.peek().type == "COMMA":
|
|
176
193
|
self.advance()
|
|
177
194
|
values.append(self._join_tokens(current))
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: hyprconf2lua
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.4.0
|
|
4
4
|
Summary: Convert Hyprland hyprlang .conf files to Lua .lua config format (v0.55+)
|
|
5
5
|
Author: hyprconf2lua contributors
|
|
6
6
|
License: MIT
|
|
@@ -17,6 +17,8 @@ Classifier: Topic :: Utilities
|
|
|
17
17
|
Requires-Python: >=3.10
|
|
18
18
|
Description-Content-Type: text/markdown
|
|
19
19
|
License-File: LICENSE
|
|
20
|
+
Provides-Extra: dev
|
|
21
|
+
Requires-Dist: pytest; extra == "dev"
|
|
20
22
|
Dynamic: license-file
|
|
21
23
|
|
|
22
24
|
# hyprconf2lua
|
|
@@ -14,5 +14,6 @@ src/hyprconf2lua.egg-info/PKG-INFO
|
|
|
14
14
|
src/hyprconf2lua.egg-info/SOURCES.txt
|
|
15
15
|
src/hyprconf2lua.egg-info/dependency_links.txt
|
|
16
16
|
src/hyprconf2lua.egg-info/entry_points.txt
|
|
17
|
+
src/hyprconf2lua.egg-info/requires.txt
|
|
17
18
|
src/hyprconf2lua.egg-info/top_level.txt
|
|
18
19
|
tests/test_converter.py
|
|
@@ -88,14 +88,11 @@ def test_lexer_variable():
|
|
|
88
88
|
|
|
89
89
|
|
|
90
90
|
def test_lexer_error():
|
|
91
|
+
from hyprconf2lua.lexer import LexerError
|
|
91
92
|
import pytest
|
|
92
|
-
try:
|
|
93
|
-
from hyprconf2lua.lexer import LexerError
|
|
94
|
-
except ImportError:
|
|
95
|
-
pytest.skip("need pytest")
|
|
96
93
|
|
|
97
94
|
with pytest.raises(LexerError):
|
|
98
|
-
tokenize("key = value
|
|
95
|
+
tokenize("key = value !bad")
|
|
99
96
|
|
|
100
97
|
|
|
101
98
|
def test_parse_variable():
|
|
@@ -599,61 +596,67 @@ def test_movetoworkspacesilent_conversion():
|
|
|
599
596
|
assert "workspace = 1" in result.lua
|
|
600
597
|
|
|
601
598
|
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
599
|
+
def test_single_line_section():
|
|
600
|
+
result = convert('general { gaps_in = 5 }\n')
|
|
601
|
+
assert result.success
|
|
602
|
+
assert "hl.config" in result.lua
|
|
603
|
+
assert "gaps_in = 5" in result.lua
|
|
604
|
+
|
|
605
|
+
|
|
606
|
+
def test_empty_file():
|
|
607
|
+
result = convert("")
|
|
608
|
+
assert result.success
|
|
609
|
+
|
|
610
|
+
|
|
611
|
+
def test_whitespace_only():
|
|
612
|
+
result = convert(" \n \n \n")
|
|
613
|
+
assert result.success
|
|
614
|
+
|
|
615
|
+
|
|
616
|
+
def test_tab_indentation():
|
|
617
|
+
result = convert("general {\n\tgaps_in = 5\n}\n")
|
|
618
|
+
assert result.success
|
|
619
|
+
assert "gaps_in = 5" in result.lua
|
|
620
|
+
|
|
621
|
+
|
|
622
|
+
def test_bind_no_params():
|
|
623
|
+
result = convert("bind = SUPER, Q, exec\n")
|
|
624
|
+
assert result.success
|
|
625
|
+
|
|
626
|
+
|
|
627
|
+
def test_unbind_no_args():
|
|
628
|
+
result = convert("unbind = ,\n")
|
|
629
|
+
assert result.success
|
|
630
|
+
|
|
631
|
+
|
|
632
|
+
def test_exec_shutdown():
|
|
633
|
+
result = convert("exec-shutdown = killall waybar\n")
|
|
634
|
+
assert result.success
|
|
635
|
+
assert "hl.on" in result.lua or "exec_shutdown" in result.lua
|
|
636
|
+
|
|
637
|
+
|
|
638
|
+
def test_gesture_multiple():
|
|
639
|
+
result = convert("gesture {\n workspace_swipe = true\n workspace_swipe_fingers = 3\n}\n")
|
|
640
|
+
assert result.success
|
|
641
|
+
assert "hl.gesture" in result.lua
|
|
642
|
+
assert "swipe fingers" in result.lua
|
|
643
|
+
|
|
644
|
+
|
|
645
|
+
def test_moveintogroup_dispatcher():
|
|
646
|
+
result = convert("bind = SUPER, T, moveintogroup, l\n")
|
|
647
|
+
assert result.success
|
|
648
|
+
assert "into_group" in result.lua
|
|
649
|
+
assert '"left"' in result.lua
|
|
650
|
+
|
|
651
|
+
|
|
652
|
+
def test_moveoutofgroup_dispatcher():
|
|
653
|
+
result = convert("bind = SUPER, T, moveoutofgroup\n")
|
|
654
|
+
assert result.success
|
|
655
|
+
assert "out_of_group" in result.lua
|
|
656
|
+
|
|
657
|
+
|
|
658
|
+
def test_nested_subsection_in_decoration():
|
|
659
|
+
result = convert("decoration {\n blur {\n size = 3\n passes = 2\n }\n}\n")
|
|
660
|
+
assert result.success
|
|
661
|
+
assert "blur" in result.lua
|
|
662
|
+
assert "size = 3" in result.lua
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "1.3.1"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|