diff --git a/tmdev.sh b/tmdev.sh new file mode 100755 index 0000000..a602825 --- /dev/null +++ b/tmdev.sh @@ -0,0 +1,41 @@ +#!/bin/bash +###################################### +# tmux start script for dev projects # +# author eric at ewpt3ch dot com # +###################################### + +# usage: dev.sh session + +# check for a session +if [[ -z $1 ]]; then + echo -e "you need to name the session ie dev.sh \e[3msession" + exit +fi + +session=$1 + +# check if we're in a tmux session, prevent nesting +if [[ "$TMUX" != "" ]]; then + echo -e "Error: cannot nest sessions \e[3meventualy want to detach and start new" + exit +fi + +# check if session by session already exists +if (tmux has-session -t ${session} 2> /dev/null); then + echo -e "${session} already exists" + exit +fi + +# not in a session not session already name session +# so lets create it + +tmux new-session -d -s "${session}" -n "edit" +tmux split-window -v -p 20 -t "${session}" +tmux send-keys -t "${session}:1.1" "vim" C-m +tmux new-window -n "servers" -t "${session}" +tmux split-window -v -t "${session}:2" +tmux new-window -n "scratch" -t "${session}" +tmux send-keys -t "${session}:3.1" "git status" C-m + +# finally attach to the new session +tmux attach-session -t "${session}" diff --git a/tmsys.sh b/tmsys.sh new file mode 100755 index 0000000..4a9bde2 --- /dev/null +++ b/tmsys.sh @@ -0,0 +1,37 @@ +#!/bin/bash +################################## +# tmux start script for system # +# author eric at ewpt3ch dot com # +################################## + +# usage: system.sh + +# check if we're in a tmux session, prevent nesting +if [[ "$TMUX" != "" ]]; then + echo -e "Error: cannot nest sessions \e[3meventualy want to detach and start new" + exit +fi + +session="system" + +# check if system session already exists +if (tmux has-session -t ${session} 2> /dev/null); then + echo -e "${session} already exists" + exit +fi + +# not in a session not session already name session +# so lets create it + +cd "${HOME}" +tmux new-session -d -s "${session}" -n "htop" +tmux split-window -v -p 20 -t "${session}" +tmux send-keys -t "${session}:1.1" "htop" C-m +tmux send-keys -t "${session}:1.2" "pacupg" C-m +tmux new-window -n "journal" -t "${session}" +tmux split-window -v -p 30 -t "${session}:2" +tmux send-keys -t "${session}:2.1" "journalctl -f" C-m +tmux new-window -n "scratch" -t "${session}" + +# finally attach to the new session +tmux attach-session -t "${session}"