-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfix_migration_errors.py
More file actions
49 lines (37 loc) · 1.32 KB
/
fix_migration_errors.py
File metadata and controls
49 lines (37 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import re
path = "/home/xscriptor/.config/hypr/windowrules.conf"
output_path = "/home/xscriptor/.config/hypr/windowrules.conf"
print(f"Reading {path}")
with open(path, 'r') as f:
lines = f.readlines()
new_lines = []
in_block = False
for line in lines:
stripped = line.strip()
# Handle block syntax - comment out everything inside windowrule { }
if stripped.startswith("windowrule {"):
in_block = True
new_lines.append("# " + line)
continue
if in_block:
new_lines.append("# " + line)
if stripped == "}":
in_block = False
continue
# Handle floating match cleanup
# Remove "match:floating 1" and associated commas
# Patterns:
# "match:floating 1, " -> "match:" (keep match prefix for next item)
# ", match:floating 1" -> "" (item is later in list)
l = line
l = l.replace("match:floating 1, ", "match:")
l = l.replace(", match:floating 1", "")
# Ensure space separator for match syntax
# "match:class:" -> "match:class "
l = l.replace("match:class:", "match:class ")
l = l.replace("match:title:", "match:title ")
new_lines.append(l)
print(f"Writing {len(new_lines)} lines to {output_path}")
with open(output_path, 'w') as f:
f.writelines(new_lines)
print("Cleanup completed.")