From 04722204a678c85745555e7a85534a84b69104b8 Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Sat, 29 Aug 2020 20:06:50 +0200 Subject: [PATCH] set app name on X11 --- build.gradle | 10 ++++++++-- src/main/java/com/sparrowwallet/sparrow/MainApp.java | 2 +- .../com/sparrowwallet/sparrow/MainAppPreloader.java | 11 +++++++++++ 3 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 src/main/java/com/sparrowwallet/sparrow/MainAppPreloader.java diff --git a/build.gradle b/build.gradle index b1bc565c..5f953472 100644 --- a/build.gradle +++ b/build.gradle @@ -72,7 +72,9 @@ mainClassName = 'com.sparrowwallet.sparrow/com.sparrowwallet.sparrow.MainApp' compileJava { options.with { fork = true - compilerArgs.addAll(["--add-exports", "org.controlsfx.controls/impl.org.controlsfx.skin=com.sparrowwallet.sparrow"]) + compilerArgs.addAll(["--add-exports", "org.controlsfx.controls/impl.org.controlsfx.skin=com.sparrowwallet.sparrow", + "--add-exports", "javafx.graphics/com.sun.glass.ui=com.sparrowwallet.sparrow", + "--add-exports", "javafx.graphics/com.sun.javafx.application=com.sparrowwallet.sparrow"]) } } @@ -97,7 +99,9 @@ run { "--add-opens=javafx.graphics/com.sun.javafx.tk.quantum=centerdevice.nsmenufx", "--add-opens=javafx.graphics/com.sun.glass.ui=centerdevice.nsmenufx", "--add-opens=javafx.controls/com.sun.javafx.scene.control=centerdevice.nsmenufx", - "--add-opens=javafx.graphics/com.sun.javafx.menu=centerdevice.nsmenufx"] + "--add-opens=javafx.graphics/com.sun.javafx.menu=centerdevice.nsmenufx", + "--add-opens=javafx.graphics/com.sun.glass.ui=com.sparrowwallet.sparrow", + "--add-opens=javafx.graphics/com.sun.javafx.application=com.sparrowwallet.sparrow"] if(os.macOsX) { applicationDefaultJvmArgs += ["-Xdock:name=Sparrow", "-Xdock:icon=/Users/scy/git/sparrow/src/main/resources/sparrow.png", @@ -132,7 +136,9 @@ jlink { "--add-opens=javafx.graphics/com.sun.glass.ui=com.sparrowwallet.merged.module", "--add-opens=javafx.controls/com.sun.javafx.scene.control=com.sparrowwallet.merged.module", "--add-opens=javafx.graphics/com.sun.javafx.menu=com.sparrowwallet.merged.module", + "--add-opens=javafx.graphics/com.sun.glass.ui=com.sparrowwallet.sparrow", "--add-opens=javafx.graphics/com.sun.glass.ui.mac=com.sparrowwallet.merged.module", + "--add-opens=javafx.graphics/com.sun.javafx.application=com.sparrowwallet.sparrow", "--add-reads=com.sparrowwallet.merged.module=java.desktop"] } addExtraDependencies("javafx") diff --git a/src/main/java/com/sparrowwallet/sparrow/MainApp.java b/src/main/java/com/sparrowwallet/sparrow/MainApp.java index 26187b86..ddb65233 100644 --- a/src/main/java/com/sparrowwallet/sparrow/MainApp.java +++ b/src/main/java/com/sparrowwallet/sparrow/MainApp.java @@ -96,6 +96,6 @@ public class MainApp extends Application { } public static void main(String[] args) { - launch(args); + com.sun.javafx.application.LauncherImpl.launchApplication(MainApp.class, MainAppPreloader.class, args); } } diff --git a/src/main/java/com/sparrowwallet/sparrow/MainAppPreloader.java b/src/main/java/com/sparrowwallet/sparrow/MainAppPreloader.java new file mode 100644 index 00000000..844dddc0 --- /dev/null +++ b/src/main/java/com/sparrowwallet/sparrow/MainAppPreloader.java @@ -0,0 +1,11 @@ +package com.sparrowwallet.sparrow; + +import javafx.application.Preloader; +import javafx.stage.Stage; + +public class MainAppPreloader extends Preloader { + @Override + public void start(Stage stage) { + com.sun.glass.ui.Application.GetApplication().setName("Sparrow"); + } +}