terminal
terminal copied to clipboard
Quake window responds poorly to `SW_MINIMIZE` coming through ConPTY
Windows Terminal version
1.22.10731.0
Windows build number
10.0.19044.0
Other Software
No response
Steps to reproduce
Start Windows Terminal with the following command: wt.exe -w _quake pwsh -window minimized
Expected Behavior
The Terminal opens in Quake mode, then minimizes itself. No other windows appear on the screen.
Actual Behavior
The Terminal does open in Quake mode, minimized. But then there is a very small (presumably empty) window in the bottom-left corner of the screen.
This happens on both Windows 10 Enterprise LTSC and Windows 11 Pro. My assumption is that Terminal needs this window to exist, but it's supposed to be outside the screen boundary?
Are you by chance using any shell modifications/?
I do not have any shell modifications on either device, as far as I can tell. That said, this does not occur with CMD, so I tried reinstalling PowerShell but the window still appears.
Running PowerShell in Console Host doesn't trigger this, so I'm unsure if it's a PowerShell issue or a Terminal issue.
I'm experiencing this, too. Though I'm starting wt from task scheduler on login.
I'm using
%LOCALAPPDATA%\Microsoft\WindowsApps\wt.exe -w _quake pwsh -nologo -window minimized -NoExit -Command "& { . $env:OneDrive\Dokumente\PowerShell\profile.ps1 }"
to launch.
If I have the quake mode window visible and then single click the grey area then something like a program's system menu pops up in the top left corner of my desktop - it'S the same menu I get when I right click in the free space of the wt tab bar
If the quake mode window is not visible and I single click the grey area the nothing seems to happen.
If I double click it, then the quake mode windows opens and the grey area vanishes.
I can the hide the quake mode window with the key binding of my choice
This behaviour was not always so. In one of the older releases this grey area wasn't there - or if it was it was outside the visible desktop area. That should have been about 6 to 9 months ago
I do experience this behaviour on my own pc as well as my office pc so I guess I can reproduce the issue
A-ha!
So, PowerShell is minimizing its "console window," and we don't take kindly to that. We probably should.
In the meantime, if you remove -windowstyle minimized from your pwsh command line and instead set it in task scheduler itself:
does that work?
... if not, how about -windowstyle hidden?
My observations:
- The task option "hidden" doesn't work
- "-windowstyle hidden" does work if I supply it as argument to pwsh like
wt -w _quake pwsh -nologo -windowstyle hidden -NoExit
That doesn't allow me to use my wt profiles - neither implicitly the default profile nor explicitly any other
wt -w _quake -p "my profile" -windowstyle hidden
That expectetly throws an error as "-windowstyle hidden" is a parameter to pwsh and not to wt:
My ultimate goal is to start my (default) profile in quake mode at startup and have that initially hidden so I have quick assess to it with the hotkeys I bound
Perhaps this?
wt -w _quake -p "my profile" --appendCommandLine -- -WindowStyle Hidden
It's a mouthful, but it works over here.
Not much luck over here. If I do it this way I do get a running terminal - but it is CMD not pwsh.
It looks like an instance of CMD was dynamically generated from my default settings, and windowsstyle got completely ignored.
My actual profile I tried to invoke should have been a pwsh based profile.
My literal invocation is
wt -w _quake -p "PS7-Stable ITCO" --appendCommandLine -- -WindowStyle Hidden
There's no difference betwenn running from WIN+R and running from task scheduler
This profile is defined as
{ "backgroundImage": "%OneDriveConsumer%\\Bilder\\web\\rudi_outline.png", "commandline": "C:\\Program Files\\PowerShell\\7\\pwsh.exe", "cursorShape": "vintage", "guid": "{2aef55bd-f481-4f60-8b21-58c0b5cd857b}", "hidden": false, "icon": "%OneDriveConsumer%\\Bilder\\Icons\\256\\rudi_outline.png", "name": "PS7-stable ITCO" }
whereas my defaults are
{ "antialiasingMode": "aliased", "backgroundImage": "%OneDriveConsumer%\\Bilder\\web\\terminal-256.png", "backgroundImageAlignment": "bottomRight", "backgroundImageOpacity": 0.1, "backgroundImageStretchMode": "none", "closeOnExit": "automatic", "colorScheme": "Tango Dark", "cursorColor": "#FFFFFF", "cursorShape": "bar", "experimental.retroTerminalEffect": false, "font": { "face": "FiraCode Nerd Font", "size": 10 }, "historySize": 20000, "opacity": 75, "padding": "0, 0, 0, 0", "snapOnInput": true, "startingDirectory": "C:\\repos", "useAcrylic": true }
Am I missing something? I'll be AKF for a few days. I'll get back in touch afterwards.
Perhaps this?
wt -w _quake -p "my profile" --appendCommandLine -- -WindowStyle HiddenIt's a mouthful, but it works over here.
Can confirm this works on my machine.
I used the stock PowerShell 7.5.1 profile so my command was wt -w _quake -p "PowerShell" --appendCommandLine -- -WindowStyle Hidden.
The one that works for me:
To start powershell: wt.exe --window "_quake" powershell -window hidden
To start cmd (opens it kinda in powershell tab): wt.exe --window "_quake" powershell -window hidden cmd
This way it doesn't spawn minimized window bug. Also works through autostart shortcut.
Antonio's comment about using a stock profile gave me something to think about.
The stock profile is basically just this:
"guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}", "hidden": true, "name": "PowerShell", "source": "Windows.Terminal.PowershellCore"
As Antonio found this does work as I want it to.
It still should work when using the commandline parameter but doesn't I'm somewhat dependent on that as I have almost 20 profiles tailored to my various use cases. The source parameter and the default GUIDs are insuficient for most of my profiles
So, this is one place where the settings UI makes it easier to handle. You don't want to replace the source (that's how Terminal knows that this profile was auto-detected, and where it came from!) but rather to get the existing commandline and append to it.
If you open up the settings page, you can see exactly what it's set to and update it there.
I was about to write a lengthy reply and report what I experienced in the last two hours of testing when I apparently stumbled over the solution: The value following wt -w _quake -p is case sensitive.
For whatever reason my profile was named
PS7-stable ITCO
whereas I used
PS7-Stable ITCO
as value to the profile parameter when invoking wt
Don't know if this is a historic discrepancy, a mishap, a typo, ... on my part but the correctly cased s/S did the trick.
Retrospectively the strings are extractly show that way in my last post on June 6th.
Can anyone independently verify this?
Regarding the case sensitivity nothing is mentioned here https://learn.microsoft.com/en-us/windows/terminal/command-line-arguments @DHowett If my finging is correct, can you update the documentation on that site to spare everybody else this potential trap?
Argh! I even tested that!
I just realized that my test failed to reproduce the failure because it chose my default profile when it couldn't find all-lowercase powershell, and PowerShell when it found PowerShell.
It just so happens that my default profile is ... PowerShell. 🤦🏻
@DHowett with the correct and case-sensitive spelling of the profile I'm quite happy how it now works as I want it to. One question came up though:
This https://learn.microsoft.com/en-us/windows/terminal/command-line-arguments?tabs=windows
doesn't have all the command line arguments there are. At least this is missing:
--appendCommandLine --
Is there more documentation I can read?