From 10d975c80ae9e6541287debfbd1c92f149eca386 Mon Sep 17 00:00:00 2001 From: Eric Phillips Date: Wed, 17 Jun 2015 21:00:16 -0600 Subject: [PATCH] added cmus session --- tmcmus.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 tmcmus.sh diff --git a/tmcmus.sh b/tmcmus.sh new file mode 100755 index 0000000..6f8df0d --- /dev/null +++ b/tmcmus.sh @@ -0,0 +1,28 @@ +#!/bin/bash +################################## +# tmux start script for cmus # +# author eric at ewpt3ch dot com # +################################## + +# usage: tmcmus.sh + +session="cmus" + +# 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 already named cmus +# so lets create it and not attach, let it be in the backgound + +tmux new-session -d -s "${session}" -n "cmus" +tmux split-window -v -p 20 -t "${session}" +tmux send-keys -t "${session}:1.1" "cmus" C-m