Gnome 3中的install4j应用程序名称 [英] install4j application name in Gnome 3

查看:52
本文介绍了Gnome 3中的install4j应用程序名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我们的应用程序通过install4j在Linux的Gnome 3桌面上安装并运行时,该应用程序运行:位于活动按钮旁边的应用程序"菜单显示活动应用程序的名称,显示"com-install4j-runtime-launcher -UnixLauncher".

When our application is installed by install4j on a Gnome 3 desktop in Linux, and the application runs: the Application menu, located beside the Activities button which shows the name of the active application is showing "com-install4j-runtime-launcher-UnixLauncher".

install4j中是否有设置,以便我们的应用程序名称正确显示?

Is there a setting in install4j so that our application name shows up properly instead?

推荐答案

从install4j 7开始,只有一个hack可以实现:

As of install4j 7, there is only a hack to achieve this:

定义编译器变量

sys.ext.windowClass.<nn>=MyAppName

其中<nn>是启动器的ID,MyAppName不得包含空格.

where <nn> is the ID of the launcher and MyAppName must not contain spaces.

这会将一个"StartupWMClass"条目添加到.desktop文件.

This will add a "StartupWMClass" entry to the .desktop file.

对于AWT,必须通过编程将实际的窗口类设置为相同的值.使用API​​不可能做到这一点,而只能使用反射:

For the AWT, the actual window class has to be set to the same value programmatically. This is not possible with an API, but just by using reflection:

String wmClass = ...;
Toolkit toolkit = Toolkit.getDefaultToolkit();
Class<?> toolkitClass = toolkit.getClass();

if (Objects.equals("sun.awt.X11.XToolkit", toolkitClass.getName())) {
    //noinspection JavaReflectionMemberAccess
    Field awtAppClassName = toolkitClass.getDeclaredField("awtAppClassName");
    awtAppClassName.setAccessible(true);
    awtAppClassName.set(null, wmClass);
}

这篇关于Gnome 3中的install4j应用程序名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆