tmux/install.sh
Kenneth Benzie (Benie) 7fd94d4f10 Enable standalone install with install.sh
Move away from being dependant on Ansible task.yaml config setup and
move all login into install.sh to support installing tmux config just by
cloning and running the script.
2024-04-13 16:28:55 +01:00

41 lines
882 B
Bash
Executable File

#!/usr/bin/env bash
if [ ! -d ~/.local/share/tmux/layouts ]; then
mkdir -p ~/.local/share/tmux/layouts
echo changed created layouts directory
fi
declare -A symlinks=(
[~/.config/tmux/tmux.conf]=~/.tmux.conf
)
layouts=(
session-local
session-main
session-visor
window-auto
window-tall
window-wide-left
window-wide-right
)
for layout in ${layouts[@]}; do
symlinks[~/.config/tmux/layouts/$layout]=~/.local/share/tmux/layouts/$layout
done
for source in ${!symlinks[@]}; do
dest=${symlinks[${source}]}
if [ -L $dest ]; then
target=`readlink $dest`
if [ "$target" != "$source" ]; then
rm $dest
ln -s $source $dest
echo changed replace incorrect symlink $dest
fi
elif [ -f $dest ]; then
error symlink failed $dest exists but is a regular file
else
ln -s $source $dest
echo changed created symlink $dest
fi
done