How do I give each tab opened by a {Task} a custom name?

35

11

I have a ConEmu {Task} that opens several tabs, each to a different directory. The trouble is, these tabs all have the same name and are hard to tell apart. I know I can rename each tab by right-clicking it and selecting rename*, but is there a way of renaming each one automatically via the task configuration?

It would be super-handy being able to:

a) specify a custom title;
b) specify a variable title using the current directory.

(*what is the Apps+R shortcut, btw? I've never come across the Apps key before.)

Charles Roper

Posted 2012-08-08T16:19:29.223

Reputation: 9 646

1WinUser.h -> #define VK_APPS 0x5D. May be you come across this as Menu? :-P – Maximus – 2012-08-08T17:15:36.543

Provide a contents of your {Task} – Maximus – 2012-08-08T17:17:28.770

Here's is the task config: http://i.imgur.com/dNr2M.png and here is what it looks like when I launch it from the ConEmu menu: http://i.imgur.com/RjIp3.png

– Charles Roper – 2012-08-08T17:58:40.853

Re. Menu I don't have one of those either. I've just got a standard UK keyboard (from Dell). EDIT: yes I do! It's the key next to the right Ctrl. – Charles Roper – 2012-08-08T18:00:27.363

So, Apps is found? And how it is named? ;) – Maximus – 2012-08-08T18:06:31.277

b) did you mean synchronous changing of tab title with cd in tcc? – Maximus – 2012-08-08T18:10:33.273

3

The Apps key has a menu symbol on it. Take a look: http://www.buypcsupplies.com/images/cat/38550_xlargenss_ndo4190.jpg

– Charles Roper – 2012-08-08T18:16:03.050

b) yes, so that it can show the current directory. Like prompt $p but truncating from the left if the path gets too long to fit in the tab. – Charles Roper – 2012-08-08T18:18:59.247

Answers

47

1) Modify contents of your task. Example:

>cmd /c RenameTab "Tab1" & tcc cdd C:\temp
cmd /k RenameTab "Tab2" & cd /d D:\
cmd /c RenameTab "Tab3" & stermc charlesr ...

And so on... Supposing, that %ConEmuBaseDir% exists in %PATH%. This can be done automatically with last ConEmu versions (option on ComSpec settings page).

More short and preferable alternative is available in build 121109 or higher

>tcc cdd C:\temp "-new_console:t:Tab1"
cmd /k cd D:\ "-new_console:t:Tab2"
stermc charles "-new_console:t:Tab3"

2) As for CD in title, you may use usual method. This works for cmd and tcc consoles. Example:

tcc prompt $E]2;"$P"$E\$P$G & cdd D:\
cmd prompt $E]2;"$P"$E\$P$G & cd /d D:\

Don't use 1 and 2 simultaneously. RenameTab has precedence!

Maximus

Posted 2012-08-08T16:19:29.223

Reputation: 19 395

I added this to my powershell profile, see here: https://github.com/majkinetor/powershell_profile.d/blob/master/10_prompt.ps1#L11

– majkinetor – 2016-10-19T10:04:44.277

Wow, I didn't think it was possible - thank you. Having said that, 2) isn't working for me - it doesn't change the tab name. Could you possibly show what it should look like in your {Tasks} config? – Charles Roper – 2012-08-09T07:38:21.787

Note! prompt $E]2;"$P"$E\$P$G change console title, not rename tab. Rename tab has priority. http://i.imgur.com/UCl3R.png http://i.imgur.com/A0WwJ.png

– Maximus – 2012-08-09T07:41:00.893

6New switch introduced, answer updated. – Maximus – 2012-11-12T18:15:24.580

0

Have you tried using:

title your-desired-tab-name

I tried it on my conemu and it works just fine. Just input those commands on the command line of conemu.

catzilla

Posted 2012-08-08T16:19:29.223

Reputation: 101