Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include cwd in terminal title #29816

Closed
imlgm opened this issue Jun 29, 2017 · 24 comments · Fixed by #132691
Closed

Include cwd in terminal title #29816

imlgm opened this issue Jun 29, 2017 · 24 comments · Fixed by #132691
Assignees
Labels
feature-request Request for new features or functionality on-release-notes Issue/pull request mentioned in release notes terminal Integrated terminal issues verification-needed Verification of issue is requested verified Verification succeeded

Comments

@imlgm
Copy link

imlgm commented Jun 29, 2017

image

currently, vscode name the terminal with like 1: bash, 2:bash, after a while it's hard for to remember which one opening which directory. how about naming them by the opened folder or pah of the opened folder.

I also want there could be a simple way to switch focus between the terminal and workspace. currently, I have to use Command+J to hide the terminal or mouse clicking.

@vscodebot vscodebot bot added the terminal Integrated terminal issues label Jun 29, 2017
@Tyriar
Copy link
Member

Tyriar commented Jun 29, 2017

@imlgm this custom keybinding makes it easier to switch between editor and terminal:

{ "key": "ctrl+`",          "command": "workbench.action.terminal.focus", "when": "!terminalFocus" },

@Tyriar Tyriar added the feature-request Request for new features or functionality label Jun 29, 2017
@Tyriar Tyriar added this to the Backlog milestone Jun 29, 2017
@imlgm
Copy link
Author

imlgm commented Jul 4, 2017

@Tyriar
sorry for responsing so late, so many works image

I tried the custom keybinding, it did help a lot, thanks

@Tyriar Tyriar changed the title Use folder name or dir path as the name of the opened terminal && add shortcut for switch focus between workspace and terminal Include cwd in terminal selector dropdown Jul 5, 2017
@Tyriar
Copy link
Member

Tyriar commented Jul 5, 2017

Related: #20676 (comment)

@caub
Copy link

caub commented Jun 25, 2018

@Tyriar

{"key": "ctrl+`", "command": "workbench.action.terminal.focus", "when": "!terminalFocus"}

is interesting (by default that shortcut just toggles terminals visibility, so that's fine using that shortcut)

What I'd terribly like is that it not only focus the terminal, but focus the 'right' terminal, or opens one for that project (in the context of a multi-projects workspace)

I guess you'll answer that this is the job for an extension, so I'll try to make one, because it'd be so practical for me

What I'm after is a mix of openInTerminal and workbench.action.terminal.focus, reusing the ones opened previously. I already discussed it, and the conclusion was to make an extension

I still think it's not a big feature, and would be worth adding in core

@ibufu
Copy link

ibufu commented Sep 14, 2018

  • 1

@dee-kryvenko
Copy link

Why is it not respecting the bash title by default? I'd expect it to have similar behaviour to iterm or iterm2, so I can put something like '\[\e]0;\W\a\]' to my PS1 and vscode terminal will pick it up.

@Tyriar
Copy link
Member

Tyriar commented Aug 19, 2019

@llibicpep tracked in #22325

@Tyriar
Copy link
Member

Tyriar commented Aug 20, 2019

@llibicpep I just added a terminal.integrated.experimentalUseTitleEvent setting which when true will use the title from the sequence. Try it out in tomorrow's insides and leave feedback in #22325

@ToniCipriani
Copy link

Enabled this and my pulldown is just /bin/bash instead of bash:
image

@Tyriar
Copy link
Member

Tyriar commented May 26, 2020

@ToniCipriani that's expected, it's whatever the shell sends to the terminal as the title. #22325 isn't meant to fix this issue generally.

@DesignByOnyx
Copy link

I just wanted to report that I enabled the terminal.integrated.experimentalUseTitleEvent feature. I then prepended my PS1 with \[\e]0;\W\a\]. If you're unsure how to do this you can search around or you can basically add the following to the bottom of your terminal config (eg: .bashrc):

PS1="\[\e]0;\W\a\]$PS1"

This will not affect your terminal formatting, and it will use the current directory name as the Terminal title. Once you have saved the file, open a new terminal in VSCode to verify.

@Tyriar
Copy link
Member

Tyriar commented May 21, 2021

@DesignByOnyx FYI that will change in the next version: "terminal.integrated.titleMode": "sequence"

@xianghongai
Copy link

xianghongai commented Jun 2, 2021

I am looking forward to the automatic naming function of Terminal.
@Tyriar
VSCode-Terminal-AutoReName

@Tyriar Tyriar changed the title Include cwd in terminal selector dropdown Include cwd in terminal title Jun 2, 2021
@Tyriar
Copy link
Member

Tyriar commented Jun 2, 2021

We may want to do something like window.title for this, for example:

"terminal.integrated.title": "${processTitle}${sequenceTitle}${cwd}"

One complication is that cwd would only work for mac and linux though.

@Tyriar Tyriar modified the milestones: Backlog, On Deck Jun 2, 2021
@DesignByOnyx
Copy link

I still prefer the integrated terminal inherit the title from my system terminal. I kept the PS1 changes from my comment above, but then had to update the new "Title Mode" setting to "sequence":

"terminal.integrated.titleMode": "sequence"

image

@Pyrolistical
Copy link

Pyrolistical commented Jul 27, 2021

thanks for adding the sequence title mode, but would like an option to just have the title be the current directory. I bet this is the desired default for the vast majority of users

@kusyka911
Copy link

We may want to do something like window.title for this, for example:

"terminal.integrated.title": "${processTitle}${sequenceTitle}${cwd}"

One complication is that cwd would only work for mac and linux though.

I think this would be a nice solution.

@ivandov
Copy link

ivandov commented Aug 20, 2021

So, the above solution setting on terminal.integrated.title isn't a currently available option, right? I don't see it in the defaultSettings.json. I only have terminal.integrated.titleMode, which sounds like I can potentially use the sequence value, as long as I change the way I'm setting my PS1 value?

@Tyriar
Copy link
Member

Tyriar commented Aug 27, 2021

We'll want to look at reverting the change for #78438 which breaks the macOS cwd detection as our official product builds have the electron fix, just not oss as it's waiting on libuv/libuv#3257.

meganrogge added a commit that referenced this issue Sep 7, 2021
@meganrogge
Copy link
Contributor

Here's what we're currently thinking. Let us know if you have feedback.
description
title

@ivandov
Copy link

ivandov commented Sep 9, 2021

Is the terminal title also able to use the variables that are referenced in the description examples given?

It's less important to me that I'm running bash or pwsh than it is for me to know the terminal was launched for a specific project or directory.

@meganrogge
Copy link
Contributor

yep @ivandov title and description can have any of these properties now

  • cwd
  • cwdFolder
  • local
  • process
  • separator
  • sequence
  • task

@Tyriar
Copy link
Member

Tyriar commented Sep 9, 2021

Let's keep open until #132775 and #132774 are done (and any other follow ups).

@Tyriar Tyriar reopened this Sep 9, 2021
@Tyriar
Copy link
Member

Tyriar commented Sep 13, 2021

Closing as the big follow ups are done.

@Tyriar Tyriar closed this as completed Sep 13, 2021
@rzhao271 rzhao271 added the verification-needed Verification of issue is requested label Sep 29, 2021
@DonJayamanne DonJayamanne added the verified Verification succeeded label Sep 29, 2021
@meganrogge meganrogge added the on-release-notes Issue/pull request mentioned in release notes label Oct 1, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Oct 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality on-release-notes Issue/pull request mentioned in release notes terminal Integrated terminal issues verification-needed Verification of issue is requested verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

15 participants