sigils/hyprland-convert-script.sh
2024-11-16 13:21:28 +01:00

16 lines
985 B
Bash
Executable file

# 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