From 275f70eeccb41fbc9f6339d0a6a22b6879a8b8c4 Mon Sep 17 00:00:00 2001 From: 10sr <8slashes+git@gmail.com> Date: Fri, 6 Dec 2013 12:21:05 +0900 Subject: [PATCH] fix tmux window name and pane title settings --- emacs.el | 8 ++++---- shrc | 15 +++++++++++---- tmux.conf | 8 +++++++- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/emacs.el b/emacs.el index f3d6141..b807a3a 100644 --- a/emacs.el +++ b/emacs.el @@ -304,10 +304,10 @@ found, otherwise returns nil." ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; title and mode-line -(when (fetch-library - "https://raw.github.com/10sr/emacs-lisp/master/terminal-title.el" - t) - (require 'terminal-title nil t)) +;; (when (fetch-library +;; "https://raw.github.com/10sr/emacs-lisp/master/terminal-title.el" +;; t) +;; (require 'terminal-title nil t)) (setq eol-mnemonic-dos "\\r\\n") (setq eol-mnemonic-mac "\\r") diff --git a/shrc b/shrc index 30e426b..5ea9173 100755 --- a/shrc +++ b/shrc @@ -1242,7 +1242,8 @@ __my_set_header_line(){ printf "\033[u" } -__my_set_screen_title(){ +__my_set_screen_name(){ + # set window name if test -n "$TMUX" && test -z "$INSIDE_EMACS" then echo -ne "\033k$1\033\\" @@ -1259,14 +1260,20 @@ __my_set_title(){ ;; esac } -PROMPT_COMMAND="__my_set_title \${USER}@\${HOSTNAME}\:\${PWD}; -__my_set_screen_title \$(basename \"\$PWD\")/" + +if test -n "$TMUX" +then + __terminal_title="\$(basename \${PWD})" +else + __terminal_title"\${USER}@\${HOSTNAME}\:\${PWD}" +fi if $inzsh then precmd(){ laststatus=$? + eval __my_set_title ${__terminal_title} } else - PROMPT_COMMAND="laststatus=\$?;$PROMPT_COMMAND" + PROMPT_COMMAND="laststatus=\$?;__my_set_title \"${__terminal_title}\";$PROMPT_COMMAND" fi laststatus=0 diff --git a/tmux.conf b/tmux.conf index 33e817d..dc84af0 100644 --- a/tmux.conf +++ b/tmux.conf @@ -17,8 +17,14 @@ setw -g mode-mouse off #set -g default-command /bin/bash #set -g default-path "$HOME" -set -g set-titles on + +# try to set title of terminal tmux is running on +# set -g set-titles off set -g display-panes-time 5000 +set -g window-status-current-format "#I|#W:#T#F" +set -g window-status-format "#I|#W:#T#F" +# set window name automatically from command currently running +set -g automatic-rename on # disable updating status-left and status-right set status-interval 0