Browse Source

fix tmux window name and pane title settings

undefined
10sr 11 years ago
parent
commit
275f70eecc
3 changed files with 22 additions and 9 deletions
  1. +4
    -4
      emacs.el
  2. +11
    -4
      shrc
  3. +7
    -1
      tmux.conf

+ 4
- 4
emacs.el View File

@@ -304,10 +304,10 @@ found, otherwise returns nil."
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; title and mode-line ;; 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-dos "\\r\\n")
(setq eol-mnemonic-mac "\\r") (setq eol-mnemonic-mac "\\r")


+ 11
- 4
shrc View File

@@ -1242,7 +1242,8 @@ __my_set_header_line(){
printf "\033[u" printf "\033[u"
} }


__my_set_screen_title(){
__my_set_screen_name(){
# set window name
if test -n "$TMUX" && test -z "$INSIDE_EMACS" if test -n "$TMUX" && test -z "$INSIDE_EMACS"
then then
echo -ne "\033k$1\033\\" echo -ne "\033k$1\033\\"
@@ -1259,14 +1260,20 @@ __my_set_title(){
;; ;;
esac 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 if $inzsh
then then
precmd(){ precmd(){
laststatus=$? laststatus=$?
eval __my_set_title ${__terminal_title}
} }
else else
PROMPT_COMMAND="laststatus=\$?;$PROMPT_COMMAND"
PROMPT_COMMAND="laststatus=\$?;__my_set_title \"${__terminal_title}\";$PROMPT_COMMAND"
fi fi
laststatus=0 laststatus=0

+ 7
- 1
tmux.conf View File

@@ -17,8 +17,14 @@ setw -g mode-mouse off
#set -g default-command /bin/bash #set -g default-command /bin/bash


#set -g default-path "$HOME" #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 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 # disable updating status-left and status-right
set status-interval 0 set status-interval 0


Loading…
Cancel
Save