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

Add globalSummon action #9854

Merged
merged 85 commits into from Apr 28, 2021
Merged

Add globalSummon action #9854

merged 85 commits into from Apr 28, 2021

Conversation

zadjii-msft
Copy link
Member

Summary of the Pull Request

Adds support for two new actions:

  • globalSummon, which can be used to activate a window using a global (READ: OS-level) hotkey.
    • accepts an optional name argument. When provided, this will attempt to summon with the given name. When omitted, we'll try to summon the most recent window.
  • quakeMode which is globalSummon for the _quake window.

These actions are stored in the actions array, but are read by the WindowsTerminal level and bound to the OS in IslandWindow. The monarch registers for these keybindings with the OS. When one is pressed, the monarch will recieve a WM_HOTKEY message. It'll use that to look up the corresponding action args. It'll use those to try and simmon the right window.

References

PR Checklist

Detailed Description of the Pull Request / Additional comments

I'd love to post screenshots and gifs of this all over twitter, but hey that's frowned upon

Validation Steps Performed

  • Validated that it works with win keys
  • Validated that it works without win keys
  • Validated that it hot-reloads
  • Validated that it moves to the new monarch
  • Validated that you can bind both globalSummon and quakeMode at the same time and do different things
  • Validated that you can bind globalSummon with a name and it creates that name if it doesn't already exist

…!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
…ndow should be. It just always says 0 for now, but in the future it could actually give us useful info.
Copy link
Member

@carlos-zamora carlos-zamora left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving. Only thing is to create a better localized text when a name is provided.

Hoping this can merge in soon so I can propagate any necessary changes to my ActionMap PR #9621

Comment on lines +593 to +598
// "Summon the Terminal window, name:\"{_Name}\""
if (!_Name.empty())
{
ss << L", name: ";
ss << std::wstring_view(_Name);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know we've gotten away with it before, but "name" isn't really localized. How about Summon the "<Name>" window

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm just gonna punt this discussion to the next PR I've got queued up, because it's gonna become a quagmire of

  • Summon the Terminal window named "Foo" to the current desktop (toCurrent/toCurrent/"Foo")
  • Summon the Terminal window on the current desktop (onCurrent/toCurrent)
  • Summon the Terminal window (toCurrent/toCurrent)
  • Go to the Terminal window (any/toCurrent)
  • Summon the Terminal window named "Foo" to the current desktop, to the current monitor
  • Summon the Terminal window on the current desktop, to the current monitor
  • Summon the Terminal window on the current desktop, on the current monitor
  • Summon the Terminal window on the current monitor, to the current desktop (this one had to change order in English to make sense)

y i k e s

@carlos-zamora carlos-zamora removed their assignment Apr 21, 2021
@carlos-zamora carlos-zamora added the Needs-Second It's a PR that needs another sign-off label Apr 21, 2021
@ghost ghost requested review from miniksa, leonMSFT and PankajBhojwani April 21, 2021 17:42
@cinnamon-msft
Copy link
Contributor

To add some visuals, I made this gif of quake mode :)
Quake mode v1

@DHowett
Copy link
Member

DHowett commented Apr 28, 2021

Format the code -- DO NOT AUTOMERGE as it will destroy the open branches with stacked PRs.

@zadjii-msft
Copy link
Member Author

Format the code -- DO NOT AUTOMERGE as it will destroy the open branches with stacked PRs.

can do. Once #9954 is approved, I could just merge top-down lol

Copy link
Member

@DHowett DHowett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commenting now to see all my comments in one place to decide whether to request/approve.

@@ -71,6 +71,8 @@ namespace TerminalApp

FindTargetWindowResult FindTargetWindow(String[] args);

Windows.Foundation.Collections.IMap<Microsoft.Terminal.Control.KeyChord, Microsoft.Terminal.Settings.Model.ActionAndArgs> GlobalHotkeys();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically a View


for (const auto& [k, v] : _keyShortcuts)
{
if (v.Action() == ShortcutAction::GlobalSummon)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

discussion hook: This is crying out for Actions to have Scopes 😉

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if only there was hours in the day to even imagine spec'ing that idea 😋

src/cascadia/TerminalSettingsModel/KeyMapping.cpp Outdated Show resolved Hide resolved
src/cascadia/TerminalSettingsModel/KeyMapping.cpp Outdated Show resolved Hide resolved
src/cascadia/TerminalSettingsModel/KeyMapping.idl Outdated Show resolved Hide resolved
<!--
Microsoft ResX Schema

<!--
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re-save this file in VS if you edited it with SUBL

else
{
// We should make the window ourselves.
_createNewTerminalWindow(summonArgs);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worried about the proliferation of blocks of "run wt.exe with these args" code...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is clever/cool though

src/cascadia/WindowsTerminal/AppHost.cpp Outdated Show resolved Hide resolved
@DHowett
Copy link
Member

DHowett commented Apr 28, 2021

Okay, my only NAK comment is the postprocessing one. If it's justifiable, I'm okay with it ... but it does put some smarts in the reader rather than the loader.

@DHowett DHowett merged commit d08271e into main Apr 28, 2021
@DHowett DHowett deleted the dev/migrie/f/653-QUAKE-MODE branch April 28, 2021 22:13
@ghost
Copy link

ghost commented May 25, 2021

🎉Windows Terminal Preview v1.9.1445.0 has been released which incorporates this pull request.:tada:

Handy links:

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 Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Needs-Second It's a PR that needs another sign-off Product-Terminal The new Windows Terminal.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: hot key drop down ala quake/guake/tilda
5 participants