-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add command-line option start terminal minimized #7374
Comments
I thought |
@zadjii-msft, @KalleOlaviNiemitalo, @jarpoole - does the behavior where the terminal is open and then is immediately minimized work for you? I have a PoC for something like this and wondering if I should productize it or abandon 😄 |
@Don-Vito, how do you "immediately" minimize it? When I first quit Windows Terminal Preview 1.4.2652.0 and then repeatedly click the button that I have pinned to the task bar, the window doesn't lose its title bar. There is the |
Or did you mean you have modified Windows Terminal to add a feature that minimizes the window immediately after opening? |
@KalleOlaviNiemitalo - yes, I wrote a proof of concept solution that allows you to run "wt -m" or "wt --minimized" or "wt --minimized --focused" (what you actually see in the gif above). However to implement this, I first allow the window to render fully with default dimensions and only then send a "minimize" signal (very similar to how full screen is implemented). First I tried to implement this by starting with a minimized window, but then restoring to the default size created it with the wrong dimensions, so I fallbacked to this solution. There is not much code there - here is the PR: Don-Vito#3. My question is whether this satisfies your need and worth trying to push this upstream. |
@zadjii-msft - do you want me to productize it as is (screen is open on startup and then is immediately minimized)? |
I guess when I'm imagining this, the window doesn't even flash on the screen. I could see there being difficulties with that though - is there any way for us to like, cache what the initial launch size should be, and immediately resize the window to that size when it's first restored from launching minimized? I guess if there's not, then this is a good enough solution to start with, and we could always leave the door open for the possibility of figuring it out in the future. |
@zadjii-msft - you are absolutely correct that this should be the approach - compute the desired size, cache it and start minimized. I am sure we can make it working, but still don't know how 😄. The question is whether we want to push the silly solution I did, as sort of a temporary solution, until we solve it correctly. |
Another hack could be to make the window initially normal-size but hidden (SW_HIDE), then minimize it after it has been initialized. However, I don't know how feasible that is with the UI libraries that Windows Terminal is using; and if there were a problem during initialization, then the window might remain hidden and the user would not know that the process still exists. |
Any update on this? Would love to see it |
Hi, with an parameter -min or what ever you can keep the pane open as default… Cheers |
Note to self: For the minimized start mode, we might be able to use the DWM Cloaked thing to hide the window entirely when it's first being started up. That would let us create the window with a real size and position, and then minimize it, then uncloak it so that it can be restored to the correct size, already initialized. |
I use the quake mode a lot (via hotkey), but the quake hotkey doesn't work unless the terminal is already running - so I always have to start the terminal first before being able to quake it, which is really annoying. Having the terminal launching minimized upon machine startup solves this issue. |
Would like to second that. We would like to use quake mode as our daily runner, with the zsh available on demand via hotkey, not having to start the terminal application. Best option would be, in my honest opinion:
|
I'm getting pushed away from using quake mode thanks to not being able to start it minimized, thanks EDIT: I found out I can run a shortcut (.lnk) from task scheduler, now I have it auto start with windows and it's minimized. |
What is the shortcut/parameters, you are launching |
create a new link with to target wt.exe (I have windows terminal installed from microsoft store): once you created it, right click, properties, where it says Run select Minimized from the dropdown list then in task manager, actions: start a program: then in Add arguments/parameters you add /c and the path to the link, mine looks like this: triggers: and I checked the box "run with highest privileges", so I can have quake mode as admin my settings for windows terminal: if I ever want to have a non admin terminal I just have windows terminal to taskbar anyways, for whatever else I use quake terminal |
Unfortunately on my system, this doesn't work. I try an launch the shortcut and it causes an error to occur when launching PWSH. For some reason it works fine when I disable the start minimised in the shortcut. Is this some sort of bug? |
no idea, haven't had any issues |
I get this error. |
Ah, ok, I figured it out. Just to let you know, you REQUIRE elevated access when launching PowerShell in this manner. Weird... It could be a security thing to stop consoles from just appearing minimised to prevent bad actors from using them in secret. |
you forgot to click "run with highest privileges" checkbox in task scheduler? |
I didn't want to launch it elevated by default since I'm pretty security conscious. Unfortunately, there is no other way I can find to not have to elevate its perms. This really needs to be a built-in feature to prevent stuff like this from occurring. I feel like that way, the terminal will become more integrated with the system. |
yeah it's just weird why they have Maximized, Full Screen, Focus and Miximized focus, but not Minimized as Launch modes for startup for almost 2 years and a half.... |
I mean, higher up in the thread pretty much explains why We might be able to do |
I can help you can ping me if needed |
I've left notes in #13811 (comment) 😉 |
Is there a way to start the terminal in focus mode only for a batch file? |
Thanks for the solution; just a minor correction: "...then in task |
I'd recommend https://github.com/gerardog/gsudo to elevate single commands or terminal instances. I use it all the time, and never start whole Windows Terminal as admin (I avoid admin privileges when I can). It should work well with the mentioned workaround. Nonetheless, having a native minimized startup would be nice to have. |
FWIW |
How exactly is one supposed to run this bit of code |
e.g. as a script or a link. You simply input the command. [Edit] Just saw the trouble. Invoke a cmd-shell. simple add |
it kind of does the job, but the terminal that opens is like 2% of my screen size for some reason |
i think the command will be implemented in 1.18 |
Check here: Post with fix I asume, it looks something like this when you try There is a bug in versions up to 1.17 in follow szenario:
in this case the quake terminal is not resized to the 2nd screen, until you move the open terminal once to the 1st screen via short-cut Shift-Win-Curesor[Left/Right] and back. Currently you can find the Preview of 1.18 here.. Or you waite, till the wt-update is deployet via windows update. Cheers. |
Why does Phone Link app has option for launching minimised to tray and Windows Terminal doesn't? |
Description of the new feature/enhancement
Currently command-line options for launching the windows terminal in maximized and full screen modes are available (-M and -F respectively). Notably, an option of launching minimized is missing.
I use windows task scheduler to start a variety of scripts at logon to insure my build environment is brought up to date the second I logon. Having the output of these scripts display in an interactive terminal is extremely helpful. However when I start my computer and I am not quite ready to work I must interact with the windows terminal to minimize it. A minimize flag in the command line options would solve this issue.
The text was updated successfully, but these errors were encountered: