aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsys/code/sys/tmx45
-rw-r--r--tmux/.tmux.conf15
2 files changed, 54 insertions, 6 deletions
diff --git a/sys/code/sys/tmx b/sys/code/sys/tmx
new file mode 100755
index 0000000..c912561
--- /dev/null
+++ b/sys/code/sys/tmx
@@ -0,0 +1,45 @@
+#
+# Modified TMUX start script from:
+# http://forums.gentoo.org/viewtopic-t-836006-start-0.html
+#
+# Store it to `~/bin/tmx` and issue `chmod +x`.
+#
+
+# Works because bash automatically trims by assigning to variables and by
+# passing arguments
+trim() { echo $1; }
+
+if [[ -z "$1" ]]; then
+ echo "Specify session name as the first argument"
+ exit
+fi
+
+# Only because I often issue `ls` to this script by accident
+if [[ "$1" == "ls" ]]; then
+ tmux ls
+ exit
+fi
+
+base_session="$1"
+# This actually works without the trim() on all systems except OSX
+tmux_nb=$(trim `tmux ls | grep "^$base_session" | wc -l`)
+if [[ "$tmux_nb" == "0" ]]; then
+ echo "Launching tmux base session $base_session ..."
+ tmux new-session -s $base_session
+else
+ # Make sure we are not already in a tmux session
+ if [[ -z "$TMUX" ]]; then
+ echo "Launching copy of base session $base_session ..."
+ # Session is is date and time to prevent conflict
+ session_id=`date +%Y%m%d%H%M%S`
+ # Create a new session (without attaching it) and link to base session
+ # to share windows
+ tmux new-session -d -t $base_session -s $session_id
+ if [[ "$2" == "1" ]]; then
+ # Create a new window in that session
+ tmux new-window
+ fi
+ # Attach to the new session & kill it once orphaned
+ tmux attach-session -t $session_id \; set-option destroy-unattached
+ fi
+fi
diff --git a/tmux/.tmux.conf b/tmux/.tmux.conf
index d853e98..708e23f 100644
--- a/tmux/.tmux.conf
+++ b/tmux/.tmux.conf
@@ -69,8 +69,8 @@ bind : command-prompt
# panes
set -g mouse-select-pane on
-set -g pane-border-fg black
-set -g pane-active-border-fg brightred
+set -g pane-border-fg blue
+set -g pane-active-border-fg brightblue
#set -g pane-active-border-attr blink
# resize panes with mouse (drag borders)
set -g mouse-select-pane on
@@ -80,18 +80,21 @@ set -g mouse-resize-pane on
set -g status-utf8 on
set -g status-justify left
set -g status-bg default
-set -g status-fg colour12
+set -g status-fg blue
set -g status-interval 2
# messaging
set -g message-fg black
-set -g message-bg yellow
+set -g message-bg blue
set -g message-command-fg blue
set -g message-command-bg black
#window mode
-setw -g mode-bg colour6
-setw -g mode-fg colour0
+setw -g mode-bg blue
+setw -g mode-fg black
+
+#resizing
+setw -g aggressive-resize on
# window status
#setw -g window-status-format " #F#I:#W#F "