summaryrefslogtreecommitdiff
path: root/hyprland-convert-script.sh
diff options
context:
space:
mode:
authorSisiutl <sisiutl@egregore.fun>2024-11-16 13:21:28 +0100
committerSisiutl <sisiutl@egregore.fun>2024-11-16 13:21:28 +0100
commitdf4831e5d94bc51dd6fb5246e17cff722c162afc (patch)
tree645578b25d8719ac7a13e4379a4cc1caabe5b580 /hyprland-convert-script.sh
parentb145f49e502abef18053d35c3be5c70bf983aca2 (diff)
hyprland config conversion script
Diffstat (limited to 'hyprland-convert-script.sh')
-rwxr-xr-xhyprland-convert-script.sh16
1 files changed, 16 insertions, 0 deletions
diff --git a/hyprland-convert-script.sh b/hyprland-convert-script.sh
new file mode 100755
index 0000000..8547d62
--- /dev/null
+++ b/hyprland-convert-script.sh
@@ -0,0 +1,16 @@
+# This horrible, untested sed monstruosity converts your hyprland config to the home-hyprland format.
+# Please, check manually what comes out of it first.
+# TODO: make it into a scheme script
+
+echo "(autogenerated 1)"
+sed 's/#.*//g ; # remove comments from the old config file
+ /^[[:space:]]*$/d ; # remove all leading whitespace
+ s/^ *//g ; y/{}/()/ ; # replace braces with parentheses, for blocks
+ s/yes, please :)/#t/g ; # feel free to change it back to "yes, please :)"
+ s/[^(]$/&)/ ; # add leading parentheses to all expressions
+ s/^[^)]/(&/ ; # same for closing paren
+ s/[^ ,=()"]\+\( [^ ,=()"]\+\)\+/(&)/g ; # enclose in a list space-separated things like "popin 80%" or "suppressevent maximize"
+ s/ \?\(=\|,\) *, \?/ () /g ; # empty fields in comma-separated lists get turned into ()
+ s/, \?)/ ())/g ; # same, but for the "end-line" commas
+ s/, \?/ /g ; # commas get turned into spaces
+ s/ \?= \?/ /g # equals get removed' $1