IPC event on 'window got focus'
I need to run a shell command when the window with certain app gets focus. Is there a proper way to do this? If not, are there some reasons to not doing this (too slow to generate events on every window focus or so)? If there are no reasons, what is the right way to implement such a feature? (I'll try to do it myself.)
(More detailed, I have two keyboard layouts (us and ru) and Emacs which bindings work only when us layoud is active. I want to switch the system layout to us when Emacs window gets focus.)
PS If you see some other (more easy or more proper) way to solve my problem, please write it down.
Someone is working on this now. See https://github.com/i3/i3/issues/1168