diff --git a/src/main/java/org/cryptomator/common/settings/Settings.java b/src/main/java/org/cryptomator/common/settings/Settings.java index e4cb9b8f7..5d2cd7c22 100644 --- a/src/main/java/org/cryptomator/common/settings/Settings.java +++ b/src/main/java/org/cryptomator/common/settings/Settings.java @@ -59,6 +59,11 @@ public class Settings { private final StringProperty licenseKey = new SimpleStringProperty(DEFAULT_LICENSE_KEY); private final BooleanProperty showMinimizeButton = new SimpleBooleanProperty(DEFAULT_SHOW_MINIMIZE_BUTTON); private final BooleanProperty showTrayIcon; + private final IntegerProperty windowXPosition = new SimpleIntegerProperty(); + private final IntegerProperty windowYPosition = new SimpleIntegerProperty(); + private final IntegerProperty windowWidth = new SimpleIntegerProperty(); + private final IntegerProperty windowHeight = new SimpleIntegerProperty(); + private Consumer saveCmd; @@ -83,6 +88,10 @@ public class Settings { licenseKey.addListener(this::somethingChanged); showMinimizeButton.addListener(this::somethingChanged); showTrayIcon.addListener(this::somethingChanged); + windowXPosition.addListener(this::somethingChanged); + windowYPosition.addListener(this::somethingChanged); + windowWidth.addListener(this::somethingChanged); + windowHeight.addListener(this::somethingChanged); } void setSaveCmd(Consumer saveCmd) { @@ -158,4 +167,20 @@ public class Settings { public BooleanProperty showTrayIcon() { return showTrayIcon; } + + public IntegerProperty windowXPositionProperty() { + return windowXPosition; + } + + public IntegerProperty windowYPositionProperty() { + return windowYPosition; + } + + public IntegerProperty windowWidthProperty() { + return windowWidth; + } + + public IntegerProperty windowHeightProperty() { + return windowHeight; + } } diff --git a/src/main/java/org/cryptomator/common/settings/SettingsJsonAdapter.java b/src/main/java/org/cryptomator/common/settings/SettingsJsonAdapter.java index 5bcb5f3d7..f390f0b84 100644 --- a/src/main/java/org/cryptomator/common/settings/SettingsJsonAdapter.java +++ b/src/main/java/org/cryptomator/common/settings/SettingsJsonAdapter.java @@ -52,6 +52,11 @@ public class SettingsJsonAdapter extends TypeAdapter { out.name("licenseKey").value(value.licenseKey().get()); out.name("showMinimizeButton").value(value.showMinimizeButton().get()); out.name("showTrayIcon").value(value.showTrayIcon().get()); + out.name("windowXPosition").value((value.windowXPositionProperty().get())); + out.name("windowYPosition").value((value.windowYPositionProperty().get())); + out.name("windowWidth").value((value.windowWidthProperty().get())); + out.name("windowHeight").value((value.windowHeightProperty().get())); + out.endObject(); } @@ -86,6 +91,11 @@ public class SettingsJsonAdapter extends TypeAdapter { case "licenseKey" -> settings.licenseKey().set(in.nextString()); case "showMinimizeButton" -> settings.showMinimizeButton().set(in.nextBoolean()); case "showTrayIcon" -> settings.showTrayIcon().set(in.nextBoolean()); + case "windowXPosition" -> settings.windowXPositionProperty().set(in.nextInt()); + case "windowYPosition" -> settings.windowYPositionProperty().set(in.nextInt()); + case "windowWidth" -> settings.windowWidthProperty().set(in.nextInt()); + case "windowHeight"-> settings.windowHeightProperty().set(in.nextInt()); + default -> { LOG.warn("Unsupported vault setting found in JSON: " + name); in.skipValue();