keyboard - Intercepting a window's attempt to steal global focus on Windows -
i'm developer , long-time windows user obsession making scheme convenient utilize possible.
yesterday thought has annoyed me in windows , i've taken granted, , realized have improve thought how work, , i'm wondering whether it's possible tweak windows work that.
the thing annoys me when windows steal focus. example, running installer program. while it's working, i'll switch browser , browse, maybe entering text email in browser. installer finishes and window steals focus. i'm in middle of writing email, might press key happens bound button on installer, , button gets invoked, doing action never intended happen!
this doubly annoying me because i'm using multiple-desktop programme called dexpot, , when window steals focus, brings desktop i'm on, can annoying, because have set original desktop.
how ideal solution problem work: every time window tries steal focus, intercept that, , don't allow it. show toaster message saying "foobar installer wants focus, press win-whatever switch it". if , when press key combo, switches window.
the question is: there easy way tweak windows create happen? know little windows programming. know ahk , if it's possible that, that'd great.
no, there isn't easy way add together behavior, windows tries automatically.
in theory apps shouldn't able steal foreground while you're actively using app. unfortunatly there scenarios windows can't tell difference between legitimate user actions should alter foreground , unwanted foreground-theft. window manager tightens holes bit each new version of windows, needs create sure apps can come foreground when user wants them to, if want expressed indirectly.
for example, process launched current foreground process can set window foreground. necessary when user launches window explorer newly launched process can open main window. permission lasts until next user input, if application slow launch , start working on email app may lose foreground permissions before can utilize them.
see setforegroundwindow function documentation list of requirements process able set window foreground.
there apps create utilize of these requirements steal permission (by joining foreground queue or synthsising user input themselves), suspect in installer scenario accidental.
i'm not sure going on, suspect problem comes installer running service , accidentally stealing foreground permission when tries launch app on current desktop.
it theoretically possible external process hook foreground scheme override , show confirmation toast, tricky right , require important low level code (i'd start cbthook). not possible in scripting bundle ahk (assuming mean autohotkey) need native c/c++ code injected every running process.
windows keyboard focus usability
No comments:
Post a Comment