diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..9dbeba3 --- /dev/null +++ b/install.sh @@ -0,0 +1,40 @@ +#!/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 diff --git a/tasks.yaml b/tasks.yaml deleted file mode 100644 index 56c3afa..0000000 --- a/tasks.yaml +++ /dev/null @@ -1,25 +0,0 @@ ---- -- name: tmux create layouts directory - file: - state: directory - dest: ~/.local/share/tmux/layouts - -- name: tmux create config symbolic link - file: - state: link - src: ~/.config/tmux/tmux.conf - dest: ~/.tmux.conf - -- name: tmux create layout symbolic links - file: - state: link - src: '~/.config/tmux/layouts/{{item}}' - dest: '~/.local/share/tmux/layouts/{{item}}' - with_items: - - session-local - - session-main - - session-visor - - window-auto - - window-tall - - window-wide-left - - window-wide-right