#!/bin/tcsh -f
#
# put this file (./week6.csh) in the weenix directory (same directory as Configlmk)
# chmod 755 ./week6.csh
# if your login shell is tcsh, do:
#     alias killtmux 'tmux kill-session -t `tmux list-sessions | cut -d":" -f1`'
# if your login shell is bash, do:
#     alias killtmux='tmux kill-session -t `tmux list-sessions | cut -d":" -f1`'
# ./week6.csh

set session_name="week6"
set running=`tmux list-sessions | grep "${session_name}:"`

if ("x$running" != "x") then
    # it's running
    echo "Session '${session_name}' already exists"
else
    # create 3 vertical panes
    tmux new-session -d -s ${session_name} 'vi kernel/fs/vfs.c'
    tmux split-window -v -p 5
    tmux split-window -h -t top -p 50 'vi kernel/fs/namev.c'
    # split each vertical pane horizontally
    # tmux split-window -h -t 0 -p 50 'vi kernel/proc/faber_test.c'
    # tmux split-window -h -t 2 -p 50 'vi kernel/proc/faber_test.c'
    tmux attach-session -d -t ${session_name}
endif

