terminal
terminal copied to clipboard
Add `--pos`, and `--size` cmdline args
Summary of the Pull Request
Adds --pos
, and --size
commandline arguments to wt
.
PR Checklist
- [x] Closes #4620
- [x] CLA signed. If not, go over here and sign the CLA
- [ ] Tests added/passed
- [x] Documentation updated. If checked, please file a pull request on our docs repo and link it here: MicrosoftDocs/terminal#591
- [ ] Schema updated.
- [ ] I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #xxx
Validation Steps Performed
Manually tested using a combination of --pos
, and --size
.
I have written some commandline parsing tests, but didn't push them as TAEF is erroring out for some reason when running the localTerminalApp
test suite:
Summary of Errors Outside of Tests:
Error: TAEF: [HRESULT: 0x80070005] A failure occurred while preparing to run tests in 'TerminalApp.LocalTests.dll'. (Failed to load "F:\windows-terminal\bin\x64\Debug\TestHostApp\TerminalApp.LocalTests.dll" or one of its dependencies.)
It's done this to me in the past - when I was back on Windows 10. Upgrading to Windows 11 fixed it for a bit, then it started erroring again.
I'm (vaguely) worried about these, even though we have an open feature request for them. They specify what happens to a new WT window, but they don't control windowing semantics. So, if your settings are such that all invocations launch in the same window, you'll never see the impact of these args unless you add -w -1
to force the creation of a new window.
In addition, should we consider something more "all-in-one" like xterm's -geometry
(which takes an x11 geometry spec which looks like 100x300+30+10
or something?
AKA: It's three arguments, should it be one? Or maybe two? We perhaps incorrectly made it three different settings... but we don't need to repeat that mistake.
Thoughts? I know I'm just brain-dumping right now.
What you are suggesting certainly sounds more powerful. Especially if you allow it to change the location of an existing window. You could potentially open yourself up to malicious programs arbitrarily changing the position of your terminal, but I would imagine that's a low risk - it sounds more annoying than anything else.
Unless I'm reading it wrong, X's geometry spec seems a bit rigid compared to what terminal currently allows - i.e. you have to provide the complete specification or nothing. Maybe two arguments would be better - a position and a size? e.g. --position ,200 --size 10,
would give you something that's 200 pixels from the top of the screen and 10 columns wide.
I don't think that changing location of an existing window is natural. Are there any applications where this is implemented?
And I think it's reasonable to expect user to add -w -1
if he set a setting to launch all invocations in the same window.
Adding initialRows and initialCols as a single argument makes more sense to me when used this way. You're typically changing both anyways and if you only enter one of them, the other can just remain default. And now that we have semicolons working better, that can be used as the delimiter to determine which is which (rows first; cols) and yes still need -w -1
when manipulating the existing window. All these window positioning arguments can easily be scripted together with the other arguments to get the perfect custom setup so it's not a huge deal.
@DHowett it's been a couple of weeks since I opened this - have you/the team had any thoughts on what you'd like the command line args to be?
quick 5pm note:
-
--initialPosition x,y
: needs both, makes sense -
--size c,r
: needs both, accepts size in chars- (in the future, we can add
--size {w}px,{h}px
, where a literalpx
would disambiguate between px and chars. And it could be--size {w}px,r
- (in the future, we can add
--initialPosition x,y
: needs both, makes sense
I'd go further and call it --pos
; thoughts Mike?
Sorry for the delay @ianjoneill!
I'd go further and call it
--pos
; thoughts Mike?
sure
I've updated the cmdline args as per your suggestions.
We're now in the slightly weird situation where this is documented, but not merged!
https://learn.microsoft.com/en-us/windows/terminal/command-line-arguments?tabs=windows
paging @PankajBhojwani into the OR
Since this has two approvals, merging.
@msftbot merge this in 5 minutes
EDIT: ok, I'll just add the automerge label then.
EDIT2: huh, the bot acknowledged the automerge label then didn't merge it!
Hello @carlos-zamora!
Because this pull request has the AutoMerge
label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.
p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot
) and give me an instruction to get started! Learn more here.
:tada:Windows Terminal Preview v1.17.1023
has been released which incorporates this pull request.:tada:
Handy links: