diff options
Diffstat (limited to 'swaywm/softlink.sh')
-rwxr-xr-x | swaywm/softlink.sh | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/swaywm/softlink.sh b/swaywm/softlink.sh new file mode 100755 index 0000000..ebb5c3f --- /dev/null +++ b/swaywm/softlink.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +# Define an associative array mapping dotfile names to their corresponding paths +declare -A dotfiles=( + ["bashrc"]="$HOME/.bashrc" + ["papes/PurplePhoneLines.jpg"]="$HOME/Pictures/Papes/PurplePhoneLines.jpg" + ["local/bin"]="$HOME/.local/bin" + ["config/foot"]="$HOME/.config/foot" + ["config/sway"]="$HOME/.config/sway" + ["config/dunst"]="$HOME/.config/dunst" + ["config/i3status/"]="$HOME/.config/i3status" + # Add more dotfiles here as needed +) + +# Function to create symbolic links +create_symlink() { + local source=$1 + local target=$2 + + # Check if the target file already exists + if [ -e "$target" ]; then + echo "Target file '$target' already exists. Skipping..." + return + fi + + # Check if the target directory exists, if not, create it + local target_dir=$(dirname "$target") + if [ ! -d "$target_dir" ]; then + mkdir -p "$target_dir" + fi + + # Create symbolic link + ln -s "$source" "$target" + echo "Created symbolic link: $source -> $target" +} + +# Loop through each dotfile and create symbolic links +for file in "${!dotfiles[@]}"; do + create_symlink "$(pwd)/$file" "${dotfiles[$file]}" +done + +echo "Dotfile setup complete." |