Welcome!

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

SignUp Now!

grab focus back?

Jul
256
6
Is there a command that can grab focus back? Sort of like "window restore"?


I'm trying to do things I shoudln't do, basically, use windows terminal panes to spawn subprocesses instead of the start command. But it's a keypress-driven interface to open a new pane, and the new pane grabs focus. I've succesfully automated the keypresses to return focus, but if I call this too many times in a row, too fast, there's no real state tracking, and the focus just doesn't return right. If I could have a command to grab the focus back, it would solve the problem. (Except it might not due to this unexplored multi-pane behavior, but I'd like to try. I would prefer to see subprocesses running in a pane than a separate window.)
 
WINDOW won't work in WT because (as previously mentioned elsewhere) there is no console window when you're in WT. You might try something based on activate "%_wintitle". I'm pretty sure _WINTITLE will be the WT tab's caption if current TCC is in WT's active tab/pane.
 
WINDOW won't work in WT because (as previously mentioned elsewhere) there is no console window when you're in WT. You might try something based on activate "%_wintitle". I'm pretty sure _WINTITLE will be the WT tab's caption if current TCC is in WT's active tab/pane.
Thakn you very much!

In response to this i aliased window=call window.bat and made a windows.bat that detect the container and issues a warning that it won't work if the container is wrong :)
 
I guess a lot of things break that rule then, because i've absolutely had to use a focus-monitor.exe (which was hard to find) that reports on process names that take focus, in order to track down processes that have successfully grabbed focus from the window I'm focused on. It's been a problem that's crept up time and time again over the past decade. Wish we could break the rule too :D
 
Back
Top