void (ProcessBuilder processBuilder) { if (SystemInfo.isJetBrainsJvm && StartupUiUtil.isXToolkit()) { try { var lastUserActionTime = ReflectionUtil.getStaticFieldValue(Class.forName("sun.awt.X11.XBaseWindow"), long.class, "globalUserTime"); if (lastUserActionTime == null) { Logger.getInstance(Restarter.class).warn("Couldn't obtain last user action's timestamp"); } else { // this doesn't initiate a "proper" startup sequence (by sending the 'new:' message to the root window), // but passing the event timestamp to the started process should be enough to prevent focus stealing var restartId = ApplicationNamesInfo.getInstance().getProductName() + "-restart_TIME" + lastUserActionTime; processBuilder.environment().put("DESKTOP_STARTUP_ID", restartId); } } catch (Exception e) { Logger.getInstance(Restarter.class).warn("Couldn't set DESKTOP_STARTUP_ID", e); } } }