Merge pull request #1556 from cryptomator/feature/win-auto-theme

Feature/win auto theme
This commit is contained in:
Armin Schrenk
2021-02-24 14:31:17 +01:00
committed by GitHub
2 changed files with 4 additions and 4 deletions

View File

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

View File

@@ -137,13 +137,13 @@ public class FxApplication extends Application {
}
private void appThemeChanged(@SuppressWarnings("unused") ObservableValue<? extends UiTheme> 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);
}