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

Request: Right-click menu inside TerminalControl (w/ Copy & Paste?) #3337

Closed
Tracked by #6999
ianceicys opened this issue Oct 26, 2019 · 50 comments · Fixed by #14775
Closed
Tracked by #6999

Request: Right-click menu inside TerminalControl (w/ Copy & Paste?) #3337

ianceicys opened this issue Oct 26, 2019 · 50 comments · Fixed by #14775
Labels
Area-User Interface Issues pertaining to the user interface of the Console or Terminal In-PR This issue has a related PR Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Needs-Tag-Fix Doesn't match tag requirements Product-Terminal The new Windows Terminal.
Milestone

Comments

@ianceicys
Copy link

ianceicys commented Oct 26, 2019

I use cmd.exe's right-click on the menu bar to Select All, Mark, Find, Copy, and Paste. I would like Windows Terminal to support a similar feature.
Conhost.exe
image
I also get the right mouse button on WSL's Ubuntu console.
image

@ghost ghost added Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Oct 26, 2019
@zadjii-msft zadjii-msft added Area-User Interface Issues pertaining to the user interface of the Console or Terminal Issue-Task It's a feature request, but it doesn't really need a major design. Product-Terminal The new Windows Terminal. labels Oct 28, 2019
@ghost ghost removed the Needs-Tag-Fix Doesn't match tag requirements label Oct 28, 2019
@zadjii-msft zadjii-msft added this to the Terminal Backlog milestone Oct 28, 2019
@zadjii-msft
Copy link
Member

Seems vaguely related to #1912 as well.

This might require some more detailed design discussion. For example, if you right click on the titlebar (when tabs aren't in the titlebar), then it makes sense that these options would apply only to the active tab/pane. Start a selection in the current tab, copy the current tab's selected text, etc.

What about if you right-click on a tab that's not focused? Would "copy" there copy the text from the unfocused tab?

Would "find" still bring up the search dialog for the currently focused pane?

@DHowett-MSFT DHowett-MSFT changed the title Right Click Copy Paste Request: Right-click menu inside TerminalControl Oct 29, 2019
@DHowett-MSFT DHowett-MSFT changed the title Request: Right-click menu inside TerminalControl Request: Right-click menu inside TerminalControl (w/ Copy & Paste?) Oct 29, 2019
@DHowett-MSFT DHowett-MSFT removed the Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting label Oct 29, 2019
@jdrch
Copy link

jdrch commented Mar 11, 2020

Same request here. Not having a right-click menu seriously reduces Terminal's usability compared to MobaXterm on Windows and Konsole in KDE on Linux.

@cor3ntin
Copy link

Yes, please!
Here is what it looks like in Konsole, it is incredibly useful

image

@jdrch
Copy link

jdrch commented Mar 20, 2020

@cor3ntin Literally this a million times over. That's what an actually useful terminal app is supposed to do/look like.

@DHowett-MSFT
Copy link
Contributor

You don’t need to throw shade to make your point.

@jdrch
Copy link

jdrch commented Mar 20, 2020

@DHowett-MSFT I'm just being honest. There's a reason I have Terminal installed but still use MobaXTerm, even for my WSL instance (which I had to blow away anyway to get an Insider Build update to take, but that's another story.) Stuff like lack of a right-click really diminishes the usefulness of a terminal emulator to me because I can't even use the context menu keyboard button in it. If I said otherwise I'd be lying. 🤷‍♂️

And no, I'm not a hater. More of my PCs run Windows 10 (5) than run any other OS and Windows is my daily driver at work and home.

@SFM61319

This comment has been minimized.

@DHowett-MSFT

This comment has been minimized.

@mdtauk
Copy link

mdtauk commented Apr 28, 2020

This context menu should also include the pane commands
"Split Vertically" and "Split Horizontally"

@jdrch
Copy link

jdrch commented Apr 28, 2020

@mdtauk Which other terminal apps have that feature? Just curious. Most multiplexing is done server-side via byobu, tmux, or something similar.

@mdtauk
Copy link

mdtauk commented Apr 28, 2020

@jdrch the feature is there, however it can only be used via keyboard shortcuts.

@jdrch
Copy link

jdrch commented Apr 28, 2020

@mdtauk Ah. TIL!

@zadjii-msft
Copy link
Member

@jdrch Hyper, Terminator, Windows Terminal (see #1000), iterm2

@mdtauk
Copy link

mdtauk commented Apr 28, 2020

@mdtauk Ah. TIL!

This is why I think the feature needs more UI awareness

@zadjii-msft
Copy link
Member

More notes

image

Do something like this.

  • TermControl should have a ContextFlyout property, which is a CommandBarFlyout.
  • The TerminalPage can add an Opening handler to that ContextFlyout.
  • In that Opening handler, the page can add commands it wants to customize the control with.
  • Copy, paste, find are always in the menu.
  • SplitPane, DuplicateTab, ClosePane, CloseTab all get added as needed.
  • In the sample for RichTextBox, there's a separate SelectionFlyout. That doesn't seem like a bad idea, honestly.
    • Only put copy/find in those commands
    • Only put SearchWeb in there

@microsoft-github-policy-service microsoft-github-policy-service bot added the In-PR This issue has a related PR label Feb 5, 2023
DHowett pushed a commit that referenced this issue Mar 17, 2023
Experimental for now. `experimental.rightClickContextMenu`, a
per-profile setting. Long term we want to enable full mouse bindings, at
which point this would be replaced.

Closes #3337

This adds **two** context menus to the `TermControl` - one for
right-clicking with a selection, and one without. The implementation is
designed to follows the API experience of the context menu on something
like a [`RichEditBox`](winui2gallery://item/RichEditBox). The hosting
application adds a handler for the menu's `Opening` event, and appends
whatever items it wants at that time.

So `TermControl` only implements a few "actions" by default - copy,
past, find. `TerminalApp` is then responsible for adding anything else
it needs. Right now, those actions are:
* Duplicate tab
* Duplicate pane
* Close Tab
* Close pane

Screenshots in
#14775 (comment)
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs-Tag-Fix Doesn't match tag requirements label Mar 17, 2023
@isayakmondal
Copy link

Where do I've to put experimental.rightClickContextMenu in order for this to work? @zadjii-msft

@zadjii-msft
Copy link
Member

That just merged on Friday - it's only available in main currently. It'll be a while before 1.18 comes out with this.

@isayakmondal
Copy link

That just merged on Friday - it's only available in main currently. It'll be a while before 1.18 comes out with this.

In the mean time can I change the behavior of the right click or disable to completely?

@zadjii-msft
Copy link
Member

Nope, sorry.

@frisedel
Copy link

frisedel commented Mar 4, 2024

so a year has passed, and it seems that the context menu should be in the preview version.
however, I can't get it to work.
any suggestions on how to do that? the option is not the settings

https://learn.microsoft.com/en-us/windows/terminal/customize-settings/profile-advanced#right-click-context-menu-preview

@zadjii-msft
Copy link
Member

zadjii-msft commented Mar 4, 2024

It's not in the settings UI anywhere (as of 1.19 / 1.20), but you can add it in to the settings.json file manually, with

"experimental.rightClickContextMenu": true,

under any profile

@zadjii-msft
Copy link
Member

(I also went ahead and added it to the SUI in #16809. Sorry we forgot about it so long!)

@jdrch
Copy link

jdrch commented Mar 4, 2024

under any profile

Where is this located again? Dumb question, sorry.

@Neme12
Copy link

Neme12 commented Mar 5, 2024

What version is experimental.rightClickContextMenu available in? I have version 1.19.10573.0 and setting this in settings.json has no effect.

@Neme12
Copy link

Neme12 commented Mar 5, 2024

Oh I see, it's a per-profile setting. I learned about the setting here: https://learn.microsoft.com/en-us/windows/terminal/customize-settings/interaction - there, it says the settings on that page belong to the root of settings.json.
image
Maybe the documentation should be fixed?

zadjii-msft added a commit that referenced this issue Mar 21, 2024
As noted in #3337, we never actually added this menu to the settings. 

Since we're planning on taking this out of "experimental" in 1.21, we
should have a visible setting for it too.
@jdrch

This comment was marked as outdated.

@jdrch
Copy link

jdrch commented Apr 22, 2024

Update: follow these instructions to add "experimental.rightClickContextMenu": true to %LOCALAPPDATA%\Packages\Microsoft.WindowsTerminalPreview_8wekyb3d8bbwe\LocalState\settings.json

I did the above and it worked just fine.

@frisedel

This comment was marked as off-topic.

@jdrch

This comment was marked as off-topic.

@frisedel

This comment was marked as off-topic.

@jdrch

This comment was marked as off-topic.

@zadjii-msft
Copy link
Member

Note to self: write the spec for #1553, so that we can make this (context menu) the default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-User Interface Issues pertaining to the user interface of the Console or Terminal In-PR This issue has a related PR Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Needs-Tag-Fix Doesn't match tag requirements Product-Terminal The new Windows Terminal.
Projects
None yet
Development

Successfully merging a pull request may close this issue.