Useful for now, whilst the Tab Bar is in an incomplete state, but will also be useful in a finished version. Each Tab should have a Context Menu with a Close command, as well as eventually, options for renaming the Profile/Tab Title, and changing the TabWidth behaviour.
For now, the Tab Title Text can be so long, you need to scroll with the mouse wheel to get to the close button on some tabs, so having a right click option would help for now.
We almost certainly want to do this. @carlos-zamora indicated an interest in this in April :smile:
The sooner this can be added, with the single close command - would be appreciated. Once there is a context menu there, new things can be added over time.
Just installed Terminal to try it out and this was the very first thing I noticed... along side having to edit a JSON file for the settings.
Another nice-to-have item for a tab's context menu would be to restart/reload the tab. This is one feature I use heavily in ConEmu currently. Being able to bind that to a keyboard shortcut would also be fantastic.
Rename via double-click/key-binding would also be very nice. The new tabTitle option is already useful but sometimes it could be helpful to quickly rename a tab.
Also it may be useful for executing custom commands for profiles.
For example, there could be a setting for this, and in the context menu is an item executing "sudo apt update".
Another request from #1000: Actions for "Split Vertical [|]" and "Split Horizontal [-]", then with sub-menus for which profile to split with.
This thread seems to be getting muddled with ancillary requests not specific to the title. Please stay on target with the original request. Make separate requests as relevant.
That that end, is there any movement on this request (_Feature Request: Context Menu for Tabs_)
When there's progress, we'll make sure to post in here 馃槈. #3789 will add a context menu that we can use, then it's just on us to add more features to that flyout.
That's not the correct place for this request. That's specific to colors, not #1912, which is content menu. Should #1912 be closed a new request opened since this one has become inundated with ancillary requests and little on the topic itself?
I'm pretty sure it's relevant to a "context menu for tabs", since it literally adds a context menu to tabs:
We're not planning on having a specific other PR for just adding a context menu to the tabs while this PR (#3789) is active.
Typically, we like to use "feature" issues to track larger buckets of work that might span multiple PRs, and "task" issues to track work that could be done as an individual PR. So in this case, this "feature" encapsulates all the context menu entries, while
Are all reasonable sub-tasks that should be incorporated into a complete design. Obviously, this is all fairly open to change as we work on it, but those are rough estimates of how we track issues on our repo.
Also a feature for tabs to inherit the background color?
Also a feature for tabs to inherit the background color?
See now that's something that's _off-topic_. That's a request that fits better over in #3327
I propose this be closed and all work and comments captured in #3789. Too confusing to know which to watch and comment.
Thanks for the suggestion! I think there's a lot of good suggestions in this thread, and I'd rather not muddle #3789 with ancillary requests. That PR is a good atomic PR that adds exactly one feature, and adding more requests to it would further delay a PR that's already overdue.
Once that PR is merged, we'll use this thread as the master thread for all the follow-up tasks to add to the context menu.
The context menu should also have a Duplicate tab option. The command and default shortcut key Ctrl+Shift+D are already there, so once there is a context menu it should be easy to add.
So the only reason I'm reluctant to just slam that feature in now is the following question: what happens when the tab has multiple panes in it?
The "duplicateTab" keybinding currently only duplicates the active pane into a new tab. It was also authored before panes were really a thing. So maybe we'll need to do two things here:
duplicateTab should get an new param "duplicatePanes" which is false by default. When true, duplicateTab will dupe the pane structure too.Can I take up this issue?
I tried to navigate through the codebase to find the relevant files but I couldn't.
I'm a beginner. I'm willing to contribute. Can someone guide me through this?
Go right ahead!
Right now the context menu is being constructed in Tab::_CreateContextMenu.
Honestly, the hardest part might just be wiring up the Tab to the ShortcutActionDispatch, which is the object that can be used for executing actions (like those that are bindable to keys). The CommandPalette does something similar to what I think you'd need to do.
Then it's just a matter of creating an ActionAndArgs corresponding to the action you'd like to perform, and passing it to the ShortcutActionDispatch. If there's not a ShortcutAction that corresponds to the action that you want to add to the context menu, then we'd have to add support for that too, but usually that's not too hard.
Which action(s) were you thinking of adding to the context menu?
I was thinking of adding "Close all tabs to the right" to the context menu.
I went through the file mentioned by you and I have a fair idea to solve this issue. Under CreateContextMenu() in Tab I can create a new MenuItem, implement a Click() and then append it to the context menu, ShortcutActionDispatch - contains all the actions that can be executed(in my case, I need CloseTab action and it already exists). In my case, I need a list of all the tabs that have been created so that I can iterate through it and then close all the tabs to right. Is this the right approach? How do I list all the tabs?
Yea, that's a little bit of the challenge with that action. Right now, I think the closeTab action doesn't actually accept any arguments, so it always just closes the active tab. I like half drafted a design for a closeTabs action that would accept parameters in #5888:
In both of those cases, it might be important to somehow refer to the
context of the current tab or control in the json. Think for example about
"Close tab" or "Close other tabs" - currently, those work by _knowing_ which
tab the "action" is specified for, not by actually using acloseTabaction.
In the future, they might need to be implemented as something like
- Close Tab:
{ "action": "closeTab", "index": "${selectedTab.index}" }- Close Other Tabs:
{ "action": "closeTabs", "otherThan": "${selectedTab.index}" }- Close Tabs to the Right:
{ "action": "closeTabs", "after": "${selectedTab.index}" }
Unfortunately, that doesn't really help you right now. I might need to roll that action (or a variation) together before this is actually possible...
@RahulRavishankar I threw together a PR for the actions that you'll probably need over in #7176. You'd still need some way for a Tab to figure out what index it is, but that shouldn't be that hard. Hope that helps!
Can those menu items be grayed out if there are no tabs that would be closed by them? I suppose that can be done as a separate feature that applies to the command palette as well.
Most helpful comment
Rename via double-click/key-binding would also be very nice. The new tabTitle option is already useful but sometimes it could be helpful to quickly rename a tab.