Show screen/tmux status at start
authorJoerg Jaspert <joerg@ganneff.de>
Tue, 2 Apr 2013 14:36:45 +0000 (16:36 +0200)
committerJoerg Jaspert <joerg@ganneff.de>
Tue, 2 Apr 2013 14:36:45 +0000 (16:36 +0200)
.zsh/92_Exec.zsh [moved from .zsh/99_Exec.zsh with 100% similarity]
.zsh/95_tmuxscreen.zsh [new file with mode: 0644]
.zsh/zshenv.local.sample

similarity index 100%
rename from .zsh/99_Exec.zsh
rename to .zsh/92_Exec.zsh
diff --git a/.zsh/95_tmuxscreen.zsh b/.zsh/95_tmuxscreen.zsh
new file mode 100644 (file)
index 0000000..b577998
--- /dev/null
@@ -0,0 +1,21 @@
+# -*- mode: sh;-*-
+
+if zstyle -T ':ganneff:config' termstatus; then
+    if is-callable tmux; then
+        foo=$(tmux list-sessions 2>/dev/null)
+        if (( ${#foo} )); then
+            preprint "tmux sessions" && echo
+            print $foo
+            preprint && echo
+        fi
+    fi
+
+    if is-callable screen; then
+        screen -q -ls
+        if [[ $? -ne 9 ]]; then
+            preprint "screen sessions" && echo
+            screen -ls
+            preprint && echo
+        fi
+    fi
+fi | sed 's/^/   /'
index 3bd945a..26d01f8 100644 (file)
@@ -142,6 +142,9 @@ zstyle ':ganneff:config' dirstackhandling dirpersist
 #     /local yellow   \
 #     /zsh   white
 
 #     /local yellow   \
 #     /zsh   white
 
+## Want to see status of screen/tmux? Will list their sessions, if
+## any (and if they are installed)
+# zstyle ':ganneff:config' termstatus true
 
 ########################################################################
 ### Prompt setup                                                     ###
 
 ########################################################################
 ### Prompt setup                                                     ###