summaryrefslogtreecommitdiff
path: root/hyprland-convert-script.sh
blob: 8547d62434663700babbb8f433440a0c7bb65236 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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