Added better checks to DesktopSetup
@@ -83,11 +83,18 @@ public class DesktopSetup {
// Set basic desktop handlers
final java.awt.Desktop awtDesktop = java.awt.Desktop.getDesktop();
if (awtDesktop != null) {
+
+ // Setup About handler
+ if (awtDesktop.isSupported(java.awt.Desktop.Action.APP_ABOUT)) {
awtDesktop.setAboutHandler(e -> {
MainWindow mainWindow = (MainWindow) MZmineCore.getDesktop();
mainWindow.showAboutDialog();
});
+ }
+
+ // Setup Quithandler
+ if (awtDesktop.isSupported(java.awt.Desktop.Action.APP_QUIT_HANDLER)) {
awtDesktop.setQuitHandler((e, response) -> {
ExitCode exitCode = MZmineCore.getDesktop().exitMZmine();
if (exitCode == ExitCode.OK)
@@ -96,14 +103,17 @@ public class DesktopSetup {
response.cancelQuit();
});
}
+ }
MZmineCore.getTaskController().addTaskControlListener(numOfTasks -> {
String badge = null;
if (numOfTasks > 0)
badge = String.valueOf(numOfTasks);
+ if (Taskbar.isTaskbarSupported()) {
final Taskbar taskBar = Taskbar.getTaskbar();
if (taskBar != null)
taskBar.setIconBadge(badge);
+ }
});
// Let the OS decide the location of new windows. Otherwise, all windows
