Sebastian Stenzel 9 年之前
父节点
当前提交
b254564657

+ 1 - 1
main/core/pom.xml

@@ -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>

+ 1 - 1
main/crypto-aes/pom.xml

@@ -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>

+ 1 - 1
main/crypto-api/pom.xml

@@ -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>

+ 1 - 1
main/installer-debian/pom.xml

@@ -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>

+ 1 - 1
main/installer-osx/pom.xml

@@ -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>

+ 1 - 1
main/installer-win-portable/pom.xml

@@ -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>

+ 1 - 1
main/installer-win/pom.xml

@@ -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>

+ 1 - 1
main/pom.xml

@@ -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>
 

+ 1 - 1
main/uber-jar/pom.xml

@@ -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>

+ 1 - 1
main/ui/pom.xml

@@ -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>

+ 30 - 4
main/ui/src/main/java/org/cryptomator/ui/util/TrayIconUtil.java

@@ -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) {

二进制
main/ui/src/main/resources/tray_icon_white.png