Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

TCC does not pass focus to applications launched by TCC from Windows Terminal

May
97
2
I am becoming rather fond of Windows Terminal, I'm running the latest preview under Windows 11. I have it setup to run CMD, CMD as Admin, Powershell, the latest Powershell Preview, Ubuntu (WSL), and, of course, TCC. When I launch an application (Notepad, for instance) from TCC inside WT, the launched application does not receive focus, the focus stays with the TCC window inside WT. This does not happen with CMD or Powershell or Ubuntu. And it does not happen when I'm running TCC from Conhost or TCMD. Any ideas how to fix this?
 
It works OK here with TCC v28 in WindowsTerminal ... always has. Are you using an old TCC?
 
"ver" returns:
TCC 28.02.18 x64 Windows 11 [Version 10.0.22000.708]


Windows Terminal Preview
Version: 1.14.1452.0
 
That's exactly my setup. I don't think WT could affect that if it tried. And I don't know to make TCC do that. Is your WT command line for TCC peculiar in any way? Are you simple typing "notepad" at the prompt? Does it happen with all GUI apps?
 
It happens with all applications that launch in their own window, the new window does not get focus. And yes, simply typing "notepad" at the prompt causes this behavior.

{
"commandline": "C:\\TCMD\\tcc.exe",
"guid": "{61c54bbd-c2c6-4271-96e7-119a87ff43bf}",
"hidden": false,
"name": "JPSoft TCC"
},
 
OK, thanks. I'm at a loss. I don't think I could make TCC or WT do that if I tried. Maybe others will have ideas.
 
Works as expected here. However, I'm using a release version of Terminal: 1.12.10982.0. If this only happens in the preview version, then it's probably a bug which should be reported to the Terminal team.
 
I mentioned it in the git-hub forum. Dustin Howett's initial response was that windowing changes were made in 1.14; he asked for versions, which I posted. I'm waiting/hoping for a further response.

Charles, WT release version 1.13.11431.0 is available.
 
FWIW, ....0 is what WT calls the "StoreVersion". Depending on access to the file you might be able to get a "BinaryVersion" (which seems more revealing) like this (below). I have no access problem because I install (to d:\wt and d:\wtp) by simply unzipping. My (recently edited) VER.BTM contains

Code:
set xmlfile="%[wtpath]buildinfo.xml"
set wtver=%@xmlgetattr[%xmlfile,BinaryVersion]

It reports

Code:
TCC 28.02.18 x64
Microsoft Windows 10 Pro for Workstations
10.0.19044.1706 (2009, 21H2)
WindowsTerminalPreview 1.14.2205.23002
 
<BuildInfo BinaryVersion="1.14.2205.25002"
SemanticVersion="1.14.220525002-preview"
StoreVersion="1.14.1452.0"
BuildDefId="unknown"/>
 
Okay, mystery solved. It is definitely the Windows Terminal Preview. I navigated down to

C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.12.10983.0_x64__8wekyb3d8bbwe

and from there ran

wt c:\tcmd\tcc.exe

That instance behaved in the way I expected, when I launch Notepad, focus goes to the newly created Notepad window.
 
Where did you get 1.14.2205.25002? The latest available on GitHub is 1.14.2205.23002.
 
I installed "windows terminal preview" from the Microsoft Store. My understanding is that once you do that, you will automatically get any new previews when they are released.
 
I installed "windows terminal preview" from the Microsoft Store. My understanding is that once you do that, you will automatically get any new previews when they are released.
So the store is ahead of GitHub! I always get the latest two (release/preview) from GitHub and install by simply unzipping to the locations of my choice.

I have to wonder if your 1.14.2205.25002 (vs. my 23002) is the culprit. I mentioned the 23002/25002 discrepancy in the WT forum. There has been no further comment.
 
@ohenryx, in an attempt to rule out (most of) your TCC configuration, can you try this?

Code:
[path_to]\wt.exe nt [path_to]\tcc.exe /ii

That should start TCC in a new tab without processing your TCMD.INI file. See how notepad fares there.
 
Okay, that worked. I did a quick comparison of the values shown by "OPTION" command, and the main difference was this:

GlobalAliases=No
GlobalDirHistory=No
GlobalFunctions=No
GlobalHistory=No
HistLogOn=No
LocalAliases=Yes
LocalDirHistory=Yes
LocalFunctions=Yes
LocalHistory=Yes

The defaults are for Global = Yes, Local = No. I have changed that to Global = No, Local = Yes

If I shift back to Global from Local in my TCMD.INI file, then the problem goes away in Windows Terminal Preview.

I often have multiple tabs for TCC in WT, and I like to have different history in each to scroll back through.
 
That's odd. I wouldn't expect any of those options to make a difference. All my GLobals are Yes and all my Locals are No and I don't see a problem. If I reverse all those settings I still don't see a problem.
 
Okay, forget everything I said previously, it appears that I was overlooking something. It now appears that the FIRST tab in Windows Terminal Preview exhibits the problem. I have things set so that any shell type application (TCC, CMD, Powershell, Powershell Preview, or Ubuntu Bash will open in Windows Terminal Preview. And whatever I start first has the problem that focus stays in that tab when a separate program is launched. Anything that I launch in a new, separate tab, does not have the problem.

I was misled by the fact that I always start TCC first, as it is my most used shell type application. From there, I start CMD or PowerShell, as needed, in a separate tab. My apologies for the confusion.
 
So WTP is your default console app handler (instead of conhost), right? I don't think I can do that with Windows 10 and not being an insider.

I've called attention in the WT forum to your post #18. They'll be interested.
 
I found the thread on Github, and posted a rather long winded explanation there. The problem is most definitely with WT preview, and not TCC.
 
@ohenryx, are you following on GitHub? You're report started quite a discussion, a new thread (most of which I don't understand), and apparently a fix.
 
Yes, I have been following the thread. Looks like they have a fix, but I'm guessing we will have to wait for the next preview release to see that fix. No big deal, just an annoyance. I kinda sorta understood in a vague way what they were discussing, but definitely not all of the details.
 
"This release of Windows Terminal Preview, 1.14.145, was made generally available on the 26th of May, 2022"

My version shows:
Windows Terminal Preview
Version: 1.14.1452.0

And it still has the bug.
 
Today there is a new version of Windows Terminal Preview available on the Store. 1.15.1863.0, and yes, it does fix this problem with focus.
 

Similar threads

Back
Top