hyprconf2lua 1.3.0__tar.gz → 1.3.1__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.0/src/hyprconf2lua.egg-info → hyprconf2lua-1.3.1}/PKG-INFO +1 -1
- {hyprconf2lua-1.3.0 → hyprconf2lua-1.3.1}/pyproject.toml +1 -1
- hyprconf2lua-1.3.1/src/hyprconf2lua/__init__.py +1 -0
- {hyprconf2lua-1.3.0 → hyprconf2lua-1.3.1}/src/hyprconf2lua/codegen.py +7 -3
- {hyprconf2lua-1.3.0 → hyprconf2lua-1.3.1}/src/hyprconf2lua/parser.py +35 -8
- {hyprconf2lua-1.3.0 → hyprconf2lua-1.3.1/src/hyprconf2lua.egg-info}/PKG-INFO +1 -1
- {hyprconf2lua-1.3.0 → hyprconf2lua-1.3.1}/tests/test_converter.py +38 -1
- hyprconf2lua-1.3.0/src/hyprconf2lua/__init__.py +0 -1
- {hyprconf2lua-1.3.0 → hyprconf2lua-1.3.1}/LICENSE +0 -0
- {hyprconf2lua-1.3.0 → hyprconf2lua-1.3.1}/README.md +0 -0
- {hyprconf2lua-1.3.0 → hyprconf2lua-1.3.1}/setup.cfg +0 -0
- {hyprconf2lua-1.3.0 → hyprconf2lua-1.3.1}/src/hyprconf2lua/__main__.py +0 -0
- {hyprconf2lua-1.3.0 → hyprconf2lua-1.3.1}/src/hyprconf2lua/ast.py +0 -0
- {hyprconf2lua-1.3.0 → hyprconf2lua-1.3.1}/src/hyprconf2lua/cli.py +0 -0
- {hyprconf2lua-1.3.0 → hyprconf2lua-1.3.1}/src/hyprconf2lua/converter.py +0 -0
- {hyprconf2lua-1.3.0 → hyprconf2lua-1.3.1}/src/hyprconf2lua/lexer.py +0 -0
- {hyprconf2lua-1.3.0 → hyprconf2lua-1.3.1}/src/hyprconf2lua/mappings.py +0 -0
- {hyprconf2lua-1.3.0 → hyprconf2lua-1.3.1}/src/hyprconf2lua.egg-info/SOURCES.txt +0 -0
- {hyprconf2lua-1.3.0 → hyprconf2lua-1.3.1}/src/hyprconf2lua.egg-info/dependency_links.txt +0 -0
- {hyprconf2lua-1.3.0 → hyprconf2lua-1.3.1}/src/hyprconf2lua.egg-info/entry_points.txt +0 -0
- {hyprconf2lua-1.3.0 → hyprconf2lua-1.3.1}/src/hyprconf2lua.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "1.3.1"
|
|
@@ -51,7 +51,7 @@ class Codegen:
|
|
|
51
51
|
|
|
52
52
|
def generate(self, config: ConfigFile) -> str:
|
|
53
53
|
self.lines = []
|
|
54
|
-
self.emit("-- Generated by hyprconf2lua v1.3.
|
|
54
|
+
self.emit("-- Generated by hyprconf2lua v1.3.1")
|
|
55
55
|
self.emit("-- https://github.com/yourusername/hyprconf2lua")
|
|
56
56
|
self.emit("-- Manual review may be needed for complex directives")
|
|
57
57
|
self.emit("")
|
|
@@ -506,8 +506,12 @@ class Codegen:
|
|
|
506
506
|
if dispatcher in DISPATCHER_MAP:
|
|
507
507
|
func, needs_args = DISPATCHER_MAP[dispatcher]
|
|
508
508
|
|
|
509
|
+
if dispatcher == "movetoworkspace":
|
|
510
|
+
args = self.build_dispatcher_args(params, needs_args, func)
|
|
511
|
+
return f'{func}({args})'
|
|
512
|
+
|
|
509
513
|
if dispatcher == "movetoworkspacesilent":
|
|
510
|
-
args = self.build_dispatcher_args(params, needs_args)
|
|
514
|
+
args = self.build_dispatcher_args(params, needs_args, func)
|
|
511
515
|
return f'{func}({args}, {{ follow = false }})'
|
|
512
516
|
|
|
513
517
|
if dispatcher == "movefocus":
|
|
@@ -571,7 +575,7 @@ class Codegen:
|
|
|
571
575
|
resolved = self.resolve_val(params[0]) if params else ""
|
|
572
576
|
return f'{func}({self.quote(resolved)})'
|
|
573
577
|
|
|
574
|
-
args = self.build_dispatcher_args(params, needs_args)
|
|
578
|
+
args = self.build_dispatcher_args(params, needs_args, func)
|
|
575
579
|
return f'{func}({args})' if needs_args else f'{func}()'
|
|
576
580
|
|
|
577
581
|
if dispatcher == "mouse":
|
|
@@ -344,15 +344,42 @@ class Parser:
|
|
|
344
344
|
break
|
|
345
345
|
key = ":".join(key_parts)
|
|
346
346
|
|
|
347
|
-
self.
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
347
|
+
if key == "match" and self.peek().type == "BLOCK_OPEN":
|
|
348
|
+
self.advance()
|
|
349
|
+
self.skip_newlines()
|
|
350
|
+
while self.peek().type not in ("BLOCK_CLOSE", "EOF"):
|
|
351
|
+
t2 = self.peek()
|
|
352
|
+
if t2.type == "COMMENT":
|
|
353
|
+
self.advance()
|
|
354
|
+
elif t2.type == "IDENT":
|
|
355
|
+
mk_parts = [self.advance().value]
|
|
356
|
+
while self.peek().type == "COLON":
|
|
357
|
+
self.advance()
|
|
358
|
+
if self.peek().type == "IDENT":
|
|
359
|
+
mk_parts.append(self.advance().value)
|
|
360
|
+
else:
|
|
361
|
+
break
|
|
362
|
+
mk_key = ":".join(mk_parts)
|
|
363
|
+
self.expect("EQUALS")
|
|
364
|
+
mk_val = self.parse_value_rest()
|
|
365
|
+
if mk_key.startswith("match:"):
|
|
366
|
+
match[mk_key[len("match:"):]] = mk_val
|
|
367
|
+
else:
|
|
368
|
+
match[mk_key] = mk_val
|
|
369
|
+
else:
|
|
370
|
+
self.advance()
|
|
371
|
+
self.skip_newlines()
|
|
372
|
+
self.expect("BLOCK_CLOSE")
|
|
354
373
|
else:
|
|
355
|
-
|
|
374
|
+
self.expect("EQUALS")
|
|
375
|
+
val = self.parse_value_rest()
|
|
376
|
+
|
|
377
|
+
if key == "name":
|
|
378
|
+
name = val
|
|
379
|
+
elif key.startswith("match:"):
|
|
380
|
+
match[key[len("match:"):]] = val
|
|
381
|
+
else:
|
|
382
|
+
effects[key] = [val]
|
|
356
383
|
else:
|
|
357
384
|
self.advance()
|
|
358
385
|
self.skip_newlines()
|
|
@@ -563,10 +563,42 @@ def test_gradient_conversion():
|
|
|
563
563
|
def test_col_dot_prefix_grouped():
|
|
564
564
|
result = convert('general {\n col.active_border = rgba(33ccffee) rgba(00ff99ee) 45deg\n col.inactive_border = rgba(595959aa)\n gaps_in = 5\n}\n')
|
|
565
565
|
assert result.success
|
|
566
|
-
# Both col.* keys should be grouped under one 'col' section
|
|
567
566
|
assert result.lua.count("col = {") == 1
|
|
568
567
|
|
|
569
568
|
|
|
569
|
+
def test_match_block_in_windowrule():
|
|
570
|
+
result = convert('windowrule {\n name = my-rule\n float = on\n match {\n class = .*\n title = my-window\n }\n}\n')
|
|
571
|
+
assert result.success
|
|
572
|
+
assert "class = \".*\"" in result.lua
|
|
573
|
+
assert "title = \"my-window\"" in result.lua
|
|
574
|
+
assert "float = true" in result.lua
|
|
575
|
+
|
|
576
|
+
|
|
577
|
+
def test_match_block_in_windowrulev2():
|
|
578
|
+
result = convert('windowrulev2 {\n name = v2-match\n opacity = 0.9 0.8\n match {\n class = (kitty)\n }\n}\n')
|
|
579
|
+
assert result.success
|
|
580
|
+
assert "class = \"(kitty)\"" in result.lua
|
|
581
|
+
assert "opacity = { 0.9, 0.8 }" in result.lua
|
|
582
|
+
|
|
583
|
+
|
|
584
|
+
def test_match_block_in_layerrule():
|
|
585
|
+
result = convert('layerrule {\n name = my-layer\n blur = true\n match {\n namespace = rofi\n }\n}\n')
|
|
586
|
+
assert result.success
|
|
587
|
+
assert "namespace" in result.lua
|
|
588
|
+
|
|
589
|
+
|
|
590
|
+
def test_movetoworkspace_conversion():
|
|
591
|
+
result = convert('bind = $mainMod SHIFT, 1, movetoworkspace, 1\n')
|
|
592
|
+
assert result.success
|
|
593
|
+
assert "workspace = 1" in result.lua
|
|
594
|
+
|
|
595
|
+
|
|
596
|
+
def test_movetoworkspacesilent_conversion():
|
|
597
|
+
result = convert('bind = $mainMod SHIFT, 1, movetoworkspacesilent, 1\n')
|
|
598
|
+
assert result.success
|
|
599
|
+
assert "workspace = 1" in result.lua
|
|
600
|
+
|
|
601
|
+
|
|
570
602
|
if __name__ == "__main__":
|
|
571
603
|
test_lexer_basic()
|
|
572
604
|
test_lexer_comment()
|
|
@@ -619,4 +651,9 @@ if __name__ == "__main__":
|
|
|
619
651
|
test_device_without_prefix()
|
|
620
652
|
test_gradient_conversion()
|
|
621
653
|
test_col_dot_prefix_grouped()
|
|
654
|
+
test_match_block_in_windowrule()
|
|
655
|
+
test_match_block_in_windowrulev2()
|
|
656
|
+
test_match_block_in_layerrule()
|
|
657
|
+
test_movetoworkspace_conversion()
|
|
658
|
+
test_movetoworkspacesilent_conversion()
|
|
622
659
|
print("All tests passed!")
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "1.3.0"
|
|
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
|
|
File without changes
|
|
File without changes
|