-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Provide global setting to use ATS for nextTab and prevTab #7321
Conversation
…pal the power to detect alts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you update the PR description with more details? All this stuff with "tabSearch" was throwing me off.
@@ -119,6 +119,7 @@ namespace winrt::TerminalApp::implementation | |||
if (auto page{ weakThis.get() }) | |||
{ | |||
_UpdateCommandsForPalette(); | |||
CommandPalette().SetKeyBindings(_settings->GetKeybindings()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(curious) why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't actually "set the bindings on the command palette", this is "attach the combined [key binding list and key binding key-receiver action dispatcher] to the palette" which is absolutely required for the palette to dispatch key binding events.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we had a better separation of responsibilities here, we would be able to give command palette a key binding handler whose only bound actions were next/prev tab
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(and then it could handle them itself). but right now our key binding command dispatch interface is an interface containing 100 functions it would need to implement and it is tied up with the actual deserializer code. heck.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Carlos, looks like you've made a couple comments below about the same keybindings topic so I'll move all the discussion here:
Yeah I honestly didn't know how to trim down the given bindings to just nextTab and prevTab 😢
I'm mostly hoping that because the control needs to be kept open with a modifier key, and there's no search bar and the only interactable interface is a list view, the range of actions a user would want to do is limited.
Like, if you've hit ctrl+tab to open the tab switcher, and for some odd reason you shift your fingers to invoke find which could be something like ctrl+shift+f, it'll show the find dialog and leave the tab switcher open. But IMO that's pretty inconvenient considering the whole time you'd have to hold down ctrl and shift your hand/fingers. Also, If you're holding down ctrl, you're saying you want the tab switcher to stay open while opening the find dialog?
But, I guess, then again, the whole "bad faith actor" is a valid reason to rip this out and just not allow users to use their nT/pT keybinding to navigate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Downloaded the branch and tested it. Yeah, this works fine. And scenarios like "opening the search box while the tab switcher is open" would probably fall under the "play stupid games" category. Fixing this is probably more effort than it's worth right now, so good enough for me!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I want this for "dispatch a keybinding while the palette is open". Like, if the user opens the palette, sees the keybinding for "new tab" is ctrl+shift+t, they should be able to just press that and have it do the right thing, you know?
My bad 😅 the PR description was looking very bare. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this seems way cleaner (even though it added more direct manipulation from the page to the switcher control). interested to see how @zadjii-msft feels about it
// Use the VisualTreeHelper's GetParent as a fallback. | ||
if (!focusedObject) | ||
{ | ||
focusedObject = winrt::Windows::UI::Xaml::Media::VisualTreeHelper::GetParent(focusedElement); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clever!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm surprised this mostly just worked -- binding the direct handler, that is :)
Co-authored-by: Dustin L. Howett <[email protected]>
i'm blocking on @zadjii-msft having a closer look, but I am not horribly worried about anything in here |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At first from reading the description, I thought I'd hate this. But after playing with it, I really liked how it felt, and I especially love how much simpler a lot of the code is. I'm not blocking this because overall I think this is good. I just have like the tiniest nits, but you need to fix the merge conflicts anyways 😄
doc/cascadia/profiles.schema.json
Outdated
@@ -68,7 +68,7 @@ | |||
"wt", | |||
"closeOtherTabs", | |||
"closeTabsAfter", | |||
"tabSwitcher", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
useTabSwitcher probably needs to get added to this file too
@@ -7,6 +7,7 @@ | |||
#include "ActionArgs.h" | |||
#include "Command.h" | |||
|
|||
#include <WinUser.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did we need this just for VK_MENU
? IMO we might as well include it in the pch, since I doubt this is the last time we'll need it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah just for VK_MENU
, I'll throw it in pch
@@ -576,6 +576,9 @@ | |||
<data name="SetColorSchemeParentCommandName" xml:space="preserve"> | |||
<value>Select color scheme...</value> | |||
</data> | |||
<data name="TabSearchCommandKey" xml:space="preserve"> | |||
<value>Tab Search</value> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to make this a tad bit more... interactive? Perhaps something like "Search for tab..." (kinda like "Set the tab color..." - it's not technically a nested command, but it is a sequence of actions)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh yeah "Search for tab..." looks pretty decent 👍
@@ -119,6 +119,7 @@ namespace winrt::TerminalApp::implementation | |||
if (auto page{ weakThis.get() }) | |||
{ | |||
_UpdateCommandsForPalette(); | |||
CommandPalette().SetKeyBindings(_settings->GetKeybindings()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I want this for "dispatch a keybinding while the palette is open". Like, if the user opens the palette, sees the keybinding for "new tab" is ctrl+shift+t, they should be able to just press that and have it do the right thing, you know?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…aptain-now # Conflicts: # src/cascadia/TerminalApp/Resources/en-US/Resources.resw
Hello @zadjii-msft! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
🎉 Handy links: |
Summary of the Pull Request
This PR splits the anchored and unanchored tab switcher into two. The anchored tab switcher is now baked into
nextTab
/prevTab
, and the unanchored tab switcher command is just namedtabSearch
.tabSearch
takes no arguments. To reflect this distinction,CommandPalette.cpp
now refers to one asTabSwitchMode
and the other asTabSearchMode
.I've added a global setting named
useTabSwitcher
(name up for debate) that makes the Terminal use the anchored tab switcher experience fornextTab
andprevTab
.I've also given the control the ability to detect Alt KeyUp events and to dispatch keybinding events. By listening for keybindings, the ATS can react to
nextTab
/prevTab
invocations for navigation in addition to listening for tab and the arrow keys.Closes #7178
PR Checklist