feat(setup): copy gtk-related config instead of symlinking

This commit is contained in:
Oscar Wallberg
2024-09-16 00:40:03 +02:00
parent 54b999e405
commit 7e76f825c7
+54 -3
View File
@@ -43,8 +43,6 @@ SYMLINKS=(
".config/dunst" ".config/dunst"
".config/fish" ".config/fish"
".config/frogminer" ".config/frogminer"
".config/gtk-3.0"
".config/gtk-4.0"
".config/i3" ".config/i3"
".config/i3status" ".config/i3status"
".config/lf" ".config/lf"
@@ -57,12 +55,18 @@ SYMLINKS=(
".local/bin" ".local/bin"
".local/share/fonts" ".local/share/fonts"
".local/share/konsole" ".local/share/konsole"
".gtkrc-2.0"
".xinit-scripts" ".xinit-scripts"
".xinitrc" ".xinitrc"
".Xresources" ".Xresources"
) )
typeset -a COPIES
COPIES=(
".config/gtk-3.0"
".config/gtk-4.0"
".gtkrc-2.0"
)
typeset -A SYMLINK_MAP typeset -A SYMLINK_MAP
SYMLINK_MAP[zsh/rc]=".zshrc" SYMLINK_MAP[zsh/rc]=".zshrc"
@@ -160,6 +164,46 @@ create_symlink() {
ln -s "$src" "$dst" ln -s "$src" "$dst"
} }
copy_item() {
local src dst dst_parent
if test -z "$1"; then
error "missing src argument:"
error "$0 $1 $2"
return 1
fi
if test -z "$2"; then
error "missing dst argument:"
error "$0 $1 $2"
return 1
fi
src="${SCRIPT_DIR}/$1"
dst="${DEST_DIR}/$2"
dst_parent="$(dirname -- "$dst")"
if ! test -e "$src"; then
error "the following source path does not exist:"
error "$src"
return 1
fi
if ! test -d "$dst_parent"; then
echo "Creating $dst_parent"
mkdir -p "$dst_parent"
fi
if test -e "$dst"; then
error "path already exists:"
error "${dst}"
return 1
fi
echo "Copying item: from $src to ${dst_parent}/"
cp -r "$src" "${dst_parent}/"
}
create_all_symlinks() { create_all_symlinks() {
for link in "${SYMLINKS[@]}"; do for link in "${SYMLINKS[@]}"; do
create_symlink "$link" "$link" create_symlink "$link" "$link"
@@ -170,6 +214,12 @@ create_all_symlinks() {
done done
} }
copy_all_items() {
for item in "${COPIES[@]}"; do
copy_item "$item" "$item"
done
}
check_terminfo() { check_terminfo() {
if ! infocmp tmux-256color > /dev/null; then if ! infocmp tmux-256color > /dev/null; then
error "Missing terminfo for tmux-256color. Try installing ncurses-term." error "Missing terminfo for tmux-256color. Try installing ncurses-term."
@@ -222,6 +272,7 @@ else
check_terminfo check_terminfo
check_packages_installed check_packages_installed
create_all_symlinks create_all_symlinks
copy_all_items
fi fi
if $ERROR; then if $ERROR; then