Fix Task bar name for GNOME3

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Fix Task bar name for GNOME3

Felix Natter
Administrator
hello Devs,

on (some?) linux desktops, the freeplane app name in the task bar
is as follows:

- freeplane 1.3.15 on jessie: java-lang-Thread
- freeplane 1.5.9 on unstable: org-knopflerfish-framework-BundleThread

--> hence I propose this patch:

diff --git a/freeplane_framework/src/main/java/org/freeplane/launcher/Launcher.java b/freeplane_framework/src/main/java/org/freeplane/launcher/Launcher.java
index 5e7539b..fafa7a7 100644
--- a/freeplane_framework/src/main/java/org/freeplane/launcher/Launcher.java
+++ b/freeplane_framework/src/main/java/org/freeplane/launcher/Launcher.java
@@ -19,6 +19,7 @@
  */
 package org.freeplane.launcher;
 
+import java.awt.Toolkit;
 import java.io.File;
 import java.io.IOException;
 import java.net.URISyntaxException;
@@ -45,7 +46,20 @@ public class Launcher {
  argCount = 0;
  }
 
+ private static void fixDesktopAppName() {
+ try {
+ Toolkit xToolkit = Toolkit.getDefaultToolkit();
+ java.lang.reflect.Field awtAppClassNameField = xToolkit.getClass().getDeclaredField("awtAppClassName");
+ awtAppClassNameField.setAccessible(true);
+ awtAppClassNameField.set(xToolkit, "Freeplane");
+ } catch (NoSuchFieldException | SecurityException
+ | IllegalArgumentException | IllegalAccessException e) {
+ System.err.format("Couldn't set awtAppClassName: %s%n", e.getClass().getSimpleName() + ": " + e.getMessage());
+ }
+ }
+
  public static void main(String[] args) {
+ fixDesktopAppName();
  new Launcher().launch(args);
  }
 
which works for me on linux and windows (tested with binary distribution).
Does anyone object to my committing this on 1.5.x?

Cheers and Best Regards,
--
Felix Natter
Reply | Threaded
Open this post in threaded view
|

Re: Fix Task bar name for GNOME3

Felix Natter
Administrator
Please reply :-)

Given the beta state I would like to commit this soon!

Cheers and Best Regards,
Felix
Reply | Threaded
Open this post in threaded view
|

Re: Fix Task bar name for GNOME3

Felix Natter
Administrator
Acknowledged by Dimitry --> pushed.
Reply | Threaded
Open this post in threaded view
|

Re: Fix Task bar name for GNOME3

Dimitry Polivaev
Administrator
Felix,

what do you think about adding a check like

if (System.getProperty("os.name").toLowerCase().contains("linux"))

( http://stackoverflow.com/questions/31219169/javafx-application-name-on-gnome )

or

if (toolkit.getClass().getName().equals("sun.awt.X11.XToolkit"))

(http://hg.netbeans.org/core-main/rev/5832261b8434 )

Regards,
Dimitry