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

Revisit the idea of rename tabs #2907

Open
2 tasks done
xiaket opened this issue Apr 23, 2018 · 21 comments
Open
2 tasks done

Revisit the idea of rename tabs #2907

xiaket opened this issue Apr 23, 2018 · 21 comments
Labels
🛠 Type: Feature Request Issue or PR is a feature request/proposal for Hyper

Comments

@xiaket
Copy link

xiaket commented Apr 23, 2018

  • I am on the latest Hyper.app version

  • I have searched the issues of this repo and believe that this is not a duplicate

  • OS version and name: OS X El Capitan 10.11.6

  • Hyper.app version: 2.0.0

Issue

I know this has been discussed before in #284, but as a SysAdm I frequently have to ssh to other machines and the current approach will fail, because you can no longer rename the tab through bash tricks.

I feel a better way could be the addition of another hyper command(rename-tab) in hyper-keymap and prompt the user in an os-level dialog and ask the new title.

@Stanzilla
Copy link
Collaborator

This works, you just have to have your shell do it, see #284 (comment)

@Stanzilla Stanzilla added the 👯‍♀️ Is Duplicate Issue is a duplicate of another issue label Apr 23, 2018
@xiaket
Copy link
Author

xiaket commented Apr 23, 2018

Hi, @Stanzilla . Sorry to bother you but this is definitely not working in the case where you connect to a remote machine. The title command will be sent to the remote machine and it won't pass back to your local box.

@Stanzilla
Copy link
Collaborator

Hey there, to verify if this is indeed a Hyper issue or upstream at https://github.com/xtermjs/xterm.js/ could you please test if another xterm.js powered terminal shows the same problem you are experiencing? I suggest using https://github.com/Microsoft/vscode for testing. Thanks!

@xiaket
Copy link
Author

xiaket commented Apr 23, 2018

Hi, @Stanzilla, I have verified that this is indeed a missing feature in Hyper. I don't believe this is an issue with xterm.js because tab management is part of Hyper, and xterm.js does not have a concept of tabs.

Can you please verify this yourself on your end?

Steps:

  1. defined the title function as per Ability to change the tab name #284
  2. in your bash session, type title test1
  3. It is expected that the title will be changed to test1
  4. ssh to a remote machine
  5. type title test2 and observe

If you do not have access to a remote machine, can you leave the issue open and let other maintainers have a try? Thanks!

@Stanzilla
Copy link
Collaborator

Stanzilla commented Apr 23, 2018

So the issue is that you want Hyper to use your own ~/.bashrc even though you are connected to a remote IP?

I will reopen but I really don't know if this should work. I just tried with Windows Bash and it does not work there either.

@Stanzilla Stanzilla reopened this Apr 23, 2018
@Tyriar
Copy link
Contributor

Tyriar commented Apr 23, 2018

See https://github.com/xtermjs/xterm.js/blob/716a8d592676ada264d9b9b7ebec2f1f3277a4c6/src/Terminal.ts#L2134, you want to handle the title event on Terminal:

term.on('title', (title) => console.log('the program set the title to ' + title));

@Stanzilla Stanzilla added 🛠 Type: Feature Request Issue or PR is a feature request/proposal for Hyper and removed 👯‍♀️ Is Duplicate Issue is a duplicate of another issue labels Apr 23, 2018
@El-Dringo-Brannde
Copy link
Contributor

El-Dringo-Brannde commented Apr 29, 2018

@Stanzilla Can I create a fork/PR for this and make it load the current folder by default for the title?

@Stanzilla
Copy link
Collaborator

@El-Dringo-Brannde sure, no promises on it being accepted though :)

@El-Dringo-Brannde
Copy link
Contributor

El-Dringo-Brannde commented Apr 29, 2018

@Stanzilla This is my first OSS contribution (Which I'm doing for a school project). Anything I can do to increase the likelihood of it being accepted?

Also, is there any formalities to adding the in progress tags or help wanted to the issue?

@Stanzilla
Copy link
Collaborator

@El-Dringo-Brannde Follow https://github.com/zeit/hyper#contribute as best as possible and just mention the current state of the PR and if you need help with anything! 👍

@fangqiao
Copy link

fangqiao commented May 6, 2018

@xiaket Same here.

Running a small linux server group of 6. Need to ssh all of them sometimes and to rename tab title conveniently is show-stopper for picking terminal simulator.

With terminator I can click title then edit it directly. Hope hyer can do that as well.

El-Dringo-Brannde added a commit to El-Dringo-Brannde/hyper that referenced this issue May 14, 2018
@xiaket
Copy link
Author

xiaket commented May 17, 2018

Sorry to be the one to say this @El-Dringo-Brannde , but your PR #3015 will not fix this issue. Thanks for your contribution though.

@matthoffman
Copy link

I'm with @xiaket here. The idea of using bash functions to set your title works in some cases, but I don't think it's a good solution, for a few reasons:
First, it's coupling your terminal program to your .bashrc, which isn't great; what if you use more than one terminal and they use different escape code? And more generally, why use a shell function to do something that affects Hyper itself? Nothing else in Hyper works this way.
Second, as xiaket pointed out, it's completely broken when you SSH into another machine. I now have multiple tabs called "user@host: ~" but in fact none of those titles are accurate; I'm ssh'd into different machines in each. But there's no way to update the titles to reflect which machine I'm logged into, which is frustrating.
@xiaket 's idea of adding a native hyper command (rename-tab) in hyper-keymap sounds like a better approach.

@mhrisse
Copy link

mhrisse commented Feb 18, 2019

Hi! I have used the bash function from the other issue, but in practice the titles switch back if I have multiple windows (split in various ways) in one tab and the CLI commands running in there do somehow revert this back to "Shell". I believe this is a fairly typical setup. Whatever the solution, from a ergonomics perspective one should be able to rename via CLI and by clicking (somehow) the tab, from my experience how people expect tabs to work.

@ppot
Copy link
Contributor

ppot commented Feb 20, 2019

@mhrisse Can you make a GIF of this. Since I'm to busy to test behaviours?

@rjurney
Copy link

rjurney commented Apr 17, 2019

I need to be able to rename tabs. Please help.

@aedm
Copy link

aedm commented May 15, 2019

Running commands override the title directive.

I'm running several different programs using npm and want to check logs. Hyper's approach isn't very user-friendly in this case:
image

@ankur2002
Copy link

This stopped working for me when I upgraded to Version 3. I am using this on Mac Mojave 10.14.5.

@ivanwonder
Copy link
Contributor

Running commands override the title directive.

I'm running several different programs using npm and want to check logs. Hyper's approach isn't very user-friendly in this case:
image

@aedm try this https://www.npmjs.com/package/hyper-prefix-of-tab plugin. It just adds a prefix to the shown title to identify different tab.

@jsejcksn
Copy link

Here is how Apple does it with Terminal and zsh:

from /etc/zshrc:

# Useful support for interacting with Terminal.app or other terminal programs
[ -r "/etc/zshrc_$TERM_PROGRAM" ] && . "/etc/zshrc_$TERM_PROGRAM"

which sources /etc/zshrc_Apple_Terminal:

# zsh support for Terminal.


# Working Directory
#
# Tell the terminal about the current working directory at each prompt.

if [ -z "$INSIDE_EMACS" ]; then

    update_terminal_cwd() {
	# Identify the directory using a "file:" scheme URL, including
	# the host name to disambiguate local vs. remote paths.

	# Percent-encode the pathname.
	local url_path=''
	{
	    # Use LC_CTYPE=C to process text byte-by-byte. Ensure that
	    # LC_ALL isn't set, so it doesn't interfere.
	    local i ch hexch LC_CTYPE=C LC_ALL=
	    for ((i = 1; i <= ${#PWD}; ++i)); do
		ch="$PWD[i]"
		if [[ "$ch" =~ [/._~A-Za-z0-9-] ]]; then
		    url_path+="$ch"
		else
		    printf -v hexch "%02X" "'$ch"
		    url_path+="%$hexch"
		fi
	    done
	}

	printf '\e]7;%s\a' "file://$HOST$url_path"
    }

    # Register the function so it is called at each prompt.
    autoload add-zsh-hook
    add-zsh-hook precmd update_terminal_cwd
fi

@robhicks
Copy link

I love Hyper so don't take what I say the wrong way.
Having to use a script to change the tab name is silly.
Since tabs are created by Hyper, they should have the functionality you would expect from tabs. They should support drag and drop and they should be renameable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🛠 Type: Feature Request Issue or PR is a feature request/proposal for Hyper
Projects
None yet
Development

Successfully merging a pull request may close this issue.