microsoft / terminal

The new Windows Terminal and the original Windows console host, all in the same place!
MIT License
94.86k stars 8.21k forks source link

[MEGATHREAD] Quake Mode & Global Summon #8888

Open DHowett opened 3 years ago

DHowett commented 3 years ago
[Original thread: #653] [Spec: #9274, doc] [Project]

See also Quake Mode FAQ

1.9 tasks * [x] Add support for win in keybindings (PR: #9783) - this is in `dev/migrie/f/win-in-keybindings` * [x] _quake window opens in focus mode, on the top half, and can't be moved or resized (except on bottom) (PR: #9785) - This is in `dev/migrie/f/653-special-_quake-window` * [x] `quakeMode` action activates the `_quake` window (or creates one) (PR: #9854) - This is in `dev/migrie/f/653-QUAKE-MODE` * [x] `quakeMode` summons the window to the current desktop (PR: #9954) - This is implemented in `dev/migrie/f/quake-toCurrent-desktop` * [x] `quakeMode`/`globalSummon` hides the window if it's currently active (PR: #9963) * [x] `quakeMode` does the dropdown dance on entrance (PR: #9977) - Started this in a6cd981 but that feels really hacky and bad. See `dev/migrie/f/quake-dropdown` for more progress - `dev/migrie/f/quake-dropdown-2` has the most research notes in it, for future readers. * [x] Exempt the `_quake` window from window glomming (PR: #9956) * [x] `quakeMode` summons the window to the current monitor

2.0 tasks

Backlog

vinodj commented 3 years ago

Is there any additional setup needed for the Windows Quake mode shortcut? I thought it was Win + ` - is that the right shortcut command or do I need to do some additional setup for it work especially with multiple monitors.

zadjii-msft commented 3 years ago

@vinodj Yes, you'll need to add the keybindings yourself manually. Also note that quakeMode and globalSummon are only available in 1.9+, which hasn't shipped yet.

I've been using the following:

        { "keys": "win+`", "command": { "action": "globalSummon", "monitor": "any" } },
        { "keys": "ctrl+shift+`", "command": { "action": "quakeMode" } },

And I've also got the following blob for testing (which shows a bunch more of the available properties):


        { "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", "dropdownDuration": 2000, "name": "_quake" } },
        { "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 } },
KittyKatt commented 3 years ago

I've successfully built and gotten quake mode working from the master branch. Is there currently support for launching it in the default focus mode? I noted in some of the PRs that it said you could specify that the _quake window have a specific launchMode, but I've yet to see HOW to do that. I obviously realize that this is still an extremely alpha feature, but I'm curious to know if this has already been figured out. I love that we've gotten this far, but I'd love to have tabs in my quake window. Thanks!

zadjii-msft commented 3 years ago

So, there are plenty of different ways to do this:

sliepie commented 3 years ago

Is there a way to start Terminal in quake mode? Tried setting launchMode without success. Workaround is starting Terminal, press keybinding to start quake, and close launch window

zadjii-msft commented 3 years ago

The easiest way IMO is wit the commandline wt -w _quake (or, on a dev build, wtd -w _quake). You can use that in the run dialog (win+r), or by making a shortcut with that as the commandline.

You could also add an action like:

{ "name": "Promote to quake window", "command": { "action": "renameWindow", "name": "_quake" } }

which you could use to take the current window and turn it into the quake window.

I think as a part of #9992, we'll also let you stick a name in the globals, to set a name for the window on startup Actually, that would only ever work for the first window, would be redundant info in each window object, would generally be confusing. We'll want a more clever solution than that.

KittyKatt commented 3 years ago

So, there are plenty of different ways to do this:

  • The window that's specifically named _quake is special. It's always in focus mode, always on the top half, always drops down, and always hides on minimize. It's specifically summoned with the quakeMode action. That action will always summon the _quake window to the current monitor, as well.

    • Note that the quake window does still have tabs, it's just always in focus mode.
  • Any window can be summoned, not just the _quake window!
  • If you want the _quake window to summon on whatever monitor it was first created on, you can just create a new action:
{ "keys": "win+`", "command": { "action": "globalSummon", "name": "_quake", "monitor": "any" } }
  • If you want the _quake window to summon without a dropdown:
{ "keys": "win+`", "command": { "action": "globalSummon", "name": "_quake" } }
  • If you want a window that just drops down, but doesn't have the rest of the quake mode baggage, you can always just bind
{ "keys": "win+`", "command": { "action": "globalSummon", "dropdownSpeed": 200 } }

that'll just summon the MRU window, wherever it is. It'll still have tabs, it'll still be wherever you want on the screen. It'll move to the current monitor.

  • There's not a good way (in 1.9) of locking a window to the top half of the screen, with tabs. I'd recommend just resizing a window manually.

This is good, but the behavior I'm looking for is to just make the _quake window not focused. I want all the other window properties (docked to top of monitor, taking up the top half, only resizable vertically, etc.), I would just like the see the tabs list in the quake window. Perhaps I'm barking up the wrong tree and ought to wait for something more to come out of #9992 to apply settings to window names persistently.

I'm having trouble with the quoted solution because I don't know if I can apply initial size and position to a window upon executing an action. I want some Terminal windows to act like they do by default, a moveable and resizable terminal that I can drag around my screen, but I ALSO want a persistent quake-like terminal. Just with a tab list. I've created the following action, but without editing my global settings I can't achieve the desired "top half of screen, docked to top, only resizable vertically" effect. As you've said at the end of your post, there's not a good way of locking a window to the top of the screen.

{ 
    "keys": "win+`", 
    "command": { 
        "action": "globalSummon",
        "dropdownSpeed": 200,
        "window": "quakey",
        "toggleVisibility": true,
        "monitor": "toMouse",
        "desktop": "toCurrent"
    }
}

The ideal scenario would be the linked issue that would allow me to apply some custom settings to all windows named _quake.

zadjii-msft commented 3 years ago

want all the other window properties (docked to top of monitor, taking up the top half, only resizable vertically, etc.), I would just like the see the tabs list in the quake window.

Fair point. That's not gonna be in 1.9, but we can work on that. I'll throw some bullet points in the list.

KittyKatt commented 3 years ago

I understand after some digging that we don't see tabs or a titlebar or anything because of "focused mode". If there was a way to toggle off focus mode in the _quake window, my personal use case for the quakeMode action would be satisfied. I've tried the action to toggle focus mode, but I'm willing to bet it's just getting overriden again by the _quake window properties before i can see any visible change. Again, #9992 seems to be sort of where that might be headed with globally assignable per-window-id properties.

zadjii-msft commented 3 years ago

FYI, We've changed quake mode to only force you into focus mode on launch - you can now leave focus mode (with the command palette or a keybinding) just fine. See #10150

dezsiszabi commented 3 years ago

Sorry if I'm asking it in the wrong thread. Just tried out quake mode. I typed in exit into powershell which opened and now I can't summon the terminal again with Win+`. Is this intentional?

zadjii-msft commented 3 years ago

Yep. You need to actually have a terminal instance running to be able to use a globalSummon/quakeMode action.

dezsiszabi commented 3 years ago

Yep. You need to actually have a terminal instance running to be able to use a globalSummon/quakeMode action.

I see, makes sense. I actually tried this, but it didn't work. I relaunched Windows Terminal Preview, then closed it with X again, and Win+` was still not working. I now retried it and this time I pressed Win+` while the terminal window was still open. After that I can actually close the Terminal with the X in the corner and Win+` keeps working.

I guess I just have to remember to NOT exit the shell from quake mode. Would be nice if there's a way to launch a new Terminal instance if none is running, but I guess something needs to handle the global hook :/

zadjii-msft commented 3 years ago

Would be nice if there's a way to launch a new Terminal instance if none is running, but I guess something needs to handle the global hook :/

Yea, this is something we've theorized for a while. I've updated #9996 to put some thoughts in there and track that. I'll add more later.

Dimension4 commented 3 years ago

Is it possible / planned to configure the default profile for quake windows? I want it to have a different style compared to the normal terminal windows. In particular, it should be:

while the normal terminal windows should behave like the default config (solid, normal window, 30 rows)

This would be achievable if quake mode had its own startup section in the settings.

zadjii-msft commented 3 years ago

@Dimension4 Yea, we're tracking that over in #9992. That's gonna quickly become "I'd like _quake to behave differently". There's also just the option right now to rebind win+` to globalSummon instead of to quakeMode, and we'll just use whatever the default settings are.

jantari commented 3 years ago

I noticed a super minor thing when trying this out today: the 1px window border of the quake dropdown terminal "leaks" onto my horizontally adjacent monitor:

![image](https://user-images.githubusercontent.com/25607767/119579510-d0d52e80-bdbe-11eb-83e6-912161db2f2b.png)

Obviously this is hard to show on a screenshot, but IRL because of the bezel separating my screens I can clearly see the 1px gray border on the leftmost pixel row of my right monitor.

rnett commented 3 years ago

Are there any plans to allow multiple or at least selectable shells for the quake window? I'd like to be able to have one shortcut to open WSL and a different one for powershell (and probably a 3rd for msys).

meydominic commented 3 years ago

Hey, little question. The quake mode is really nice, but is there a way to automatically open the terminal/quake mode on current focused explorer folder.

For example I have focused an Explorer window in my Downloads directory and then press ctrl+alt+t (my shortcut for quake mode) it should automatically open the console in this directory.

Thanks

lafe commented 3 years ago

Should the quake mode work with a German keyboard layout out of the box? The ` key has a special handling on the German keyboard, because it is used to handle accents and is not processed immediately. So ` + a produces à. If you want to type a `, you have to press the ` + [space].

zadjii-msft commented 3 years ago

Are there any plans to allow multiple or at least selectable shells for the quake window? I'd like to be able to have one shortcut to open WSL and a different one for powershell (and probably a 3rd for msys).

That's tricky, but I think you'll be able to do that with #9992. What you'd end up with is different window names for each profile you want a specific hotkey for. The defaultProfile for those windows would be set to whatever profile you want. Then, you'd bind globalSummon actions, with the name set to each of those window names.

It's maybe a verbose set of settings, but it would work.


For example I have focused an Explorer window in my Downloads directory and then press ctrl+alt+t (my shortcut for quake mode) it should automatically open the console in this directory.

I'm not sure that is possible, sorry 😕 When pressing the global hotkey, we don't get any context about the active window.......

ah shoot. okay. So, maybe we could get the foreground window, check if it's an explorer.exe window, then use the hack we're already using for the background context menu to get the path of that window. That might work. We'd still need a setting for "when this globalSummon action is performed, open a new tab with the explorer CWD." That of course leads to "I want to globalSummon in explorer and get a new pane" or "I want to globalSummon in explorer and new a new pane and have that pane running {profile}"

This deserves it's own thread.

Should the quake mode work with a German keyboard layout out of the box? The key has a special handling on the German keyboard, because it is used to handle accents and is not processed immediately. So + a produces à. If you want to type a , you have to press the + [space].

You know, @lhecker was just messaging me about this. We should figure that out.

meydominic commented 3 years ago

Maybe I found another bug.

If I restart my PC, I can't open Quake-Mode with my shortcut. I have to open WT first and close to use my shortcuts.

jantari commented 3 years ago

@meydominic That's already been reported and acknowledged in this very thread: https://github.com/microsoft/terminal/issues/8888#issuecomment-848051583

zadjii-msft commented 3 years ago

Since there's been a ton of questions on the topic in the last two days, I've added a Quake mode FAQ. If it's not covered there, then feel free to ask follow-ups in this thread.

mkanet commented 3 years ago

I'm not sure if I'm doing something wrong or not or missing any settings. But, quakemode animation isn't very smooth when setting dropdownDuration value to anything higher than 200ms. If I set it to 1000ms, the window frame just pops up, then has a delayed drawing effect afterwards:

ezgif com-gif-maker

Maintainer note: I'm marking this half of the comment as off topic - I'd really rather focus on _our_ implementation of quake mode in this thread For the time being, I ended up using [Windows-Terminal-Quake](https://github.com/flyingpie/windows-terminal-quake) to handle animating quake mode better _**(and also provide traditional non-acrylic blur transparency and ability to remove borders)**_. I wasn't able to disable borders or use traditional non-acrylic blur transparency natively in Terminal Preview yet. If there is a way to address any of these items, please let me know what I'm missing. ![ezgif com-gif-maker (1)](https://user-images.githubusercontent.com/811008/119911499-3be14b00-bf0e-11eb-82d2-1796e35ec062.gif)

Anyway, thank you so much for all your hard work guys!

zadjii-msft commented 3 years ago

FYI, the dropdown animation is not something I'm totally happy with. Case in point, from OP:

  • [ ] The dropdown animation could be better. It would be better if it animated the whole window frame, but it's gotta look good. #9977 has notes on what I tried and didn't work for me.

It's a great thing that this is an iterative project - we can start with something okay, and iterate to make it great. If anyone wants to play around with it and help fix it, we'd happily review that PR.

Off Topic: vintage style whole window opacity is tracked in #603, with more notes in https://github.com/microsoft/terminal/wiki/Frequently-Asked-Questions-(FAQ)#can-i-have-non-blurred-transparency

KalleOlaviNiemitalo commented 3 years ago

With a Finnish keyboard layout, the key between Esc and Tab inserts § (U+00A7) unshifted or ½ (U+00BD) shifted. "win+§" works in settings.json, provided that the file is encoded in UTF-8 rather than Windows-1252. Filed https://github.com/microsoft/terminal/issues/10330.

(Spy++ on Notepad shows WM_KEYDOWN nVirtKey:VK_OEM_5 cRepeat:1 ScanCode:29 fExtended:0 fAltDown:0 fRepeat:0 fUp:0. VkKeyScanW(0x00A7) returns 220 = 0xDC = VK_OEM_5. VkKeyScanW(0x00BD) returns 476 = 0x1DC.)

skyline75489 commented 3 years ago

User reports that the hotkey to trigger Quake mode is also affecting foreground application (for example Edge) in https://github.com/microsoft/terminal/issues/10450#issuecomment-863890274 . Is this something we can (and should) handle?

jantari commented 3 years ago

User reports that the hotkey to trigger Quake mode is also affecting foreground application (for example Edge) in #10450 (comment) . Is this something we can (and should) handle?

The Alt key is pretty standard on Windows to open/focus and navigate menubars with the keyboard. Even if it was possible to intercept that, I would ask you don't do it. The menubar-navigation functiinality of fhe Alt-Key is pretty important imo, and this "issue" (no -issue IMO) isn't new.

rbingham commented 3 years ago

Is it possible to have the Quake window come up from the bottom of the screen?

zadjii-msft commented 3 years ago

Is it possible to have the Quake window come up from the bottom of the screen?

Not currently - that's currently tracked in

Allow windows to be docked to other sides of the display? That might be insane though.

benjamincburns commented 3 years ago

Loving the new quake mode. It's a small annoyance, but it'd be great if there was a way to make the _quake window be the only window present on startup.

Initially I was thinking this might be a launch mode setting, however it appears that those settings are more to do with the skinning/chrome of the initial window than they are to do with which windows appear at startup?

DHowett commented 3 years ago

@benjamincburns it's not ideal but for now you can start it up with wt -w _quake and it'll launch directly into Quake mode. That command also works for targeting new tabs at an existing quake window!

digiwombat commented 3 years ago

Hey!

Not sure if I missed a flag for the config somewhere, but it'd be grand if the quake mode could auto minimize itself when it loses focus. As is, I have to hit the hotkey twice to hide the window.

Thanks for the hard work.

seantwie03 commented 3 years ago

Hello,

I really like the new Quake mode! One thing I noticed was that it doesn't display correctly on my second monitor. I think this is because of the Task Bar. I have a single Task Bar on the left side of my primary monitor "ubuntu-style". When quake mode pops up on my primary monitor it is displayed correctly. When quake mode pops up on my secondary monitor there is a gap where the task bar would be, if I had the task bar on my secondary monitor.

Screenshots below. I highlighted the area I am talking about.

image

image

Quake mode is awesome! Thanks again.

zadjii-msft commented 3 years ago

@seantwie03 that's #10201

Cheeseless commented 3 years ago

I saw this mentioned in Quake Mode.md, but is there a current issue or efforts being put towards quake mode elevation? Something like adding Shift to the hotkey feels to me like a natural expansion of the current unelevated window.

kulkalkul commented 3 years ago

Couldn't find the issue about task manager focus, so posting it here. It also happens with IntelliJ IDEs.

Nacimota commented 1 year ago

KNOWN ISSUE: If you try to summon the window while task manager is focused, the window will not get activated. Presumably this can happen with other apps as well. UWP OneNote seems affected as well.

Apologies if this has been discussed elsewhere (I did do a quick search), but I imagine this is UIPI related? If so, my understanding is that you would normally solve that by requesting UIAccess=true, though I wouldn't be able to test that because it needs to be signed and so on to work. I'm not sure how applicable that approach is to this project, so maybe someone who knows more can chime in?

Curiously enough, when I have Task Manager (or any other high integrity/UWP app) in focus, I can summon the quake window if it is not currently shown, but once it is visible on the desktop I cannot dismiss/focus the quake window using the hotkey (if taskmgr/whatever is in focus). I'm not entirely sure why that is, but (assuming my experience isn't unique) I suspect what's actually happening when a user says they can't summon the window is that is was already present on the desktop, but perhaps out of focus and hidden by other windows (like a maximized browser or something) and it's not capturing the hotkey so it doesn't take focus again.

If so that raises a couple of questions in my mind:

  1. Should the quake window be always-on-top?
    I feel like it's kind of transient UI in much the same way that (for example) the start menu is, in the sense that it floats on top of everything else while you're using it and disappears when you're done. But if you don't manually dismiss it with the hotkey and get distracted with other windows, you might mistakenly think you've dismissed it when it's actually still there.
  2. Should the quake window automatically dismiss itself when it loses focus?
    Following on from above, I think this makes a fair bit of sense. I don't think the expectations for how a quake-style window would behave are exactly the same as a regular window (or at least, I don't think they are for me). This also has the added benefit of potentially solving the Task Manager problem, assuming the hotkey does consistently work to summon the window when it isn't currently shown.

The problem also appears to go away for programs like Task Manager if you run the terminal as admin, though that doesn't seem like much of a solution. This doesn't appear to work for UWP apps, though, presumably because of AppContainers and various other things that they do which might as well be magic as far as I know.

zadjii-msft commented 1 year ago

this is UIPI related? If so, my understanding is that you would normally solve that by requesting UIAccess=true,

I honestly don't know. The way we make this work is admittedly pretty hacky: https://github.com/microsoft/terminal/blob/e2b2d9b92cf75d7841c80b222be9100eabe093ac/src/cascadia/WindowsTerminal/IslandWindow.cpp#L1511-L1527

I never dug to far into it, but I just assumed that Task Manager was protected s.t. I couldn't AttachThreadInput to it.

Whatever the solution to this is, utimately, it should work for non-quake windows as well. Quake mode is the most visible implementation here, but whatever we come up with should work for any old window.

Nacimota commented 1 year ago

I never dug to far into it, but I just assumed that Task Manager was protected s.t. I couldn't AttachThreadInput to it.

Yeah, I am fairly confident UIPI is the mechanism at play there. My understanding is that you're not allowed to AttachThreadInput (among several other things) to a process running at a higher integrity level than you, which in practice applies not just to Task Manager but presumably any app running as administrator. It's the same reason that PowerToys needs to run as admin for shortcuts to work when elevated windows (like taskmgr) are in focus. PowerToys doesn't seem to have problems with UWP apps though... but UWP is a bit of a mystery to me.

Anyway, requesting UIAccess is basically a way of bypassing UIPI without running as admin, but I don't see it used very often. I suppose because it involves a bunch of extra hurdles (process must be in a trusted location [system32/program files], authenticode signed, etc.) that are less convenient than requiring admin, especially for portable installations. I'm not sure that UIAccess is the right solution here either, I'm just saying I do suspect UIPI is the cause.

Whatever the solution to this is, utimately, it should work for non-quake windows as well. Quake mode is the most visible implementation here, but whatever we come up with should work for any old window.

Yep, that seems reasonable. Though it may not be the best solution for the problem at hand, I'd still propose always-on-top/auto-dismiss behaviours for quake mode have merit regardless, but that is a separate discussion I guess.