2022-08-01 13:59:07 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
declare -A mapper=(
|
2022-10-04 21:17:16 +00:00
|
|
|
[".e"]="$HOME/.bin/.e"
|
2023-10-30 21:54:28 +00:00
|
|
|
[".t"]="$HOME/.bin/.t"
|
2024-01-04 01:47:23 +00:00
|
|
|
["alacritty"]="$HOME/.config/alacritty/alacritty.toml"
|
2024-05-13 11:55:14 +00:00
|
|
|
["autoinstall.conf"]="$HOME/.config/autoinstall.conf"
|
2024-10-04 22:42:21 +00:00
|
|
|
["autorestic"]="$HOME/.config/autorestic/.autorestic.yml"
|
2023-03-20 11:32:57 +00:00
|
|
|
["autostart.toml"]="$HOME/.config/autostart.toml"
|
2022-08-01 13:59:07 +00:00
|
|
|
["bash"]="$HOME/.bashrc"
|
|
|
|
["bspwm"]="$HOME/.config/bspwm/bspwmrc"
|
2023-10-30 21:50:18 +00:00
|
|
|
["completions"]="$HOME/.config/completionsrc"
|
2023-10-19 00:20:28 +00:00
|
|
|
["env"]="$HOME/.config/environment"
|
|
|
|
["env.d"]="$HOME/.config/env.d/"
|
2022-08-13 11:23:01 +00:00
|
|
|
["git"]="$HOME/.config/git/config"
|
2022-10-04 20:23:22 +00:00
|
|
|
["git-ignore"]="$HOME/.config/git/ignore"
|
2024-06-12 12:26:13 +00:00
|
|
|
["git-credentials"]="$HOME/.config/git/credentials"
|
2023-04-02 18:55:57 +00:00
|
|
|
["home-manager"]="$HOME/.config/home-manager/home.nix"
|
2024-06-12 12:26:13 +00:00
|
|
|
["host-mode"]="$HOME/.bin/host-mode"
|
2023-06-02 23:29:58 +00:00
|
|
|
["hyprland"]="$HOME/.config/hypr/hyprland.conf"
|
2024-02-28 23:42:00 +00:00
|
|
|
["nvim"]="$HOME/.config/astronvim/lua/user/"
|
2023-01-03 01:15:35 +00:00
|
|
|
["polybar"]="$HOME/.config/polybar"
|
2024-10-28 20:02:40 +00:00
|
|
|
["projectsrc"]="$HOME/.config/projectsrc"
|
2023-10-18 21:51:45 +00:00
|
|
|
["qutebrowser"]="$HOME/.config/qutebrowser/config.py"
|
|
|
|
["qutebrowser-kiosk"]="$HOME/.config/qutebrowser/config_kiosk.py"
|
2024-02-02 00:39:03 +00:00
|
|
|
["rclone"]="$HOME/.config/rclone/rclone.conf"
|
2024-02-15 18:27:18 +00:00
|
|
|
["ssh"]="$HOME/.ssh/config"
|
2022-08-13 11:23:01 +00:00
|
|
|
["starship"]="$HOME/.config/starship.toml"
|
2024-08-21 14:34:57 +00:00
|
|
|
["sway"]="$HOME/.config/sway/config"
|
|
|
|
["sway.d"]="$HOME/.config/sway/config.d"
|
2022-08-01 13:59:07 +00:00
|
|
|
["sxhkd"]="$HOME/.config/sxhkd/sxhkdrc"
|
|
|
|
["vim"]="$HOME/.config/vim/vimrc"
|
2024-12-09 20:06:07 +00:00
|
|
|
["wakatime"]="$HOME/.config/wakatime/.wakatime.cfg"
|
2024-12-12 14:15:24 +00:00
|
|
|
["wakatime-project"]="./.wakatime-project"
|
2023-07-01 11:05:41 +00:00
|
|
|
["waybar"]="$HOME/.config/waybar/"
|
2022-10-13 12:43:07 +00:00
|
|
|
["xprofile"]="$HOME/.xprofile"
|
2024-01-25 14:23:05 +00:00
|
|
|
["yadm"]="$HOME/.local/share/yadm/repo.git/config"
|
2023-10-18 23:12:01 +00:00
|
|
|
["yadm-encrypt"]="$HOME/.config/yadm/encrypt"
|
2024-06-24 13:25:15 +00:00
|
|
|
["zellij"]="$HOME/.config/zellij/"
|
2022-08-01 13:59:07 +00:00
|
|
|
["zsh"]="$HOME/.config/zsh/.zshrc"
|
|
|
|
)
|
|
|
|
|
2024-03-27 17:52:31 +00:00
|
|
|
declare -A directory=(
|
|
|
|
["bspwm"]="$HOME/.config/bspwm/"
|
|
|
|
["env.d"]="$HOME/.config/env.d/"
|
|
|
|
["home-manager"]="$HOME/.config/home-manager/"
|
|
|
|
["hyprland"]="$HOME/.config/hypr/"
|
|
|
|
["nvim"]="$HOME/.config/astronvim/lua/user/"
|
|
|
|
["polybar"]="$HOME/.config/polybar/"
|
|
|
|
["qutebrowser"]="$HOME/.config/qutebrowser/"
|
|
|
|
["waybar"]="$HOME/.config/waybar/"
|
|
|
|
["zsh"]="$HOME/.config/zsh/"
|
|
|
|
)
|
|
|
|
|
2024-01-25 14:23:05 +00:00
|
|
|
declare -A hooks=(
|
2024-10-28 20:02:40 +00:00
|
|
|
["projectsrc"]="projects-status"
|
2024-01-25 14:23:05 +00:00
|
|
|
["qutebrowser"]="qutebrowser :config-source"
|
|
|
|
["qutebrowser-kiosk"]="qutebrowser-kiosk :config-source" # broken due to qutebrowser-kiosk being an alias
|
2024-08-21 14:34:57 +00:00
|
|
|
["sway"]="sway reload"
|
|
|
|
["sway.d"]="sway reload"
|
2024-01-25 14:23:05 +00:00
|
|
|
["waybar"]="killall -SIGUSR2 waybar"
|
|
|
|
["yadm"]="yadm alt"
|
2024-10-04 14:04:46 +00:00
|
|
|
["yadm-encrypt"]="yadm alt"
|
2024-01-25 14:23:05 +00:00
|
|
|
)
|
|
|
|
|
2022-10-17 16:49:58 +00:00
|
|
|
if [ -z "$1" ]
|
2022-08-01 13:59:07 +00:00
|
|
|
then
|
|
|
|
echo "No argument given. Use --list (-l) to show all options."
|
2023-10-30 21:50:18 +00:00
|
|
|
exit 1
|
2022-08-01 13:59:07 +00:00
|
|
|
fi
|
2022-10-17 16:49:58 +00:00
|
|
|
if [ "$1" = "-l" ] || [ "$1" = "--list" ]
|
2022-08-01 13:59:07 +00:00
|
|
|
then
|
|
|
|
echo "${!mapper[@]}"
|
2023-10-30 21:50:18 +00:00
|
|
|
exit 0
|
2022-08-01 13:59:07 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
target="${mapper["$1"]}"
|
2023-10-30 21:50:18 +00:00
|
|
|
if [ -z "$target" ]
|
2022-08-01 13:59:07 +00:00
|
|
|
then
|
|
|
|
echo "Dotfile not found. Use --list (-l) to show all options."
|
2023-10-30 21:50:18 +00:00
|
|
|
exit 1
|
2022-08-01 13:59:07 +00:00
|
|
|
fi
|
2023-10-30 21:50:18 +00:00
|
|
|
|
2024-03-27 17:52:31 +00:00
|
|
|
working_dir="${directory["$1"]}"
|
|
|
|
if [ -n "$working_dir" ]
|
|
|
|
then
|
|
|
|
# shellcheck disable=SC2164
|
|
|
|
cd "$working_dir"
|
|
|
|
fi
|
|
|
|
|
2023-10-30 21:50:18 +00:00
|
|
|
$EDITOR "$target"
|
2024-01-25 14:23:05 +00:00
|
|
|
|
|
|
|
hook="${hooks["$1"]}"
|
|
|
|
if [ -n "$hook" ]
|
|
|
|
then
|
|
|
|
echo "Running hook: $hook"
|
|
|
|
eval "$hook"
|
|
|
|
fi
|