2022-05-27 21:07:07 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
function i3setup() {
|
2022-05-29 00:31:14 +02:00
|
|
|
local file dir cfg path \
|
|
|
|
component="$1" \
|
|
|
|
patterns=(
|
|
|
|
"config.vars"
|
|
|
|
"config.pre-main"
|
|
|
|
"config.main"
|
|
|
|
"config.post-main"
|
|
|
|
)
|
|
|
|
|
|
|
|
dir="$HOME/.config/$component"
|
2022-05-27 21:07:07 +02:00
|
|
|
cfg="$dir/config"
|
|
|
|
|
2022-05-29 00:31:14 +02:00
|
|
|
echo "Building $component config... 🔨"
|
2022-05-27 21:07:07 +02:00
|
|
|
rm "$cfg" 2>/dev/null
|
|
|
|
|
|
|
|
for pattern in "${patterns[@]}"; do
|
|
|
|
while IFS= read -r path; do
|
|
|
|
[ -z "$path" ] && continue
|
|
|
|
file="${path##*/}"
|
|
|
|
|
|
|
|
echo "WRITE : '$file'."
|
|
|
|
|
|
|
|
{
|
|
|
|
echo "# >>>$file"
|
|
|
|
cat "$path" >>"$cfg"
|
|
|
|
echo "# <<<$file"
|
|
|
|
echo
|
|
|
|
} >>"$cfg"
|
|
|
|
|
|
|
|
done <<<"$(find "$dir" -maxdepth 1 -type f -name "$pattern*" | sort -n)"
|
|
|
|
done
|
|
|
|
|
|
|
|
echo
|
|
|
|
echo "Restarting i3... 🔄"
|
|
|
|
i3 restart
|
|
|
|
echo
|
|
|
|
}
|
|
|
|
|
2022-05-29 00:31:14 +02:00
|
|
|
i3setup i3
|
|
|
|
i3setup i3status
|