Preventing JVM Apps from Losing focus in OSX

statement of sadness

A while ago I switched from Linux-nearly-everywhere to a MacBook Pro for my main iron.

I run JVM applications. A lot of JVM applications. Most were well-behaved, but some of them lost focus on launch.

  1. be in a terminal shell (aren’t we folks always?)
  2. type groovysh
  3. expected:
    1. continue typing to the terminal, interacting happily with the Groovy shell
  4. actual:
    1. terminal loses focus
    2. alt-tab shows an application called GroovyShell, with a circular G icon
    3. that application shows as an Xcode development item
    4. forget that focus was lost, type, be sad

_config.yml

make the pain go

If you want the pain to stop, add a JVM environment flag somewhere in your environment startup sequence. I prefer to do such things in my ~/.bashrc.

(The T.S. Eliot quote is optional. It’s possible you don’t want to think about T.S. Eliot poetry when you edit your dotfiles and smile. Your life is your own.)

?

Bref, JVM processes that need some kinds of resources (to optimize the resizing of images, etc.) invoke another kind of process, one that ususally uses elements related to display. These can register as using the display. OSX responds in a way that is not very helpful.

Written on February 28, 2016