From c9b1b1baa529886f8ccca1010b6bf8472232faac Mon Sep 17 00:00:00 2001 From: Martin Beyer Date: Tue, 23 Feb 2021 17:26:50 +0100 Subject: [PATCH 1/2] Fixes #1291 (Windows Automatic Theme) --- .../main/java/org/cryptomator/common/settings/UiTheme.java | 2 +- main/pom.xml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/main/commons/src/main/java/org/cryptomator/common/settings/UiTheme.java b/main/commons/src/main/java/org/cryptomator/common/settings/UiTheme.java index 8df1e7f89..62fe714e4 100644 --- a/main/commons/src/main/java/org/cryptomator/common/settings/UiTheme.java +++ b/main/commons/src/main/java/org/cryptomator/common/settings/UiTheme.java @@ -8,7 +8,7 @@ public enum UiTheme { AUTOMATIC("preferences.general.theme.automatic"); public static UiTheme[] applicableValues() { - if (SystemUtils.IS_OS_MAC) { + if (SystemUtils.IS_OS_MAC || SystemUtils.IS_OS_WINDOWS) { return values(); } else { return new UiTheme[]{LIGHT, DARK}; diff --git a/main/pom.xml b/main/pom.xml index 6b4500bc6..6a427b908 100644 --- a/main/pom.xml +++ b/main/pom.xml @@ -25,8 +25,8 @@ 1.9.14 - 0.1.6 - 0.2.1 + 1.0.0-beta2 + 1.0.0-beta2 0.1.0 0.1.1 1.2.9 From a17b416262b9124b5bc7c286203730414097ea18 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Wed, 24 Feb 2021 12:54:56 +0100 Subject: [PATCH 2/2] only remove system theme change listener, if one was previously registered. --- .../main/java/org/cryptomator/ui/fxapp/FxApplication.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main/ui/src/main/java/org/cryptomator/ui/fxapp/FxApplication.java b/main/ui/src/main/java/org/cryptomator/ui/fxapp/FxApplication.java index 65e6d1c6c..73c04fe5f 100644 --- a/main/ui/src/main/java/org/cryptomator/ui/fxapp/FxApplication.java +++ b/main/ui/src/main/java/org/cryptomator/ui/fxapp/FxApplication.java @@ -137,13 +137,13 @@ public class FxApplication extends Application { } private void appThemeChanged(@SuppressWarnings("unused") ObservableValue observable, @SuppressWarnings("unused") UiTheme oldValue, UiTheme newValue) { - appearanceProvider.ifPresent(appearanceProvider -> { + if (appearanceProvider.isPresent() && oldValue == UiTheme.AUTOMATIC && newValue != UiTheme.AUTOMATIC) { try { - appearanceProvider.removeListener(systemInterfaceThemeListener); + appearanceProvider.get().removeListener(systemInterfaceThemeListener); } catch (UiAppearanceException e) { LOG.error("Failed to disable automatic theme switching."); } - }); + } loadSelectedStyleSheet(newValue); }