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