terminal icon indicating copy to clipboard operation
terminal copied to clipboard

[MEGATHREAD] Quake Mode & Global Summon

Open DHowett opened this issue 4 years ago • 41 comments

[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

  • [x] globalSummon to summon a window by name (PR: #9854)
    • This is in dev/migrie/f/653-QUAKE-MODE
  • [x] Basic globalSummon action (PR: #9854)
    • [x] Add support for the toggleVisibility property (PR: #9963)
    • [x] Add support for the desktop property to control how window summoning interacts with virtual desktops
      • This is implemented in dev/migrie/f/quake-toCurrent-desktop
    • [ ] Add support for the monitor which monitor the window appears on.
      • [x] "monitor": "toCurrent"|"any" for on the current vs where it is (PR #10092)
      • [x] "monitor": "toMouse" for to where the mouse pointer is (PR #10092)
      • [ ] "monitor": "onCurrent"
    • [x] Add support for the dropdownDuration property (PR: #9977)
  • [ ] We need a commandline arg to force the window to ignore initialPosition and use the current monitor instead.
  • [x] Add the minimizeToTray setting, and implement it without any sort of flyout
    • [x] _quake window is hidden when minimized (PR: #10113)
    • [x] Add tray icon when quake window is minimized #10179
    • [x] Add a list of windows to the right-click flyout on the tray icon
    • [x] Add support for the alwaysShowTrayIcon setting
  • [ ] Exiting _quake mode should restore the focus mode state, window position that the window had before.
  • [ ] There should maybe be a default action like:
{ "name": "Promote to quake window", "command": { "action": "renameWindow", "name": "_quake" } }
  • [ ] 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.
  • [x] Wrong size on Quake mode with hetero sized screens #10182
    • [x] #10805
  • [x] Quake Mode has incorrect window size after toggling fullscreen mode #10199
  • [x] 1px window border of the quake dropdown terminal "leaks" onto horizontally adjacent monitor: #10201
  • [x] Make Quake mode work with a German keyboard layout #10203
  • [x] Quake Mode multi monitor setup #10274
  • [ ] More...

Backlog

  • [ ] Add per-window-name global settings #9992
    • READ: "configure the _quake window to have some different set of settings - size, profile, etc."
  • [ ] Allow the tabs to be visible in quake mode / don't force _quake into focus mode. This might be best served by #9992
  • [ ] Allow other, non-_quake windows to be locked to the top half of the display. Probably should be a global setting. Consider #9992 when authoring this.
  • [ ] Allow windows to be docked to other sides of the display? That might be insane though.
  • [ ] Enable globalSummon / quakeMode to work even when there isn't a running Terminal #9996
  • [ ] globalSummon a new tab in explorer CWD #10202
  • [x] Quake mode hot-key stops working after a while. Restart of terminal fixes it #10340
  • [x] #10660
  • [ ] #11162
  • [ ] #11174
  • [ ] #10534
  • [ ] The animation is wonky:
    • [ ] #12293: 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.
    • [ ] #12121
  • [ ] #10279
    • [ ] Also: #13276, for wt summon
    • [ ] Closely related is #12135, for wt summon --profile
  • [ ] #10197
  • [ ] #10672
  • [ ] #10999
  • [ ] #11014
  • [ ] #11125
  • [ ] #12173
  • [ ] #12594
  • [x] #12894
  • [ ] #12944
  • [ ] More...

DHowett avatar Jan 26 '21 00:01 DHowett

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.

vinodj avatar May 16 '21 11:05 vinodj

@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 } },

zadjii-msft avatar May 17 '21 12:05 zadjii-msft

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!

KittyKatt avatar May 20 '21 20:05 KittyKatt

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.

zadjii-msft avatar May 20 '21 20:05 zadjii-msft

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

sliepie avatar May 20 '21 21:05 sliepie

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.

zadjii-msft avatar May 21 '21 14:05 zadjii-msft

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.

KittyKatt avatar May 21 '21 16:05 KittyKatt

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.

zadjii-msft avatar May 21 '21 16:05 zadjii-msft

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.

KittyKatt avatar May 21 '21 16:05 KittyKatt

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

zadjii-msft avatar May 24 '21 10:05 zadjii-msft

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?

dezsiszabi avatar May 25 '21 16:05 dezsiszabi

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

zadjii-msft avatar May 25 '21 16:05 zadjii-msft

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 :/

dezsiszabi avatar May 25 '21 16:05 dezsiszabi

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.

zadjii-msft avatar May 25 '21 17:05 zadjii-msft

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:

  • acrylic,
  • top most or minimize if it loses focus,
  • shorter (~20 rows, instead of 30)

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.

Dimension4 avatar May 25 '21 21:05 Dimension4

@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.

zadjii-msft avatar May 25 '21 21:05 zadjii-msft

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

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.

jantari avatar May 25 '21 23:05 jantari

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).

rnett avatar May 26 '21 03:05 rnett

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

meydominic avatar May 26 '21 05:05 meydominic

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].

lafe avatar May 26 '21 08:05 lafe

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.

zadjii-msft avatar May 26 '21 10:05 zadjii-msft

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.

meydominic avatar May 27 '21 09:05 meydominic

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

jantari avatar May 27 '21 11:05 jantari

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.

zadjii-msft avatar May 27 '21 15:05 zadjii-msft

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 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)

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

mkanet avatar May 28 '21 00:05 mkanet

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

zadjii-msft avatar May 28 '21 14:05 zadjii-msft

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.)

KalleOlaviNiemitalo avatar Jun 03 '21 15:06 KalleOlaviNiemitalo

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?

skyline75489 avatar Jun 18 '21 09:06 skyline75489

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.

jantari avatar Jun 18 '21 11:06 jantari

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

rbingham avatar Jul 06 '21 18:07 rbingham