From 1cace80e4832a5d250ef4b7ccd687996563fb01b Mon Sep 17 00:00:00 2001 From: venomade Date: Thu, 27 Feb 2025 17:06:42 +0000 Subject: Add old dotfiles --- swaywm/softlink.sh | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100755 swaywm/softlink.sh (limited to 'swaywm/softlink.sh') 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." -- cgit 1.4.1-2-gfad0