mirror of https://gitlab.com/dabruh/dotfiles.git
44 lines
899 B
Bash
Executable File
44 lines
899 B
Bash
Executable File
#!/bin/bash
|
|
|
|
function i3setup() {
|
|
local file dir cfg path \
|
|
component="$1" \
|
|
patterns=(
|
|
"config.vars"
|
|
"config.pre-main"
|
|
"config.main"
|
|
"config.post-main"
|
|
)
|
|
|
|
dir="$HOME/.config/$component"
|
|
cfg="$dir/config"
|
|
|
|
echo "Building $component config... 🔨"
|
|
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
|
|
}
|
|
|
|
i3setup i3
|
|
i3setup i3status
|