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

1
config/mako/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
config

View File

@@ -1,10 +1,10 @@
sort=-time sort=-time
layer=overlay layer=overlay
background-color=#0a070c89 background-color=$background_color
width=300 width=300
height=110 height=110
border-size=2 border-size=2
border-color=#E88889 border-color=$border_color
border-radius=4 border-radius=4
icons=0 icons=0
max-icon-size=64 max-icon-size=64

View File

@@ -2,19 +2,10 @@
. "${HOME}/.cache/wal/colors.sh" . "${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. envsubst <$HOME/.config/mako/config.template >$HOME/.config/mako/config
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
makoctl reload makoctl reload