terminal icon indicating copy to clipboard operation
terminal copied to clipboard

Add per-window-name global settings

Open zadjii-msft opened this issue 4 years ago • 31 comments

This one's from a team sync chat thread.

What if there was a way to say

"windows": {
  "work": {
    "alwaysOnTop" : true,
    "initialPosition": "2000, 50",
    "centerOnLaunch": true,
    "launchMode": "focus",
    "startupActions": "sp ; sp ; nt -p Ubuntu"
  },
  "_quake": {
    "launchMode": "default",
    "startupActions": "nt -p PowerShell"
  }
}

So that you could have different sets of global settings for different window names? What properties would make sense here? Definitely not windowingBehavior, because that's a global setting, not a window setting.

  • dev/migrie/fhl-fall-2023/9992-window-name-settings https://github.com/microsoft/terminal/compare/main...dev/migrie/fhl-fall-2023/9992-window-name-settings
    • ~dev/migrie/fhl-fall-2023/9992-default-quake-settings~ this was a dead end
    • dev/migrie/fhl-fall-2023/9992-quake-II https://github.com/microsoft/terminal/compare/dev/migrie/fhl-fall-2023/9992-window-name-settings...dev/migrie/fhl-fall-2023/9992-quake-II
      • dev/migrie/fhl-fall-2023/11162-quake-III-arena https://github.com/microsoft/terminal/compare/dev/migrie/fhl-fall-2023/9992-quake-II...dev/migrie/fhl-fall-2023/11162-quake-III-arena for #11162, #11174

zadjii-msft avatar Apr 29 '21 21:04 zadjii-msft

  1. This would make it so much easier for people to have "work profiles" they come into in the morning
  2. Specialization for quake that isn't special
  3. GlobalAppSettings is already inheritable (!)

Bad points:

  1. what if you rename a window

DHowett avatar Apr 29 '21 22:04 DHowett

I agree this could be pretty useful indeed. Meanwhile, if anyone needs it, I've managed to alter the behavior of the _quake window with this setting:

"startupActions": "wt -w _quake sp -H -p CMD -s .666 \\; sp -H -p UBUNTU -s .5"

The above is just an example of a "quaked" 3-pane symmetric vertical arrange. It's a "hackity-hack" bypass, 'cause I'm just using a legit functionality for something it wasn't designed to, but I'll try to explain its two key points.

First point, if wt -w _quake is the first subcommand provided, it replaces the initially launched window with a "Quake Mode" enabled one; otherwise, it opens an independent one.

Second point, there's a huge difference between writing semicolons ; or escaped semicolons \\;, and the arranging of commands is very important; all subcommands before wt -w _quake are applied within the initially launched window and must be preceded by unescaped semicolons ;, while all subcommands after wt -w _quake are applied within the new "quaked" window and must be preceded by escaped semicolons \\; in order to bypass the initially launched window parsing.

As an example, let's say you want to launch two separate windows with a 2-pane horizontal arrange (PWSH and CMD): a "quaked" one and a "standard" one. If your default profile is PWSH, then you'd write the next setting:

"startupActions": "sp -V -p CMD -s .5 ; wt -w _quake \\; sp -V -p CMD -s .5"

I hope someone finds it useful.

BTW, congratulations! WT is awesome and I really like where it is heading by becoming the Isildur's Bane of all terminals! 🥇

dag03tsc avatar May 31 '21 00:05 dag03tsc

@zadjii-msft, I list some additional properties from #10279 that could be useful inside each window entity, along with a short explanation.

"tabs": {
  "name": string;
  "index": number;
  "panes": {
    "index": number;
    "profile": string;
    "size": number;
    "split": string;
    "splitMode": string;
  }[];
}[];
"defaultTab": string;

The goal of tabs is to allow the auto-initialization of multiple tabs and panes and parameterize its behavior.

The property name should be any kind of unique identifier for the tab. It'd mainly be used by the defaultTab property pairing process but it could also be used with a switchToTab action keybinding.

The property index must decide the order of creation, both for tabs and panes.

The goal of defaultTab is to allow the customization of the initially selected tab. In other words, once all tabs have been initialized, automatically switch to the tab with name equal to defaultTab. If defaultTab is undefined, fallback to the last or first one.

I think that profile, size, split and splitMode properties details are quite self-explanatory from the Panes doc but I'll be glad to add its details too if needed.

dag03tsc avatar Jun 01 '21 04:06 dag03tsc

Hey everyone, I found this thread while intending to open a feature request for the Quake mode window, which I will just leave here as a user story.

I am using the FAR manager inside Windows terminal and as a FAR user, I would like to be able to configure the Quake mode window so that it covers the entire screen. I currently have ConEmu setup in this exact way; it allows me to switch between using FAR and other windowed applications very quickly and efficiently.

jhhcs avatar Jul 22 '21 11:07 jhhcs

@jhhcs FYI you don't need to use the quakeMode action to summon the window - you could always just configure the Terminal to launch in fullscreen mode, and rebind win+` to a plain old globalSummon action.

zadjii-msft avatar Jul 22 '21 13:07 zadjii-msft

Oh thank you for that hint, yes that works quite nicely. I then discovered that toggling fullscreen with Alt+Enter can also be used to switch the Quake window to full screen as an alternative solution to my problem.

jhhcs avatar Jul 23 '21 01:07 jhhcs

User story: I'd like to be able to have one quake window for WSL ZSH, and another for Powershell. This currently does not seem to be possible.

rnett avatar Sep 25 '21 03:09 rnett

@rnett For now, you could always just give the two windows different names, and bind two separate globalSummon actions for those different names. You'd be able to get the dropdown on each now, but not necessarily the "snap to the top half" behavior.

zadjii-msft avatar Sep 27 '21 13:09 zadjii-msft

With regards to tabs in Quake mode, that's what brought me here. Unlike the OP of #11085 I would prefer them on the bottom of the window to the top. Making this configurable would make sense to me, as would being able to toggle them on and off both as a default setting and also during a session.

EDIT: I just accidentally discovered that, if I hold Ctrl while tabbing, I get a vertical list of open tabs. This mostly solves my issue, good work. Is there a similar way of seeing the list of profiles when you're launching a new one?

EDIT AGAIN: I've answered my own question; Ctrl+Shift+Space brings up the profiles list.

si-kotic avatar Jan 22 '22 18:01 si-kotic

@si-kotic you may also be interested in following https://github.com/microsoft/terminal/issues/835

zadjii-msft avatar Jan 24 '22 16:01 zadjii-msft

Any updates on this? Having to toggle focus mode manually every time Quake mode starts is quite annoying. Feels like this issue is trying to bundle too many separate issues into 1 fix.

Sure, profiles would be nice, but that's more of a "feature" then a bugfix.

xorinzor avatar Jan 31 '23 08:01 xorinzor

yes I am confused why I got redirected here. This is a super simple request: launch a quake window with focus mode disabled. can't be done apparently, or does anyone have a solution?

I am not intesred in any of the other things being discussed, but the original ticket redirects here.

There is a -f switch to toggle focus mode on, why isn't there one to keep it off?

markusdd avatar Feb 01 '23 21:02 markusdd

Alright, I'm calling it for this hackathon, but progress notes from the week:

Latest branch was: dev/migrie/fhl-fall-2023/11162-quake-III-arena

Sample JSON

{
    "name": "_quake",
    "defaultProfile": "haunter.gif",
    "dockWindow": {
        "side": "bottom",
        "width": 0.3,
        "height": 0.75
    },
    "centerOnLaunch": true,
    "initialPosition": "",
}
  • Moving the window settings into their own object is tedious, but easy. Almost everything becomes a per-window setting.
  • Layering window settings is annoying. They'll work like
    graph LR
    
    uq[user: _quake]
    uf[user: foo]
    ub[user: base]
    dq([defaults: _quake])
    db[defaults: base]
    
    uf  --> ub --> db
    uq --> dq --> ub
    
    • We make a "virtual" window settings blob if the user asks for a quake window.
    • If the user does specify settings for the _quake window, then it'll still be applied on top of the "builtin" quake settings
  • If you don't use this at all, I don't think your settings will change at all[^1]
  • [ ] I don't have hot-reloading working
  • [ ] I don't have hot-renaming working
  • [ ] I don't have startupActions working
  • [ ] There are some other TODO!s I've left scattered.
  • I've added a new settings blob to per-window settings: dockWindow. These are for #11162 and #11174
    • side: which side to "dock" to
    • width & height: How big to make the window.
      • If >1, that value is treated as px
      • If <=1.0, that value is treated as a percent of the screen
    • It also combines with centerOnLaunch, to center the window on that side
    • [ ] It should warn if you set a value to <=0
    • [ ] It should maybe obey initialPosition if centerOnLaunch isn't set
    • [ ] It doesn't "dropdown" from the docked side
    • [ ] It's a few pixels off from the right position. I think the ncSize.height is bigger than I'm expecting.
  • [ ] This altogether does nothing for #12594. It probably should!

[^1]: an empty "windows":[] may be added.

zadjii-msft avatar Sep 14 '23 19:09 zadjii-msft

Quick tip for everyone, you can set it to open in quake mode, and then set a keyboard shortcut to disable focus mode. I personally use win+ctrl+f for this. The tabs will remain in view for the entirety of the process lifetime.

drannex avatar Nov 15 '23 17:11 drannex

Quick tip for everyone, you can set it to open in quake mode, and then set a keyboard shortcut to disable focus mode. I personally use win+ctrl+f for this. The tabs will remain in view for the entirety of the process lifetime.

Thank you this is very helpful

Squidyy avatar Mar 03 '24 21:03 Squidyy

Leaving my question here because it's related- I'm wanting quake mode functionality with a maximized window.

I've got a globalSummon action setup for a separate named _default window, with focus and maximized arguments. This mostly works (without the quake animation).

Is there a way to hide the taskbar icon when I've got this minimized, like the special _quake window does?

{
  "command": {
    "action": "globalSummon",
    "desktop": "toCurrent",
    "MaximizeAfterToggle": true,
    "dropdownDuration": 0,
    "monitor": "toMouse",
    "name": "_default",
    "toggleVisibility": true
  },
  "keys": "win+`"
  }

"startupActions": "wt --window _default -f -M \\; sp -V -s .666",

shookietea avatar Mar 05 '24 01:03 shookietea

It's not really a "basic feature". It requires a pretty massive re-write of how our settings are stored. You can take a look at the all-up diff in https://github.com/microsoft/terminal/compare/main...dev/migrie/fhl-fall-2023/11162-quake-III-arena. There are piecemeal diffs listed in the OP as well. If you're passionate, you're more than free to take that over the finish line.

You're also free to just use "globalSummon" instead of "quakeMode". IMO that's got quite a bit more flexibility. I honestly love focus mode, but don't care at all for the dropdown, so I just use globalSummon.

zadjii-msft avatar Apr 01 '24 11:04 zadjii-msft

You're also free to just use "globalSummon" instead of "quakeMode". IMO that's got quite a bit more flexibility. I honestly love focus mode, but don't care at all for the dropdown, so I just use globalSummon.

Is it currently possible to have "globalSummon" hide the taskbar icon when it is not visible?

shookietea avatar Apr 01 '24 14:04 shookietea

With these two settings, I'm pretty sure it is:

zadjii-msft avatar Apr 01 '24 14:04 zadjii-msft

Perfect! The animation is the lowest on my list, and wt is set up as I want now. Appreciate your support

shookietea avatar Apr 01 '24 16:04 shookietea

If you want the animation, just enable it. "action": "quakeMode" is just a "action": "globalSummon" with all parameters default except for "dropdownDuration": 200, and that the terminal treats it different like auto-enabling Fokusmode.

Thanks to this issue, I have the exact behavior I want now, because I always hated that in quakemode fokusmode was auto-enabled and size was not retained. Not that I learned about globalSummon I have exactly what I want where before I had to live with non-retained size and that on each terminal reatart I had to manually disable focusmode.

So just set "dropdownDuration": 200 for your command and you also have the animation back.

Vampire avatar Apr 01 '24 19:04 Vampire

That really begs the question if quake mode should be dropped for the sake of that settings combination (meaning the setting is actually retained but that is what it does internally.)

So that I do not have to piuece this together myself, does anyone have a complete config snippet that emulates quake mode fully through global summon without focus mode

markusdd avatar Apr 03 '24 22:04 markusdd

Unfortunately, adding "dropdownDuration": 200 doesn't work. When added to my command below, it causes the window size to be inconsistent after the first opening. It does add the animation, but breaks the behavior I want, which is full screen.

    {
      "command": {
        "action": "globalSummon",
        "desktop": "toCurrent",
        "MaximizeAfterToggle": true,
        "monitor": "toMouse",
        "name": "_default",
        "toggleVisibility": true
      },
      "keys": "win+`"
    }

shookietea avatar Apr 03 '24 23:04 shookietea

@markusdd maybe you should learn to read ;-) As I already said, just "action": "globalSummon" with all parameters default except for "dropdownDuration": 200 is doing that, even the documentation of quakeMode tells you the globalSummon equivalent.

And regarding

without stupid focus mode (that no one ever asked for, it's useless)

Just because you hate it and I don't like it, does not mean that no-one asked for it or that it is useless. Even in this issue there is proof of love for the focus mode and without it, it is not anymore that quake-like that it is now.

Vampire avatar Apr 04 '24 00:04 Vampire

I tried the quakemode equivalent of globalSummon and it doesnt have the quakebehavior if you dont give it the name _quake. But if you do, fockusmode is on again. Can we please have this as a seperate ticket?

Fuzzyma avatar Jun 12 '24 17:06 Fuzzyma