Ctrl+clicking on profile in dropdown to open as adminstrator launches it twice (opens two windows), with a random mix of two profiles #18037

Open
opened 2026-01-31 06:02:02 +00:00 by claunia · 3 comments
Owner

Originally created by @vertigo220 on GitHub (Jul 25, 2022).

Windows Terminal version

1.14.1962.0

Windows build number

Version 21H2 (OS Build 19044.1826)

Other Software

No response

Steps to reproduce

Click down arrow next to new tab button
Ctrl+click a profile to run it as admin

Expected Behavior

One window of the selected profile should open as admin

Actual Behavior

Two admin windows open, sometimes both as the selected profile, sometimes one as the selected profile and one as another. It's always either cmd or PS for me, even though I have the default Azure shell as the third option, so not sure why that one's not being opened. I can only assume because I've never run one before. As a test, I ran one, then tried it, and it still didn't open one (though I only tried once or twice), then I opened a new Azure window as admin and closed it and tried again, and then I started getting them in the random mix. I then closed the Azure tab thinking maybe it only used currently open tabs, and after several attempts I didn't get any more Azure windows, but I also seemed to stop getting PS ones (so just double cmd windows each time). But after ctrl+clicking on Azure and closing the windows that opened up, I started getting them again. Also, I didn't have any PS tabs open throughout all of this (did earlier, but they've been closed for a day or two), so it's not using current tabs.

Originally created by @vertigo220 on GitHub (Jul 25, 2022). ### Windows Terminal version 1.14.1962.0 ### Windows build number Version 21H2 (OS Build 19044.1826) ### Other Software _No response_ ### Steps to reproduce Click down arrow next to new tab button Ctrl+click a profile to run it as admin ### Expected Behavior One window of the selected profile should open as admin ### Actual Behavior Two admin windows open, sometimes both as the selected profile, sometimes one as the selected profile and one as another. It's always either cmd or PS for me, even though I have the default Azure shell as the third option, so not sure why that one's not being opened. I can only assume because I've never run one before. As a test, I ran one, then tried it, and it still didn't open one (though I only tried once or twice), then I opened a new Azure window as admin and closed it and tried again, and then I started getting them in the random mix. I then closed the Azure tab thinking maybe it only used currently open tabs, and after several attempts I didn't get any more Azure windows, but I also seemed to stop getting PS ones (so just double cmd windows each time). But after ctrl+clicking on Azure and closing the windows that opened up, I started getting them again. Also, I didn't have any PS tabs open throughout all of this (did earlier, but they've been closed for a day or two), so it's not using current tabs.
claunia added the Issue-TaskProduct-TerminalArea-Quality labels 2026-01-31 06:02:02 +00:00
Author
Owner

@zadjii-msft commented on GitHub (Jul 25, 2022):

More or less, I'm guessing this is due to reusing the tabs from last time. Admittedly, the repro steps here aren't the most precise, so I can't break it down exactly what's happening. Restoring the previous windows from last time uses a separate set of windows for both elevated and unelevated instances of the Terminal. So opening an elevated window, opening another tab in there, closing the window, then ctrl+clicking on a profile will open two windows - the two tabs from before, and a new window for the newly-created profile.

I'll admit, it's not the most ergonomic experience. I run into this pretty regularly myself, I usually have one window for admin stuff, but then use ctrl+click to spawn an elevated instance and end up with two admin windows. There's no good way to say "I want to restore previous instances, but not for elevated windows". Nor is there a good way to say "just open up an elevated terminal window (or the set of elevated windows from before" (Though, that could be tracked by #12191)

@zadjii-msft commented on GitHub (Jul 25, 2022): More or less, I'm guessing this is due to reusing the tabs from last time. Admittedly, the repro steps here aren't the most precise, so I can't break it down exactly what's happening. Restoring the previous windows from last time uses a separate set of windows for both elevated and unelevated instances of the Terminal. So opening an elevated window, opening another tab in there, closing the window, then ctrl+clicking on a profile will open two windows - the two tabs from before, and a new window for the newly-created profile. I'll admit, it's not the most ergonomic experience. I run into this pretty regularly myself, I usually have one window for admin stuff, but then use ctrl+click to spawn an elevated instance and end up with two admin windows. There's no good way to say "I want to restore previous instances, but not for elevated windows". Nor is there a good way to say "just open up an elevated terminal window (or the set of elevated windows from before" (Though, that could be tracked by #12191)
Author
Owner

@vertigo220 commented on GitHub (Jul 25, 2022):

That still doesn't explain why it's ~50/50 whether it opens two windows of the same shell or one window of the selected shell and one of another.

Maybe because I'm running on minimal sleep, but it took me a couple reads to figure out what you were saying is causing this. That certainly makes sense, and I understand the problem, more-or-less, but it's not only an annoyance but it appears to be a bug, hence why I submitted it, and I worry it will cause others to waste time searching and/or posting about it.

At the very least, there should probably be a warning in the tooltip about this behavior, but I wonder, if you can't use different "restore previous session" settings based on admin or non-admin, what about based on whether Terminal is already running, i.e. if it's the only instance running, it restores the previous session, but if it's a child process of the first, or just not the only instance, it doesn't. Alternately, if a new window is launched, as in the case of running a shell as admin, it could open it as part of the previous session, so instead of two windows you'd get one window with two tabs. And as a possible option to that, if the previous session was only one tab, an assumption could be made that it's not actually a session but just a single window that was opened then closed, and wasn't intended to be saved.

@vertigo220 commented on GitHub (Jul 25, 2022): That still doesn't explain why it's ~50/50 whether it opens two windows of the same shell or one window of the selected shell and one of another. Maybe because I'm running on minimal sleep, but it took me a couple reads to figure out what you were saying is causing this. That certainly makes sense, and I understand the problem, more-or-less, but it's not only an annoyance but it appears to be a bug, hence why I submitted it, and I worry it will cause others to waste time searching and/or posting about it. At the very least, there should probably be a warning in the tooltip about this behavior, but I wonder, if you can't use different "restore previous session" settings based on admin or non-admin, what about based on whether Terminal is already running, i.e. if it's the only instance running, it restores the previous session, but if it's a child process of the first, or just not the only instance, it doesn't. Alternately, if a new window is launched, as in the case of running a shell as admin, it could open it as part of the previous session, so instead of two windows you'd get one window with two tabs. And as a possible option to that, if the previous session was only one tab, an assumption could be made that it's not actually a session but just a single window that was opened then closed, and wasn't intended to be saved.
Author
Owner

@zadjii-msft commented on GitHub (Aug 11, 2022):

note to self: when we get to a quorum for discussion again, refer to comments in #13306

@zadjii-msft commented on GitHub (Aug 11, 2022): note to self: when we get to a quorum for discussion again, refer to comments in #13306
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#18037