Welcome!

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

SignUp Now!

Detect Windows Terminal

What am I supposed to see in that picture? What did you minimize? What did you restore?
The black border of the "activated" window. You can see all 4 sides of the empty window here, though the left side is pretty much the same as the background [steam]. You can see the Maximize and Close buttons at the upper right (just above and to the right of the Marvel Snap logo).

Screenshot probably woulda worked better with a white background

What I did? I minimized a TCC window then restored it with activate like you demonstrated here, except with "activate restore".

It's something I used to do all the time to bring a minimized command line to front if it asked me a question (i'd restore the window prior to displaying a prompt). I might have a long process that takes minutes/hours/days to run and asks something at the end. I would use 'window restore' to bring the window back. Or I would have a monitor that doesn't bring a command line back until a subordinate program it calls closes (example vlc.exe for vlcplayer. I usually launch that from CLI. After i'm done watching the show, i want that CLI to come back to front).

This doesn't work with the window command, and is something I've missed in the year or two since I've switched to Windows Termnal.

yea, it doesn't work with activate either. Well it does, but it doesn't. The "window" is restored, but nothing is in it and it's not usable. Kinda makes sense, since with multi-tabbing how would we even restore just one tab? We'd have to restore all of Windows Terminal and then also technically move to the right tab.

It's still a neat trick though. It's more than the window command could coax out of the situation. And I'll look to this for other activate commands, but so far the only one "missing" with the migration to Windows Terminal, which i actually use, is 'window restore'. I used 'window maximize' and 'window minimize' sometimes but it's the 'window restore' that was always most useful to me in past decades.
 
I don't think TCC could do that even if it tried. It's windows's job to redraw windows. Are you in Windows 11? WT uses a new-ish windowing technology. I can't reproduce that on Windows 10.
 
TCC did it fine outside of Windows Terminal for at least a decade. But yea, inside of WT. Much harder.
 
Claire, do you have any tool with which you can get the HANDLE (as a decimal number) of WT's window? I can minimize/restore WT's window by using TCC to call the very basic Windows function ShowWindow, like this (20253644 is my WT window's HANDLE, yours will no doubt be different, 6 is minimized, 1 is normal).

Code:
echo %@winapi[user32.dll,ShowWindow,20253644,6] & delay 1 & echo %@winapi[user32.dll,ShowWindow,20253644,1]

I'm curious if it works better than ACTIVATE for you. It works here on Windows 10.
 
I use WinSpy for that purpose, and it gives a diff handle for the TCC contents than it does for the non-TCC parts of WT. But alas, neither seem to work for me with the ShowWindow stuff


1712295660326.png
 
The window you want is the "CASCADIA_HOSTING_WINDOW_CLASS" class window. And for @WINAPI, the handle needs to be decimal. It looks like WinSpy gives hexadecimal handles.
 
But it would be different every time, so I don't really see how this method could be generalized. Ugh.
 
But it would be different every time, so I don't really see how this method could be generalized. Ugh.
Of course the handle will be different in another instance of WT. But it's constant in a given instance. The title of that window changes as the active tab/pane changes. With plugins (WHICHWIN, _HWNDWT), I can get it like this.

1712763892025.png


or like this.

1712764023156.png
 
Interesting. I'm just not sure how to make a command line version of "restore this window" though. Like, i can't deduce it from the thread how I can help make what I want happen. Maybe I'm just confused.
 
Again, using the plugin _HWNDWT, this minimizes and restores it. I should probably make _HWNDWT return a decimal number; that would make this simpler (no @EVAL). If you want to use @WINAPI and ShowWindow you have to know the handle of the window.

Code:
echo %@winapi[user32.dll,ShowWindow,%@eval[%_hwndwt],6] & delay 1 & echo %@winapi[user32.dll,ShowWindow,%@eval[%_hwndwt],1]
 
I don't publicize it. You can get it with this.

Code:
copy ftp://vefatica.net/4plugins/x64/4wt.zip

The attached file gives the help for its exported commands, variables, and functions.

It does a couple other things to make TCC get along better with WT.

It makes the PseudoConsoleWindow "message_only". That prevents it from being shown (believe me, you don't want to see it). TCC sometimes tries to show it thinking it's a console window.

It makes the PseudoConsoleWindow follow WT's window in size and location. That helps TCC size/locate popups and the OPTION dialog (again because TCC uses it thinking it's a console window).

I have been using it for a few years without problems.
 

Attachments

  • 4wt.txt
    3.1 KB · Views: 3
OMG IT WORKS!!!!!

(If it's maximized, it restores non-maximized)

I have 4 screens. Sometimes I forget about something and need it to call itself to my attention. This has helped a lot, 1990-2020ish, but Windows Terminal killed it.

And you resurrected it! Wooo!

I take it i'm not supposed to put this DLL on my github. I'll make my code adjust itself for its presence,... :)

Thank you sooooooooooooooooooo much! This is really really awesome!

I'm going to update my 'window restore' command to do this instead! So happy about this ! thank you for your pateince!!!!!
 
(If it's maximized, it restores non-maximized)
3 (vs. 1) in the ShowWindow function will make it maximized (vs. normal). I'm not sure how to get the current state with @WINAPI.

I'll experiment with a WTWINDOW MIN | MAX | RESTORE command in 4WT and keep you informed. Try the ruler and line numbers (Ctrl-R and Ctrl-N). See wthelp *keyhandler.
 
The ruler/line numbers are neat!!!!!!! :)
 
Hey @vefatica, do you know how I can prevent 4wt.dll from overriding Ctrl-Delete? That's my word-delete character. I use it a lot. End effect is i keep typing complicated command lines, try to delete a word, and lose the whole thing.

Also, Ctrl-L now clears the screen, and i definitely don't want that (tho i appreciate the nod to the telnet days)

Are there.. other keys that might also be overridden?
 
The only keys 4WT processes are those mentioned in wthelp *keyhandler. They can't be overridden. I'll get rid of Ctrl-L (I never use it). I'll also get rid if Ctrl-Shift-Del (never use it either) and change the Ctrl-Del one to Alt-Del (I use that one a lot).

I also have these working in a new 4WT.

Code:
v:\> help _winstate
one of NORMAL, MINIMIZED, MAXIMIZED, HIDDEN

v:\> help wtwindow
WTWINDOW NORMAL | MIN | MAX | HIDE

I'll make it available, probably tomorrow. Right now I'm working on something you mentioned.

(If it's maximized, it restores non-maximized)

I see the same thing if I do it with my code. I'm looking for a workaround.
 
This is soooooooo amazing.

I wish I'd found this forum decades ago (wonder when this forum was created?).

I actually started using TCC when it was NDOS.COM and part of Norton Utilities.
 
This forum (using XenForo) was created in May 2008. I don't remember what it's immediate predecessor was, but if you go back far enough, the product was called 4DOS (after that, 4NT) and discussions like these were on usenet (comp.os.msdos.4dos).
 
This forum (using XenForo) was created in May 2008. I don't remember what it's immediate predecessor was, but if you go back far enough, the product was called 4DOS (after that, 4NT) and discussions like these were on usenet (comp.os.msdos.4dos).
Oh usenet! That makes sense!

The name lineage is NDOS.com (from Norton Utilities) -> 4DOS.com -> 4NT.exe -> TCC.exe

I started in 1988 when it was NDOS. I think I pirated Norton Utilities on the sneakernet floppy-disc piracy ring in my middle school and just had to run all the utilities to see what they were, and the TAB-filename-completion impressed me so much. I'm laughing because filenames were 8.3 back then, so tab-completion didn't save you nearly as much :)
 
I don't think NDOS is related to JPSoft products.

4DOS was the original. NDOS was a licensed, somewhat hacked-up offshoot bundled with the Norton Utilities. Useful, in its day, but it was a very early version and I don't think it ever got any updates.
 
A new build of 4WT is available. It has the changes I mentioned.

copy ftp://vefatica.net/4plugins/x64/4wt.zip
 
4DOS was the original. NDOS was a licensed, somewhat hacked-up offshoot bundled with the Norton Utilities. Useful, in its day, but it was a very early version and I don't think it ever got any updates.

Guess I learn something new every day! :)
 
A new build of 4WT is available. It has the changes I mentioned.

copy ftp://vefatica.net/4plugins/x64/4wt.zip
Works beautifully! Thank you so much!
 
A new build of 4WT is available. It has the changes I mentioned.

copy ftp://vefatica.net/4plugins/x64/4wt.zip

Well. I have some good news, and I have some badnews.

The good news is.. it works awesome.

The bad news is... Any time you click back into a maximized WT/TCC window ... even one that opened maximized and never had another state ... It un-maximizes. If and only if the plugin is loaded. Behavior stops if you unload the plugin.

[I mostly use maximized windows because i have 4 screens covering 29 sq ft, so it's usually one-thing-per-monitor]
 
It un-maximizes. If and only if the plugin is loaded.
Thanks for that. I couldn't figure it out. I just made a new one available. It shouldn't do that.

copy ftp://vefatica.net/4plugins/x64/4wt.zip

I was trying to work around this problem: when you open the OPTION dialog, then close it, you get the busy mouse pointer and WT no longer has focus.
 
Sweet! It works! Thank you sooooo much!
 
Back
Top