More fixes

This commit is contained in:
crschnick 2024-06-19 19:05:14 +00:00
parent bf4c8d8f5b
commit 79c2070d19
4 changed files with 25 additions and 12 deletions

View file

@ -196,7 +196,6 @@ public class SideMenuBarComp extends Comp<CompStructure<VBox>> {
vbox.getChildren().add(filler);
VBox.setVgrow(filler, Priority.ALWAYS);
filler.prefWidthProperty().bind(((Region) vbox.getChildren().getFirst()).widthProperty());
vbox.getStyleClass().add("sidebar-comp");
return new SimpleCompStructure<>(vbox);
}

View file

@ -21,7 +21,6 @@ import javafx.scene.layout.Region;
import javafx.scene.paint.Color;
import javafx.stage.Screen;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
import lombok.Builder;
import lombok.Getter;
import lombok.Value;
@ -53,7 +52,6 @@ public class AppMainWindow {
INSTANCE = new AppMainWindow(stage);
var scene = new Scene(new Region(), -1, -1, false);
scene.setFill(Color.TRANSPARENT);
stage.initStyle(StageStyle.UNIFIED);
stage.setScene(scene);
AppWindowHelper.setupStylesheets(stage.getScene());
return INSTANCE;

View file

@ -2,11 +2,14 @@ package io.xpipe.app.core.window;
import io.xpipe.app.prefs.AppPrefs;
import io.xpipe.core.process.OsType;
import javafx.animation.PauseTransition;
import javafx.application.Platform;
import javafx.collections.ListChangeListener;
import javafx.collections.ObservableList;
import javafx.css.PseudoClass;
import javafx.stage.Stage;
import javafx.stage.Window;
import javafx.util.Duration;
import lombok.SneakyThrows;
public class ModifiedStage extends Stage {
@ -28,11 +31,9 @@ public class ModifiedStage extends Stage {
}
private static void applyStage(Stage stage) {
if (OsType.getLocal() != OsType.WINDOWS) {
return;
}
if (AppPrefs.get() == null) {
if (OsType.getLocal() != OsType.WINDOWS || AppPrefs.get() == null) {
stage.getScene().getRoot().pseudoClassStateChanged(PseudoClass.getPseudoClass("seamless-frame"), false);
stage.getScene().getRoot().pseudoClassStateChanged(PseudoClass.getPseudoClass("separate-frame"), true);
return;
}
@ -46,5 +47,23 @@ public class ModifiedStage extends Stage {
}
stage.getScene().getRoot().pseudoClassStateChanged(PseudoClass.getPseudoClass("seamless-frame"), backdrop);
stage.getScene().getRoot().pseudoClassStateChanged(PseudoClass.getPseudoClass("separate-frame"), !backdrop);
AppPrefs.get().theme.addListener((observable, oldValue, newValue) -> {
if (!stage.isShowing()) {
return;
}
Platform.runLater(() -> {
var transition = new PauseTransition(Duration.millis(300));
transition.setOnFinished(e -> {
applyStage(stage);
stage.setWidth(stage.getWidth() - 1);
Platform.runLater(() -> {
stage.setWidth(stage.getWidth() + 1);
});
});
transition.play();
});
});
}
}

View file

@ -6,7 +6,7 @@
}
.root:dark .sidebar-comp {
-fx-background-color: derive(-color-bg-default, 1%);
-fx-background-color: derive(-color-bg-default, 10%);
}
.root:light .sidebar-comp {
@ -22,9 +22,6 @@
.sidebar-comp .icon-button-comp, .sidebar-comp .button {
-fx-background-radius: 0;
-fx-background-insets: 0;
}
.root:seamless-frame .sidebar-comp .icon-button-comp, .root:seamless-frame .sidebar-comp .button {
-fx-background-color: transparent;
}