-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlink.sh
More file actions
executable file
·65 lines (52 loc) · 1.18 KB
/
link.sh
File metadata and controls
executable file
·65 lines (52 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
set -e
DOTFILES_DIR="$HOME/.dotfiles"
CONFIG_DIR="$HOME/.config"
BIN_DIR="$HOME/.local/bin/"
backup_and_link() {
local src=$1
local dest=$2
if [ -e "$dest" ] && [ ! -L "$dest" ]; then
echo "Backing up existing $dest to ${dest}.backup"
mv "$dest" "${dest}.backup"
fi
ln -sf "$src" "$dest"
echo "Linked $dest -> $src"
}
# Files/folders to put directly in home (except .ssh/config handled separately)
home_items=(
".bashrc"
".clang-format"
".gitconfig"
".gitignore"
".pylintrc"
".zshrc"
)
# Folders to put inside ~/.config
config_items=(
"nvim"
"tmux"
"ghostty"
"hypr"
"waybar"
"wofi"
"rofi"
"eww"
"tasks"
"wireplumber"
"conky"
"dunst"
)
# Ensure ~/.config exists
mkdir -p "$CONFIG_DIR"
# Symlink files/folders directly in home
for item in "${home_items[@]}"; do
backup_and_link "$DOTFILES_DIR/$item" "$HOME/$item"
done
# Handle .ssh/config file separately
mkdir -p "$HOME/.ssh" 2> /dev/null
backup_and_link "$DOTFILES_DIR/.ssh/config" "$HOME/.ssh/config"
# Symlink config folders in ~/.config
for item in "${config_items[@]}"; do
backup_and_link "$DOTFILES_DIR/$item" "$CONFIG_DIR/$item"
done
echo "All dotfiles symlinked successfully!"