-
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
Add support for renaming windows #9662
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The history of this had gotten way, way too long. It included everything since I started working on this
WE LIVE IN A MAD WORLD. Teaching tips are exactly the UI we want, but they just don't fucking work man. WE want them to light dismiss, but if the window is inactive, and you have ILDE=true, then the tip immediately dismisses itself. So inactive windows need to not enable light dismiss. ALSO we need inactive windows to not focus something when the tip dismisses itself. Like, focus was _nowhere_ when we started. We need to toss the focus back to _nowhere_.
(cherry picked from commit aa51c07)
(cherry picked from commit fa26f7f)
…dows-3 # Conflicts: # src/cascadia/Remoting/FindTargetWindowArgs.h # src/cascadia/Remoting/ProposeCommandlineResult.h
add a test, and add liberal comments.
…Windows # Conflicts: # src/cascadia/Remoting/WindowManager.cpp # src/cascadia/TerminalApp/Resources/en-US/Resources.resw
…windows # Conflicts: # src/cascadia/TerminalApp/Resources/en-US/Resources.resw # src/cascadia/TerminalApp/TerminalPage.cpp # src/cascadia/TerminalApp/TerminalPage.h # src/cascadia/WindowsTerminal/AppHost.cpp
DHowett
approved these changes
Apr 2, 2021
zadjii-msft
added
the
AutoMerge
Marked for automatic merge by the bot when requirements are met
label
Apr 2, 2021
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 (
|
ghost
deleted the
dev/migrie/f/rename-windows
branch
April 2, 2021 16:00
This was referenced Apr 6, 2021
ghost
pushed a commit
that referenced
this pull request
Apr 6, 2021
## Summary of the Pull Request In exactly the same fashion as the tab renamer, handle <kbd>Enter</kbd> for committing the rename, and <kbd>Escape</kbd> for dismissing the rename. ## References * Added in #9662 ## PR Checklist * [x] Closes #9720 * [x] I work here * [n/a] Tests added/passed * [n/a] Requires documentation to be updated ## Validation Steps Performed Played with it - this feels good.
This was referenced Apr 6, 2021
ghost
pushed a commit
that referenced
this pull request
Apr 7, 2021
## Summary of the Pull Request Huh, I guess I missed making the window renamer light-dismissable. This is a oneline fix for that. Light dismissing is treated as a _cancel_, not as a commit. ## References * Added in #9662 ## PR Checklist * [x] Closes #9718 * [x] I work here * [n/a] Tests added/passed * [n/a] Requires documentation to be updated ## Validation Steps Performed This feels right.
ghost
pushed a commit
that referenced
this pull request
Apr 7, 2021
## Summary of the Pull Request Make sure that the window renamer and other toasts follow the requested app theme. We accomplish this by doing something similar to what we do with ContentDialogs. Since TeachingTips aren't in the same XAML root, we have to traverse the entire tree upwards setting RequestedTheme. If we don't, then we'll update the background color of the TeachingTip, but not the text inside it. ## References * Added in #9662 and #9523 ## PR Checklist * [x] Closes #9717 * [x] I work here * [n/a] Tests added/passed * [n/a] Requires documentation to be updated ## Validation Steps Performed Tested with system theme light & dark, and `theme` set to `light, dark, and unset, and verified that they worked as expected.
This was referenced Apr 9, 2021
Merged
🎉 Handy links: |
ghost
pushed a commit
that referenced
this pull request
Apr 14, 2021
## Summary of the Pull Request Clearly, I didn't run these tests on my last commit where I made the toasts lazy-load. ## References * broken in in #9662 * ## PR Checklist * [x] Closes #9769 * [x] I work here * [x] Tests added/passed * [n/a] Requires documentation to be updated ## Detailed Description of the Pull Request / Additional comments For whatever reason, these tests are unhappy running back to back, but are just fine running isolated.
mpela81
pushed a commit
to mpela81/terminal
that referenced
this pull request
Apr 17, 2021
## Summary of the Pull Request Clearly, I didn't run these tests on my last commit where I made the toasts lazy-load. ## References * broken in in microsoft#9662 * ## PR Checklist * [x] Closes microsoft#9769 * [x] I work here * [x] Tests added/passed * [n/a] Requires documentation to be updated ## Detailed Description of the Pull Request / Additional comments For whatever reason, these tests are unhappy running back to back, but are just fine running isolated.
ghost
pushed a commit
that referenced
this pull request
Apr 22, 2021
I added a `RenameSucceededText` property to the `TerminalPage` which returns the formatted message `Successfully renamed window to "{WindowNameForDisplay()}"` This _doesn't_ pop the dialog when you `wt -w foo` for the first time. Only _subsequent_ renames. ## References * Added in #9662 * Closes #9804
DHowett
pushed a commit
that referenced
this pull request
May 14, 2021
I added a `RenameSucceededText` property to the `TerminalPage` which returns the formatted message `Successfully renamed window to "{WindowNameForDisplay()}"` This _doesn't_ pop the dialog when you `wt -w foo` for the first time. Only _subsequent_ renames. ## References * Added in #9662 * Closes #9804 (cherry picked from commit aa54de1)
4 tasks
ghost
pushed a commit
that referenced
this pull request
Mar 31, 2022
Does what it says on the tin. This is maximal BODGE. `TeachingTip` doesn't provide an `Opened` event. (microsoft/microsoft-ui-xaml#1607). But we want to focus the renamer text box when it's opened. We can't do that immediately, the TextBox technically isn't in the visual tree yet. We have to wait for it to get added some time after we call IsOpen. How do we do that reliably? Usually, for this kind of thing, we'd just use a one-off LayoutUpdated event, as a notification that the TextBox was added to the tree. HOWEVER: * The _first_ time this is fired, when the box is _first_ opened, yeeting focus doesn't work on the first LayoutUpdated. It does work on the second LayoutUpdated. Okay, so we'll wait for two LayoutUpdated events, and focus on the second. * On subsequent opens: We only ever get a single LayoutUpdated. Period. But, you can successfully focus it on that LayoutUpdated. So, we'll keep track of how many LayoutUpdated's we've _ever_ gotten. If we've had at least 2, then we can focus the text box. We're also not using a ContentDialog for this, because in Xaml Islands a text box in a ContentDialog won't receive _any_ keypresses. Fun! ## References * microsoft/microsoft-ui-xaml#1607 * microsoft/microsoft-ui-xaml#6910 * microsoft/microsoft-ui-xaml#3257 * #9662 ## PR Checklist * [x] Will close out #12021, but that's an a11y bug that needs secondary validation * [x] Closes #11322 * [x] I work here * [x] Tests added/passed * [n/a] Requires documentation to be updated ## Validation Steps Performed Tested manually
DHowett
pushed a commit
that referenced
this pull request
Mar 31, 2022
Does what it says on the tin. This is maximal BODGE. `TeachingTip` doesn't provide an `Opened` event. (microsoft/microsoft-ui-xaml#1607). But we want to focus the renamer text box when it's opened. We can't do that immediately, the TextBox technically isn't in the visual tree yet. We have to wait for it to get added some time after we call IsOpen. How do we do that reliably? Usually, for this kind of thing, we'd just use a one-off LayoutUpdated event, as a notification that the TextBox was added to the tree. HOWEVER: * The _first_ time this is fired, when the box is _first_ opened, yeeting focus doesn't work on the first LayoutUpdated. It does work on the second LayoutUpdated. Okay, so we'll wait for two LayoutUpdated events, and focus on the second. * On subsequent opens: We only ever get a single LayoutUpdated. Period. But, you can successfully focus it on that LayoutUpdated. So, we'll keep track of how many LayoutUpdated's we've _ever_ gotten. If we've had at least 2, then we can focus the text box. We're also not using a ContentDialog for this, because in Xaml Islands a text box in a ContentDialog won't receive _any_ keypresses. Fun! ## References * microsoft/microsoft-ui-xaml#1607 * microsoft/microsoft-ui-xaml#6910 * microsoft/microsoft-ui-xaml#3257 * #9662 ## PR Checklist * [x] Will close out #12021, but that's an a11y bug that needs secondary validation * [x] Closes #11322 * [x] I work here * [x] Tests added/passed * [n/a] Requires documentation to be updated ## Validation Steps Performed Tested manually (cherry picked from commit b57fe85) Service-Card-Id: 79978834 Service-Version: 1.13
DHowett
pushed a commit
that referenced
this pull request
Mar 31, 2022
Does what it says on the tin. This is maximal BODGE. `TeachingTip` doesn't provide an `Opened` event. (microsoft/microsoft-ui-xaml#1607). But we want to focus the renamer text box when it's opened. We can't do that immediately, the TextBox technically isn't in the visual tree yet. We have to wait for it to get added some time after we call IsOpen. How do we do that reliably? Usually, for this kind of thing, we'd just use a one-off LayoutUpdated event, as a notification that the TextBox was added to the tree. HOWEVER: * The _first_ time this is fired, when the box is _first_ opened, yeeting focus doesn't work on the first LayoutUpdated. It does work on the second LayoutUpdated. Okay, so we'll wait for two LayoutUpdated events, and focus on the second. * On subsequent opens: We only ever get a single LayoutUpdated. Period. But, you can successfully focus it on that LayoutUpdated. So, we'll keep track of how many LayoutUpdated's we've _ever_ gotten. If we've had at least 2, then we can focus the text box. We're also not using a ContentDialog for this, because in Xaml Islands a text box in a ContentDialog won't receive _any_ keypresses. Fun! ## References * microsoft/microsoft-ui-xaml#1607 * microsoft/microsoft-ui-xaml#6910 * microsoft/microsoft-ui-xaml#3257 * #9662 ## PR Checklist * [x] Will close out #12021, but that's an a11y bug that needs secondary validation * [x] Closes #11322 * [x] I work here * [x] Tests added/passed * [n/a] Requires documentation to be updated ## Validation Steps Performed Tested manually (cherry picked from commit b57fe85) Service-Card-Id: 79978833 Service-Version: 1.12
This pull request was closed.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary of the Pull Request
This PR adds support for renaming windows.
It does so through two new actions:
renameWindow
takes aname
parameter, and attempts to set the window's nameto the provided name. This is useful if you always want to hit F3
and rename a window to "foo" (READ: probably not that useful)
openWindowRenamer
is more interesting: it opens aTeachingTip
with aTextBox
. When the user hits Ok, it'll request a rename for the providedvalue. This lets the user pick a new name for the window at runtime.
In both cases, if there's already a window with that name, then the monarch will
reject the rename, and pop a
Toast
in the window informing the user that therename failed. Nifty!
References
PR Checklist
Detailed Description of the Pull Request / Additional comments
I'm sending this PR while finishing up the tests. I figured I'll have time to sneak them in before I get the necessary reviews.
Validation Steps Performed
I've been playing with
and they seem to work as expected