MyStreamTimer icon indicating copy to clipboard operation
MyStreamTimer copied to clipboard

Program window steals focus when timer is activated via command line

Open PXAbstraction opened this issue 3 years ago • 12 comments
trafficstars

Any time a timer is started via a command line trigger, the window steals focus. If I'm streaming a game, this swaps the game out and I have to manuall move focus back to it. Is there a way to stop having the window steal focus? This is kind of a critical function issue.

PXAbstraction avatar Feb 18 '22 04:02 PXAbstraction

Is this on windows or Mac?

jamesmontemagno avatar Feb 18 '22 07:02 jamesmontemagno

Sorry, should have specified. This is on Windows 10.

PXAbstraction avatar Feb 18 '22 14:02 PXAbstraction

So, if you run it from Stream Deck or from Windows Terminal -> https://docs.microsoft.com/en-us/windows/terminal/install you shouldn't have any issues if you call

start mystreamtimer://countdown/?mins=15

That left focus on the terminal. If you run diretly from Run then it would take focus.

jamesmontemagno avatar Feb 18 '22 20:02 jamesmontemagno

So I'm actually running it through my bot (MixItUp) as part of a group of commands that trigger when someone pushes certain Channel Points buttons. You can't just specify a command in the bot, it requires an actual executable file to launch, which "start" isn't recognized as since it's an in-built OS command. The way I got around this was by having the bot reference a batch file that launches My Stream Timer with the exact command you reference. The bot doesn't normally cause the app it launches to steal focus. Interestingly, the app steals focus if I run either the batch file or just the raw command from a Command Prompt.

I'll install Windows Terminal and see if I can execute it from my bot.

UPDATE: Just tried to run the command from Windows Terminal and the app still stole focus on launch.

PXAbstraction avatar Feb 19 '22 05:02 PXAbstraction

Would love to see what yours is doing maybe with a video recording. Here is what I see on my end

https://user-images.githubusercontent.com/1676321/155224806-58c69bd6-1e19-4cfc-9b53-9eba48d2e5b5.mp4

:

jamesmontemagno avatar Feb 22 '22 21:02 jamesmontemagno

Hey there! Sorry for my delay, the last couple of days have been nuts and not left me with much time.

Here's a video showing the focus steal issue on my end.

https://user-images.githubusercontent.com/20633413/155591603-696d82de-fdde-4953-b2f5-4193a7bb7da1.mp4

Thanks!

PXAbstraction avatar Feb 24 '22 19:02 PXAbstraction

Hmmmmm that is extremely interesting.....

I can't reproduce it on this machine here installing from the store. Will try a few other machines... maybe it is some where flag somewhere in the registry somewhere hmmmm

jamesmontemagno avatar Feb 24 '22 19:02 jamesmontemagno

Right? It's super weird. I do have a bunch of other utilities installed like DisplayFusion and the like, but nothing that normally impacts window focus. I can try this on my laptop as well and see if it happens there.

PXAbstraction avatar Feb 24 '22 19:02 PXAbstraction

Reached out to some friends on Twitter and I think we figured out what is going on. I will try to do a fix and get a build somehow to you to try out ;)

jamesmontemagno avatar Feb 24 '22 23:02 jamesmontemagno

Oh, awesome! Not sure how test builds work with UWP apps but happy to help.

PXAbstraction avatar Feb 24 '22 23:02 PXAbstraction

Okay... so super weird. I can reproduce the focus issue on 1 of my profiles on this machine. And what we thought was causing the problem has no effect.... so I am trying to figure out if I have some magical setting on the other 2 profiles....

jamesmontemagno avatar Feb 25 '22 01:02 jamesmontemagno

Hmmmm one thing I could try to implement is a fake click that clicks on the app that is active

https://stackoverflow.com/questions/60575310/uwp-prevent-app-from-activating-or-taking-focus

Although things are weird because if I minimize the app and run the command it will bring it into focus on one of my profiles, but on the other 2 it leaves it minimized. hmmmm

jamesmontemagno avatar Feb 25 '22 03:02 jamesmontemagno