make mako config templateable

This commit is contained in:
2025-10-05 21:47:07 +02:00
parent d3498f1724
commit 0e73424795
3 changed files with 7 additions and 15 deletions

View File

@@ -2,19 +2,10 @@
. "${HOME}/.cache/wal/colors.sh"
conffile="${HOME}/.config/mako/config"
export background_color="${background}89"
export text_color="$foreground"
export border_color="$color13"
# Associative array, color name -> color code.
declare -A colors
colors=(
["background-color"]="${background}89"
["text-color"]="$foreground"
["border-color"]="$color13"
)
for color_name in "${!colors[@]}"; do
# replace first occurance of each color in config file
sed -i "0,/^$color_name.*/{s//$color_name=${colors[$color_name]}/}" $conffile
done
envsubst <$HOME/.config/mako/config.template >$HOME/.config/mako/config
makoctl reload