Check this out
https://github.com/acrisci/i3ipc-python/blob/master/examples/stop-application-on-unfocus.py
On 12.02.16 20:52, Derek Potts wrote:
I would like to send a SIGSTOP to a particular process when its window looses focus. My scenario is that I run a cpu-intensive process that does not need to be active when I am not looking at it. It is rather expensive to startup, so SIGSTOP and SIGCONT turn out to be a good solution. I always run it on a predictable workspace, so I have bound a key to send it a SIGCONT and and switch to that workspace. That works very well for popping over to it to take a look at it. What I would like to accomplish is to send it a SIGSTOP anytime that I move away from it. I don't run any other processes in that workspace, so it would work equally well to SIGSTOP it when I move away from that particular workspace. Can this be accomplished?