mirror of
https://github.com/xpipe-io/xpipe.git
synced 2025-04-17 09:43:37 +00:00
Fixes [stage]
This commit is contained in:
parent
f3ee00f73b
commit
345ee30ec3
10 changed files with 64 additions and 96 deletions
|
@ -1,5 +1,6 @@
|
|||
package io.xpipe.app.comp.base;
|
||||
|
||||
import atlantafx.base.controls.Spacer;
|
||||
import io.xpipe.app.comp.Comp;
|
||||
import io.xpipe.app.comp.SimpleComp;
|
||||
import io.xpipe.app.core.AppFontSizes;
|
||||
|
@ -14,6 +15,7 @@ import javafx.beans.binding.Bindings;
|
|||
import javafx.beans.property.Property;
|
||||
import javafx.beans.value.ObservableDoubleValue;
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.geometry.Orientation;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
|
@ -164,13 +166,13 @@ public class ModalOverlayComp extends SimpleComp {
|
|||
Region r = newValue.getContent().createRegion();
|
||||
|
||||
var content = new VBox(r);
|
||||
content.getStyleClass().add("content");
|
||||
content.focusedProperty().addListener((o, old, n) -> {
|
||||
if (n) {
|
||||
r.requestFocus();
|
||||
}
|
||||
});
|
||||
content.setSpacing(20);
|
||||
content.setPadding(new Insets(13, 27, 20, 27));
|
||||
|
||||
if (newValue.getTitleKey() != null) {
|
||||
var l = new Label(
|
||||
|
@ -217,11 +219,11 @@ public class ModalOverlayComp extends SimpleComp {
|
|||
overlayContent.setValue(null);
|
||||
event.consume();
|
||||
});
|
||||
r.maxHeightProperty().bind(pane.heightProperty().subtract(200));
|
||||
content.maxHeightProperty().bind(pane.heightProperty().subtract(40));
|
||||
modalBox.minHeightProperty().bind(content.heightProperty());
|
||||
|
||||
content.prefWidthProperty().bind(modalBox.widthProperty());
|
||||
modalBox.setMinWidth(100);
|
||||
modalBox.setMinHeight(100);
|
||||
modalBox.prefWidthProperty().bind(modalBoxWidth(pane, r));
|
||||
modalBox.maxWidthProperty().bind(modalBox.prefWidthProperty());
|
||||
modalBox.setMaxHeight(Region.USE_PREF_SIZE);
|
||||
|
|
|
@ -102,6 +102,7 @@ public abstract class OperationMode {
|
|||
AppMainWindow.loadingText("initializingApp");
|
||||
GlobalTimer.init();
|
||||
AppProperties.init(args);
|
||||
NodeCallback.init();
|
||||
AppLogs.init();
|
||||
AppTempCheck.check();
|
||||
AppDebugModeCheck.printIfNeeded();
|
||||
|
|
|
@ -98,9 +98,6 @@ public class AppMainWindow {
|
|||
return stage.isFocused() ? 1.0 : 0.8;
|
||||
},
|
||||
stage.focusedProperty()));
|
||||
if (AppProperties.get().isDebugPlatformThreadAccess()) {
|
||||
NodeCallback.watchPlatformThreadChanges(content);
|
||||
}
|
||||
var scene = new Scene(content, -1, -1, false);
|
||||
content.prefWidthProperty().bind(scene.widthProperty());
|
||||
content.prefHeightProperty().bind(scene.heightProperty());
|
||||
|
|
|
@ -1,30 +1,48 @@
|
|||
package io.xpipe.app.util;
|
||||
|
||||
import io.xpipe.app.core.AppProperties;
|
||||
import javafx.application.Platform;
|
||||
import javafx.collections.ListChangeListener;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.stage.Window;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class NodeCallback {
|
||||
|
||||
public static void watchGraph(Node node, Consumer<Node> callback) {
|
||||
if (node instanceof Parent p) {
|
||||
for (Node c : p.getChildrenUnmodifiable()) {
|
||||
watchGraph(c, callback);
|
||||
}
|
||||
p.getChildrenUnmodifiable().addListener((ListChangeListener<? super Node>) change -> {
|
||||
for (Node c : change.getList()) {
|
||||
watchGraph(c, callback);
|
||||
}
|
||||
});
|
||||
private static final Set<Window> windows = new HashSet<>();
|
||||
private static final Set<Node> nodes = new HashSet<>();
|
||||
|
||||
public static void init() {
|
||||
if (!AppProperties.get().isDebugPlatformThreadAccess()) {
|
||||
return;
|
||||
}
|
||||
callback.accept(node);
|
||||
|
||||
Window.getWindows().addListener((ListChangeListener<? super Window>) change -> {
|
||||
for (Window window : change.getList()) {
|
||||
if (!windows.add(window)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
window.sceneProperty().subscribe(scene -> {
|
||||
var root = scene != null ? scene.getRoot() : null;
|
||||
if (root != null) {
|
||||
watchPlatformThreadChanges(root);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void watchPlatformThreadChanges(Node node) {
|
||||
private static void watchPlatformThreadChanges(Node node) {
|
||||
watchGraph(node, c -> {
|
||||
if (!nodes.add(c)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (c instanceof Parent p) {
|
||||
p.getChildrenUnmodifiable().addListener((ListChangeListener<? super Node>) change -> {
|
||||
checkPlatformThread();
|
||||
|
@ -45,6 +63,20 @@ public class NodeCallback {
|
|||
});
|
||||
}
|
||||
|
||||
private static void watchGraph(Node node, Consumer<Node> callback) {
|
||||
if (node instanceof Parent p) {
|
||||
for (Node c : p.getChildrenUnmodifiable()) {
|
||||
watchGraph(c, callback);
|
||||
}
|
||||
p.getChildrenUnmodifiable().addListener((ListChangeListener<? super Node>) change -> {
|
||||
for (Node c : change.getList()) {
|
||||
watchGraph(c, callback);
|
||||
}
|
||||
});
|
||||
}
|
||||
callback.accept(node);
|
||||
}
|
||||
|
||||
private static void checkPlatformThread() {
|
||||
if (!Platform.isFxApplicationThread()) {
|
||||
throw new IllegalStateException("Not in Fx application thread");
|
||||
|
|
|
@ -104,9 +104,6 @@ public enum PlatformState {
|
|||
// Check if we have no fonts and set properties to load bundled ones
|
||||
AppSystemFontCheck.init();
|
||||
|
||||
// We use our own shutdown hook
|
||||
disableToolkitShutdownHook();
|
||||
|
||||
if (AppPrefs.get() != null) {
|
||||
var s = AppPrefs.get().uiScale().getValue();
|
||||
if (s != null) {
|
||||
|
@ -162,6 +159,9 @@ public enum PlatformState {
|
|||
}
|
||||
}
|
||||
|
||||
// We use our own shutdown hook
|
||||
disableToolkitShutdownHook();
|
||||
|
||||
try {
|
||||
// This can fail if the found system fonts can somehow not be loaded
|
||||
Font.getDefault();
|
||||
|
|
|
@ -5,6 +5,10 @@
|
|||
-fx-background-radius: 4;
|
||||
}
|
||||
|
||||
.modal-overlay-comp .modal-box > .content {
|
||||
-fx-padding: 15 27 10 27;
|
||||
}
|
||||
|
||||
.modal-overlay-comp .modal-box .button-bar .button {
|
||||
-fx-padding: 0.45em 0.8em 0.45em 0.8em;
|
||||
-fx-border-width: 1px;
|
||||
|
|
|
@ -7,9 +7,6 @@ import lombok.Setter;
|
|||
|
||||
@Getter
|
||||
public enum PredefinedScriptGroup {
|
||||
CLINK("Clink", null, false),
|
||||
STARSHIP("Starship", "Sets up and enables the starship shell prompt", true),
|
||||
OHMYPOSH("Oh My Posh", "Sets up and enables the oh-my-posh shell prompt", true),
|
||||
MANAGEMENT("Management", "Some commonly used management scripts", true),
|
||||
FILES("Files", "Scripts for files", true);
|
||||
|
||||
|
|
|
@ -15,52 +15,6 @@ import java.util.function.Supplier;
|
|||
|
||||
@Getter
|
||||
public enum PredefinedScriptStore {
|
||||
CLINK_SETUP("Clink Setup", () -> SimpleScriptStore.builder()
|
||||
.group(PredefinedScriptGroup.CLINK.getEntry())
|
||||
.minimumDialect(ShellDialects.CMD)
|
||||
.commands(file("clink.bat"))
|
||||
.initScript(true)
|
||||
.build()),
|
||||
CLINK_INJECT("Clink Inject", () -> SimpleScriptStore.builder()
|
||||
.group(PredefinedScriptGroup.CLINK.getEntry())
|
||||
.minimumDialect(ShellDialects.CMD)
|
||||
.script(CLINK_SETUP.getEntry())
|
||||
.initScript(true)
|
||||
.commands("""
|
||||
clink inject --quiet
|
||||
""")
|
||||
.build()),
|
||||
STARSHIP_BASH("Starship Bash", () -> SimpleScriptStore.builder()
|
||||
.group(PredefinedScriptGroup.STARSHIP.getEntry())
|
||||
.minimumDialect(ShellDialects.BASH)
|
||||
.commands(file("starship_bash.sh"))
|
||||
.initScript(true)
|
||||
.build()),
|
||||
STARSHIP_ZSH("Starship Zsh", () -> SimpleScriptStore.builder()
|
||||
.group(PredefinedScriptGroup.STARSHIP.getEntry())
|
||||
.minimumDialect(ShellDialects.ZSH)
|
||||
.commands(file("starship_zsh.sh"))
|
||||
.initScript(true)
|
||||
.build()),
|
||||
STARSHIP_FISH("Starship Fish", () -> SimpleScriptStore.builder()
|
||||
.group(PredefinedScriptGroup.STARSHIP.getEntry())
|
||||
.minimumDialect(ShellDialects.FISH)
|
||||
.commands(file("starship_fish.fish"))
|
||||
.initScript(true)
|
||||
.build()),
|
||||
STARSHIP_CMD("Starship Cmd", () -> SimpleScriptStore.builder()
|
||||
.group(PredefinedScriptGroup.STARSHIP.getEntry())
|
||||
.minimumDialect(ShellDialects.CMD)
|
||||
.script(CLINK_SETUP.getEntry())
|
||||
.commands(file(("starship_cmd.bat")))
|
||||
.initScript(true)
|
||||
.build()),
|
||||
STARSHIP_POWERSHELL("Starship Powershell", () -> SimpleScriptStore.builder()
|
||||
.group(PredefinedScriptGroup.STARSHIP.getEntry())
|
||||
.minimumDialect(ShellDialects.POWERSHELL)
|
||||
.commands(file("starship_powershell.ps1"))
|
||||
.initScript(true)
|
||||
.build()),
|
||||
APT_UPDATE("Apt upgrade", () -> SimpleScriptStore.builder()
|
||||
.group(PredefinedScriptGroup.MANAGEMENT.getEntry())
|
||||
.minimumDialect(ShellDialects.SH)
|
||||
|
@ -86,31 +40,6 @@ public enum PredefinedScriptStore {
|
|||
.minimumDialect(null)
|
||||
.commands(file(("git_config.sh")))
|
||||
.runnableScript(true)
|
||||
.build()),
|
||||
OHMYPOSH_CMD("Oh My Posh cmd", () -> SimpleScriptStore.builder()
|
||||
.group(PredefinedScriptGroup.OHMYPOSH.getEntry())
|
||||
.minimumDialect(ShellDialects.CMD)
|
||||
.script(CLINK_SETUP.getEntry())
|
||||
.commands(file(("ohmyposh.bat")))
|
||||
.initScript(true)
|
||||
.build()),
|
||||
OHMYPOSH_BASH("Oh My Posh bash", () -> SimpleScriptStore.builder()
|
||||
.group(PredefinedScriptGroup.OHMYPOSH.getEntry())
|
||||
.minimumDialect(ShellDialects.BASH)
|
||||
.commands(file(("ohmyposh.sh")))
|
||||
.initScript(true)
|
||||
.build()),
|
||||
OHMYPOSH_ZSH("Oh My Posh zsh", () -> SimpleScriptStore.builder()
|
||||
.group(PredefinedScriptGroup.OHMYPOSH.getEntry())
|
||||
.minimumDialect(ShellDialects.ZSH)
|
||||
.commands(file(("ohmyposh.sh")))
|
||||
.initScript(true)
|
||||
.build()),
|
||||
OHMYPOSH_POWERSHELL("Oh My Posh Powershell", () -> SimpleScriptStore.builder()
|
||||
.group(PredefinedScriptGroup.OHMYPOSH.getEntry())
|
||||
.minimumDialect(ShellDialects.POWERSHELL)
|
||||
.commands(file(("ohmyposh.ps1")))
|
||||
.initScript(true)
|
||||
.build());
|
||||
|
||||
private final String name;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package io.xpipe.ext.base.script;
|
||||
|
||||
import io.xpipe.app.core.AppProperties;
|
||||
import io.xpipe.app.ext.DataStorageExtensionProvider;
|
||||
import io.xpipe.app.storage.DataStorage;
|
||||
import io.xpipe.app.storage.DataStoreEntry;
|
||||
|
@ -11,6 +12,11 @@ public class ScriptDataStorageProvider extends DataStorageExtensionProvider {
|
|||
|
||||
@Override
|
||||
public void storageInit() {
|
||||
// Don't regenerate if the user deleted anything
|
||||
if (!AppProperties.get().isInitialLaunch()) {
|
||||
return;
|
||||
}
|
||||
|
||||
DataStorage.get()
|
||||
.addStoreEntryIfNotPresent(DataStoreEntry.createNew(
|
||||
UUID.fromString("a9945ad2-db61-4304-97d7-5dc4330691a7"),
|
||||
|
|
2
version
2
version
|
@ -1 +1 @@
|
|||
16.0-9
|
||||
16.0-10
|
||||
|
|
Loading…
Add table
Reference in a new issue