diff --git a/app/src/main/java/io/xpipe/app/comp/AppLayoutComp.java b/app/src/main/java/io/xpipe/app/comp/AppLayoutComp.java index 9f241d155..53503c7d4 100644 --- a/app/src/main/java/io/xpipe/app/comp/AppLayoutComp.java +++ b/app/src/main/java/io/xpipe/app/comp/AppLayoutComp.java @@ -32,7 +32,7 @@ public class AppLayoutComp extends Comp> { model.getSelected()))))); var pane = new BorderPane(); - var sidebar = new SideMenuBarComp(model.getSelected(), model.getEntries()); + var sidebar = new SideMenuBarComp(model.getSelectedInternal(), model.getEntries()); pane.setCenter(multi.createRegion()); pane.setRight(sidebar.createRegion()); pane.getStyleClass().add("background"); diff --git a/app/src/main/java/io/xpipe/app/core/AppLayoutModel.java b/app/src/main/java/io/xpipe/app/core/AppLayoutModel.java index 996c46f72..942411fd6 100644 --- a/app/src/main/java/io/xpipe/app/core/AppLayoutModel.java +++ b/app/src/main/java/io/xpipe/app/core/AppLayoutModel.java @@ -5,6 +5,7 @@ import io.xpipe.app.browser.BrowserModel; import io.xpipe.app.comp.DeveloperTabComp; import io.xpipe.app.comp.store.StoreLayoutComp; import io.xpipe.app.fxcomps.Comp; +import io.xpipe.app.fxcomps.util.PlatformThread; import io.xpipe.app.prefs.AppPrefsComp; import io.xpipe.app.util.LicenseProvider; import javafx.beans.property.Property; @@ -18,7 +19,6 @@ import lombok.extern.jackson.Jacksonized; import java.util.ArrayList; import java.util.List; -@Getter public class AppLayoutModel { @Data @@ -48,13 +48,24 @@ public class AppLayoutModel { @Getter private final SavedState savedState; + @Getter private final List entries; private final Property selected; + private final ObservableValue selectedWrapper; public AppLayoutModel(SavedState savedState) { this.savedState = savedState; this.entries = createEntryList(); this.selected = new SimpleObjectProperty<>(entries.get(1)); + this.selectedWrapper = PlatformThread.sync(selected); + } + + public Property getSelectedInternal() { + return selected; + } + + public ObservableValue getSelected() { + return selectedWrapper; } public void selectBrowser() {