mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-05-14 08:41:28 +00:00
fixes #77
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
<parent>
|
||||
<groupId>org.cryptomator</groupId>
|
||||
<artifactId>main</artifactId>
|
||||
<version>0.10.0</version>
|
||||
<version>0.10.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>core</artifactId>
|
||||
<name>Cryptomator WebDAV and I/O module</name>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<parent>
|
||||
<groupId>org.cryptomator</groupId>
|
||||
<artifactId>main</artifactId>
|
||||
<version>0.10.0</version>
|
||||
<version>0.10.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>crypto-aes</artifactId>
|
||||
<name>Cryptomator cryptographic module (AES)</name>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<parent>
|
||||
<groupId>org.cryptomator</groupId>
|
||||
<artifactId>main</artifactId>
|
||||
<version>0.10.0</version>
|
||||
<version>0.10.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>crypto-api</artifactId>
|
||||
<name>Cryptomator cryptographic module API</name>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>org.cryptomator</groupId>
|
||||
<artifactId>main</artifactId>
|
||||
<version>0.10.0</version>
|
||||
<version>0.10.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>installer-debian</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>org.cryptomator</groupId>
|
||||
<artifactId>main</artifactId>
|
||||
<version>0.10.0</version>
|
||||
<version>0.10.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>installer-osx</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>org.cryptomator</groupId>
|
||||
<artifactId>main</artifactId>
|
||||
<version>0.10.0</version>
|
||||
<version>0.10.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>installer-win-portable</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>org.cryptomator</groupId>
|
||||
<artifactId>main</artifactId>
|
||||
<version>0.10.0</version>
|
||||
<version>0.10.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>installer-win</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.cryptomator</groupId>
|
||||
<artifactId>main</artifactId>
|
||||
<version>0.10.0</version>
|
||||
<version>0.10.1-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
<name>Cryptomator</name>
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<parent>
|
||||
<groupId>org.cryptomator</groupId>
|
||||
<artifactId>main</artifactId>
|
||||
<version>0.10.0</version>
|
||||
<version>0.10.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>uber-jar</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<parent>
|
||||
<groupId>org.cryptomator</groupId>
|
||||
<artifactId>main</artifactId>
|
||||
<version>0.10.0</version>
|
||||
<version>0.10.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>ui</artifactId>
|
||||
<name>Cryptomator GUI</name>
|
||||
|
||||
@@ -11,9 +11,7 @@ import java.awt.TrayIcon.MessageType;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.io.IOException;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import javafx.application.Platform;
|
||||
import javafx.stage.Stage;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.script.ScriptEngine;
|
||||
import javax.script.ScriptEngineManager;
|
||||
@@ -21,10 +19,16 @@ import javax.script.ScriptException;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
import org.apache.commons.lang3.SystemUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javafx.application.Platform;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public final class TrayIconUtil {
|
||||
|
||||
private static TrayIconUtil INSTANCE;
|
||||
private static final Logger LOG = LoggerFactory.getLogger(TrayIconUtil.class);
|
||||
|
||||
private final Stage mainApplicationWindow;
|
||||
private final ResourceBundle rb;
|
||||
@@ -79,10 +83,32 @@ public final class TrayIconUtil {
|
||||
exitItem.addActionListener(this::quitFromTray);
|
||||
popup.add(exitItem);
|
||||
|
||||
final Image image = Toolkit.getDefaultToolkit().getImage(TrayIconUtil.class.getResource("/tray_icon.png"));
|
||||
final Image image;
|
||||
if (SystemUtils.IS_OS_MAC_OSX && isMacMenuBarDarkMode()) {
|
||||
image = Toolkit.getDefaultToolkit().getImage(TrayIconUtil.class.getResource("/tray_icon_white.png"));
|
||||
} else {
|
||||
image = Toolkit.getDefaultToolkit().getImage(TrayIconUtil.class.getResource("/tray_icon.png"));
|
||||
}
|
||||
|
||||
return new TrayIcon(image, rb.getString("app.name"), popup);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if <code>defaults read -g AppleInterfaceStyle</code> has an exit status of <code>0</code> (i.e. _not_ returning "key not found").
|
||||
*/
|
||||
private boolean isMacMenuBarDarkMode() {
|
||||
try {
|
||||
// check for exit status only. Once there are more modes than "dark" and "default", we might need to analyze string contents..
|
||||
final Process proc = Runtime.getRuntime().exec(new String[] {"defaults", "read", "-g", "AppleInterfaceStyle"});
|
||||
proc.waitFor(100, TimeUnit.MILLISECONDS);
|
||||
return proc.exitValue() == 0;
|
||||
} catch (IOException | InterruptedException | IllegalThreadStateException ex) {
|
||||
// IllegalThreadStateException thrown by proc.exitValue(), if process didn't terminate
|
||||
LOG.warn("Determining MAC OS X dark mode settings failed. Assuming default (light) mode.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void showTrayNotification(TrayIcon trayIcon) {
|
||||
final Runnable notificationCmd;
|
||||
if (SystemUtils.IS_OS_MAC_OSX) {
|
||||
|
||||
BIN
main/ui/src/main/resources/tray_icon_white.png
Normal file
BIN
main/ui/src/main/resources/tray_icon_white.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
Reference in New Issue
Block a user