hyper icon indicating copy to clipboard operation
hyper copied to clipboard

Ability to change the tab name

Open lardissone opened this issue 10 years ago • 24 comments

It's not high priority but it's something useful.

In some cases you have several commands running in multiple tabs that looks the same but in different projects (example: frontend node dev command and API node dev command).

It would be nice to be able to manually change the name, like Terminal.app on OSX:

inspector 2016-07-19 09-47-05

lardissone avatar Jul 19 '16 14:07 lardissone

You may want to check my hyperterm-title plugin. It sets the title of tabs in the same way that iTerm does

parro-it avatar Jul 19 '16 18:07 parro-it

@parro-it it's great, but it's not exactly what Terminal.app does. You can't manually change the title in this case.

lardissone avatar Jul 19 '16 19:07 lardissone

Perhaps this is better as a plugin?

timothyis avatar Jul 26 '16 21:07 timothyis

Perhaps this is better as a plugin?

Yes, I agree. it would be great to have a context menu in the tab to add a 'Chnage tab name' item. It would also be great to write a change tab color plugin, I use this feature very often in iterm...

parro-it avatar Jul 27 '16 07:07 parro-it

The plugin works great for me. In bash I have a function to set the title. Besides one tweak, this has been working for me for all other terminal programs as well:

function title() { echo -e "\033]0;${1:?please specify a title}\007" ; }

kbrock avatar Sep 16 '16 18:09 kbrock

@kbrock 👍 I put this in .bash_profile and with the hyperterm-title plugin I can set the title as easy as title "hello hyper".

jadaradix avatar Oct 23 '16 19:10 jadaradix

@jadaradix @lardissone I added the sample function over in parro-it/hyperterm-title#3 Hopefully it will be more friendly to others who have this need

kbrock avatar Oct 24 '16 12:10 kbrock

IMO this functionality is much nearer 'core' than "install this third-party plugin, add this to your shell config, and then run this command".

OJFord avatar Oct 30 '16 17:10 OJFord

@OJFord Think this functionality is already in master and will come out in the next release without the title ==> https://github.com/zeit/hyper/pull/892

kbrock avatar Oct 30 '16 22:10 kbrock

~~@kbrock does that PR resolve this issue? It looks like a coding update, not a way for users to set tab titles.~~ As per https://github.com/parro-it/hyperterm-title, this is in fact in core, and the issue should probably be resolved.

image

JoshuaKGoldberg avatar Apr 03 '17 16:04 JoshuaKGoldberg

Agreed. Thanks!

chabou avatar Apr 13 '17 23:04 chabou

Is this functionality available in version 2.0.0? I'm on mac and don't see this option anywhere. Thanks

urikphytech avatar Apr 23 '18 07:04 urikphytech

It's not an option, you have to set it via shell commands. You can see above how...

parro-it avatar Apr 23 '18 07:04 parro-it

TL;DR

  1. Add this line to your .bash_profile file: function title() { echo -e "\033]0;${1:?please specify a title}\007" ; }
  2. reload terminal, or type command: source ~/.bash_profile
  3. type title NEW_TITLE to change tab title

urikphytech avatar Apr 23 '18 07:04 urikphytech

Can someone explain how to get this working on a Windows 10 + Git Bash environment?

terrancecorley avatar Apr 30 '18 06:04 terrancecorley

@terrancecorley

add your title text to your local bash profile.

https://stackoverflow.com/questions/46458832/how-to-change-title-of-git-terminal-in-windows

vallamost avatar May 02 '18 00:05 vallamost

For reference, people looking to do this when using PowerShell, you can use this function to achieve the same (and not having it display Shell because that's silly)

function Set-ConsoleTitle {
    param(
        [string]
        $title
    )
    $escapeChar = [char]27
    return "$escapeChar]2;$title`a"
}

Set-ConsoleTitle PowerShell

JanDeDobbeleer avatar Aug 04 '18 18:08 JanDeDobbeleer

  1. Add this line to your .bash_profile file: function title() { echo -e "\033]0;${1:?please specify a title}\007" ; }
  2. reload terminal, or type command: source ~/.bash_profile
  3. type title NEW_TITLE to change tab title

hi, I use WSL and this simply doesn't work :

function title ()
{
        echo -e "\033]0;${1:?please specify a title}\007"
}

in ~/.bash_aliases

after being sourced it just returns an empty line in the console, no change in the tab name :

kro@minipoutre ~  title
-bash: 1: please specify a title
kro@minipoutre ~  title 'test'

kro@minipoutre ~

I use hyper 2.1.2 and I'm brand new to it. Has anything changed lately ?

krodelabestiole avatar Apr 04 '19 16:04 krodelabestiole

  1. Add this line to your .bash_profile file: function title() { echo -e "\033]0;${1:?please specify a title}\007" ; }
  2. reload terminal, or type command: source ~/.bash_profile
  3. type title NEW_TITLE to change tab title

hi, I use WSL and this simply doesn't work :

function title ()
{
        echo -e "\033]0;${1:?please specify a title}\007"
}

in ~/.bash_aliases

after being sourced it just returns an empty line in the console, no change in the tab name :

kro@minipoutre ~  title
-bash: 1: please specify a title
kro@minipoutre ~  title 'test'

kro@minipoutre ~

I use hyper 2.1.2 and I'm brand new to it. Has anything changed lately ?

  1. Add this line to your .bash_profile file: function title() { echo -e "\033]0;${1:?please specify a title}\007" ; }
  2. reload terminal, or type command: source ~/.bash_profile
  3. type title NEW_TITLE to change tab title

hi, I use WSL and this simply doesn't work :

function title ()
{
        echo -e "\033]0;${1:?please specify a title}\007"
}

in ~/.bash_aliases

after being sourced it just returns an empty line in the console, no change in the tab name :

kro@minipoutre ~  title
-bash: 1: please specify a title
kro@minipoutre ~  title 'test'

kro@minipoutre ~

I use hyper 2.1.2 and I'm brand new to it. Has anything changed lately ?

I'm running into same problem in ubuntu 18.04, looking for help

sjtuzbx avatar May 30 '19 04:05 sjtuzbx

This works for me in Ubuntu 18.04

function title(){
  if [[ -z "$ORIG" ]]; then
    ORIG="$PS1"
  fi
  TITLE="\[\e]2;$*\a\]"
  PS1="${ORIG}${TITLE}"
}

pelayomendez avatar Jul 04 '19 11:07 pelayomendez