From 700f539dfb530606e7ae2bb9546015635c26992c Mon Sep 17 00:00:00 2001 From: crschnick Date: Wed, 29 Nov 2023 19:25:32 +0000 Subject: [PATCH] Fix macos quit not working --- app/src/main/java/io/xpipe/app/util/PlatformState.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/src/main/java/io/xpipe/app/util/PlatformState.java b/app/src/main/java/io/xpipe/app/util/PlatformState.java index 866d923d..4acd3292 100644 --- a/app/src/main/java/io/xpipe/app/util/PlatformState.java +++ b/app/src/main/java/io/xpipe/app/util/PlatformState.java @@ -65,6 +65,16 @@ public enum PlatformState { return Optional.empty(); } + try { + // Weird fix to ensure that macOS quit operation works while in tray. + // Maybe related to https://bugs.openjdk.org/browse/JDK-8318129 as it prints the same error if not called + // The headless is not needed though but still done + GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices(); + } catch (HeadlessException e) { + TrackEvent.warn(e.getMessage()); + return Optional.of(e); + } + try { CountDownLatch latch = new CountDownLatch(1); Platform.setImplicitExit(false);