Bringing window to foreground (Java, SWT)

Last edited on

Overview

In general:

def main()
    o = waitForObject("{type='org.eclipse.swt.widgets.Shell' visible='true'}")
    o.forceActive()

Also see:

Additional settings for Linux

On Linux you may have to configure the following:

(German: “Fensterverhalten”, “Fensterverhalten”, “Aktivierung”, “Vorbeugung gegen unerwünschte Aktivierung”.)

Look for the setting “Focus stealing prevention level” and set it to None.

Additional settings for Windows

On Windows you might have to configure the ForegroundLockTimeout (google ForegroundLockTimeout) setting.

It is possible that the value does not exist. In that case it must be added.

To disable this mechanism, which interferes with application/window activation, the value of the ForegroundLockTimeout entry must be set to 0.

Changing this entry requires to log out (alternatively a reboot) to take effect.