3866771b1b
#### ⚠️ this pr targets #9977 ## Summary of the Pull Request This adds support for part of the `monitor` property for `globalSummon`. It also goes a little off-spec: ```json "monitor": "any"|"toCurrent"|"toMouse" ``` * `monitor`: This controls the monitor that the window will be summoned from/to - `"any"`: Summon the MRU window, regardless of which monitor it's currently on. - `"toCurrent"`/omitted: (_default_): Summon the MRU window **TO** the monitor with the current **foreground** window. - [**NEW**] `"toMouse"`: Summon the MRU window **TO** the monitor where the **mouse** cursor is. When I was playing with this, It felt like `toMouse` was always what I wanted, not `toCurrent`. We can always just comment that out if we think that's contentious - I'm aware I didn't originally spec that. ## References * Original thread: #653 * Spec: #9274 * megathread: #8888 ## PR Checklist * [x] Closes https://github.com/microsoft/terminal/projects/5#card-60325291 * [x] I work here * [ ] Tests added/passed * [ ] Requires documentation to be updated 😢 ## Detailed Description of the Pull Request / Additional comments I made `toMouse` the default because it felt better. fite-me.jpg ## Validation Steps Performed my ever evolving blob: ```jsonc { "keys": "ctrl+`", "command": { "action": "quakeMode" } }, { "keys": "ctrl+1", "command": { "action": "globalSummon" } }, // { "keys": "ctrl+2", "command": { "action": "globalSummon", "desktop": "toCurrent" } }, // { "keys": "ctrl+2", "command": { "action": "globalSummon", "toggleVisibility": false } }, // { "keys": "ctrl+2", "command": { "action": "globalSummon", "dropdownDuration": 2000 } }, { "keys": "ctrl+2", "command": { "action": "globalSummon", "monitor": "any" } }, // { "keys": "ctrl+3", "command": { "action": "globalSummon", "desktop": "onCurrent" } }, { "keys": "ctrl+3", "command": { "action": "globalSummon", "monitor": "toMouse" } }, // { "keys": "ctrl+4", "command": { "action": "globalSummon", "desktop": "any" } }, { "keys": "ctrl+4", "command": { "action": "globalSummon", "monitor": "toMouse", "dropdownDuration": 500 } }, { "keys": "ctrl+5", "command": { "action": "globalSummon", "dropdownDuration": 500 } }, ```
42 lines
1.2 KiB
C++
42 lines
1.2 KiB
C++
/*++
|
|
Copyright (c) Microsoft Corporation
|
|
Licensed under the MIT license.
|
|
|
|
Class Name:
|
|
- SummonWindowBehavior.h
|
|
|
|
Abstract:
|
|
- TODO!
|
|
|
|
--*/
|
|
|
|
#pragma once
|
|
|
|
#include "SummonWindowBehavior.g.h"
|
|
#include "../cascadia/inc/cppwinrt_utils.h"
|
|
|
|
namespace winrt::Microsoft::Terminal::Remoting::implementation
|
|
{
|
|
struct SummonWindowBehavior : public SummonWindowBehaviorT<SummonWindowBehavior>
|
|
{
|
|
public:
|
|
SummonWindowBehavior() = default;
|
|
WINRT_PROPERTY(bool, MoveToCurrentDesktop, true);
|
|
WINRT_PROPERTY(bool, ToggleVisibility, true);
|
|
WINRT_PROPERTY(uint32_t, DropdownDuration, 0);
|
|
WINRT_PROPERTY(Remoting::MonitorBehavior, ToMonitor, Remoting::MonitorBehavior::ToCurrent);
|
|
|
|
public:
|
|
SummonWindowBehavior(const Remoting::SummonWindowBehavior& other) :
|
|
_MoveToCurrentDesktop{ other.MoveToCurrentDesktop() },
|
|
_ToMonitor{ other.ToMonitor() },
|
|
_DropdownDuration{ other.DropdownDuration() },
|
|
_ToggleVisibility{ other.ToggleVisibility() } {};
|
|
};
|
|
}
|
|
|
|
namespace winrt::Microsoft::Terminal::Remoting::factory_implementation
|
|
{
|
|
BASIC_FACTORY(SummonWindowBehavior);
|
|
}
|