diff --git a/app/src/main/java/io/xpipe/app/core/App.java b/app/src/main/java/io/xpipe/app/core/App.java index 59fec109..1cd1257d 100644 --- a/app/src/main/java/io/xpipe/app/core/App.java +++ b/app/src/main/java/io/xpipe/app/core/App.java @@ -6,11 +6,9 @@ import io.xpipe.app.issue.TrackEvent; import io.xpipe.app.prefs.AppPrefs; import io.xpipe.app.update.XPipeDistributionType; import io.xpipe.app.util.LicenseProvider; - import javafx.application.Application; import javafx.beans.binding.Bindings; import javafx.stage.Stage; - import lombok.Getter; import lombok.SneakyThrows; diff --git a/app/src/main/java/io/xpipe/app/core/AppPreloader.java b/app/src/main/java/io/xpipe/app/core/AppPreloader.java new file mode 100644 index 00000000..cfbcfdfb --- /dev/null +++ b/app/src/main/java/io/xpipe/app/core/AppPreloader.java @@ -0,0 +1,22 @@ +package io.xpipe.app.core; + +import io.xpipe.app.issue.TrackEvent; +import javafx.application.Preloader; +import javafx.stage.Stage; +import lombok.Getter; +import lombok.SneakyThrows; + +@Getter +public class AppPreloader extends Preloader { + + @Override + @SneakyThrows + public void start(Stage primaryStage) { + // Do it this way to prevent IDE inspections from complaining + var c = Class.forName( + ModuleLayer.boot().findModule("javafx.graphics").orElseThrow(), "com.sun.glass.ui.Application"); + var m = c.getDeclaredMethod("setName", String.class); + m.invoke(c.getMethod("GetApplication").invoke(null), "XPipe"); + TrackEvent.info("Application preloaded launched"); + } +} diff --git a/build.gradle b/build.gradle index 3906a2da..f4652923 100644 --- a/build.gradle +++ b/build.gradle @@ -121,7 +121,8 @@ project.ext { // Disable this for now as it requires Windows 10+ // '-XX:+UseZGC', "-Dvisualvm.display.name=XPipe", - "-Dapple.awt.application.appearance=system" + "-Dapple.awt.application.appearance=system", + "-Djavafx.preloader=io.xpipe.app.core.AppPreloader" ] useBundledJavaFx = fullVersion useBundledJna = fullVersion