Skip to content
This repository has been archived by the owner on May 8, 2021. It is now read-only.

[Feature request] Working dir in title #1

Closed
LemonBoy opened this issue May 28, 2012 · 4 comments
Closed

[Feature request] Working dir in title #1

LemonBoy opened this issue May 28, 2012 · 4 comments

Comments

@LemonBoy
Copy link
Contributor

Im currently using a minimalist PS1 and have no way to quickly know the current working dir, having it in the window title would help making less mistakes on my end :)
I'd roll a patch by myself but don't have time atm :(

@thestinger
Copy link
Owner

You can set a title with the escape code used by xterm/rxvt. There are some examples here.

I use this with zsh and it works with termite:

case "$TERM" in
    vte*|xterm*|rxvt*)
        precmd() { print -Pn '\e];%n (%~) - Terminal\a' } ;;
esac

@thestinger
Copy link
Owner

I'm opening a separate bug for the upstream issue with weechat/vim mouse/title behaviour. Just so I don't forget about it :)

@alecmev
Copy link

alecmev commented May 1, 2018

A relevant section in Arch wiki, for future lurkers: https://wiki.archlinux.org/index.php/Zsh#xterm_title

@mb720
Copy link

mb720 commented Jan 4, 2019

I have this in my .bashrc to set the window title (tested with i3 and Sway):

# After each command finishes, we set the terminal window title to the
# current working directory. If, for example, Vim sets the window title
# to the file's name and we exit Vim, the window title becomes the
# current directory again.
# There has to be a space between $(pwd) and \007 so the sequence is ended properly,
# otherwise the window title would only be changed sometimes.
# These escape sequences are documented in man 4 console_codes.
# \033 is octal for ESC in ASCII, \007 is BEL
PROMPT_COMMAND="$PROMPT_COMMAND;echo -ne \"\033]0;\$(pwd) \007\""

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants