See https://gist.github.com/3c54779a97725d8bd5c1f520c93c95e3

The problem is that you have to swizzle some of the pythonista app delegate, so it does not work if the app gets killed in the background