Small fixes

This commit is contained in:
crschnick 2023-05-19 10:37:11 +00:00
parent 9cb0b7f494
commit 0f8a8a3d02
5 changed files with 40 additions and 23 deletions

View file

@ -104,9 +104,9 @@ public class FileBrowserModel {
openFileSystems.add(model); openFileSystems.add(model);
selected.setValue(model); selected.setValue(model);
if (path != null) { if (path != null) {
model.cd(path); model.initWithGivenDirectory(path);
} else { } else {
model.initDirectory(); model.initWithDefaultDirectory();
} }
}); });
} }

View file

@ -335,25 +335,33 @@ public final class OpenFileSystemModel {
}); });
} }
public void initDirectory() throws Exception { public void initWithGivenDirectory(String dir) throws Exception {
BusyProperty.execute(busy, () -> { initSavedState(dir);
var storageEntry = DataStorage.get() cdSyncWithoutCheck(dir);
.getStoreEntryIfPresent(store) }
.map(entry -> entry.getUuid())
.orElse(UUID.randomUUID()); public void initWithDefaultDirectory() throws Exception {
this.savedState.setValue( var dir = FileSystemHelper.getStartDirectory(this);
AppCache.get("browser-state-" + storageEntry, OpenFileSystemSavedState.class, () -> { initSavedState(dir);
try { cdSyncWithoutCheck(dir);
return OpenFileSystemSavedState.builder() }
.lastDirectory(FileSystemHelper.getStartDirectory(this))
.build(); private void initSavedState(String path) {
} catch (Exception e) { var storageEntry = DataStorage.get()
ErrorEvent.fromThrowable(e).handle(); .getStoreEntryIfPresent(store)
return null; .map(entry -> entry.getUuid())
} .orElse(UUID.randomUUID());
})); this.savedState.setValue(
cdSyncWithoutCheck(this.savedState.getValue().getLastDirectory()); AppCache.get("browser-state-" + storageEntry, OpenFileSystemSavedState.class, () -> {
}); try {
return OpenFileSystemSavedState.builder()
.lastDirectory(path)
.build();
} catch (Exception e) {
ErrorEvent.fromThrowable(e).handle();
return null;
}
}));
} }
public void openTerminalAsync(String directory) { public void openTerminalAsync(String directory) {

View file

@ -73,7 +73,7 @@ public class App extends Application {
var titleBinding = Bindings.createStringBinding( var titleBinding = Bindings.createStringBinding(
() -> { () -> {
var base = String.format( var base = String.format(
"X-Pipe Desktop (%s)", AppProperties.get().getVersion()); "xpipe Desktop (%s)", AppProperties.get().getVersion());
var prefix = AppProperties.get().isStaging() ? "[STAGE] " : ""; var prefix = AppProperties.get().isStaging() ? "[STAGE] " : "";
var suffix = XPipeDistributionType.get().getUpdateHandler().getPreparedUpdate().getValue() != null var suffix = XPipeDistributionType.get().getUpdateHandler().getPreparedUpdate().getValue() != null
? String.format( ? String.format(

View file

@ -77,6 +77,10 @@ public class AppTheme {
} }
private static void changeTheme(Theme newTheme) { private static void changeTheme(Theme newTheme) {
if (newTheme == null) {
return;
}
PlatformThread.runLaterIfNeeded(() -> { PlatformThread.runLaterIfNeeded(() -> {
for (Window window : Window.getWindows()) { for (Window window : Window.getWindows()) {
var scene = window.getScene(); var scene = window.getScene();

View file

@ -73,7 +73,7 @@
} }
.browser .status-bar { .browser .status-bar {
-fx-border-width: 1 0 1 0; -fx-border-width: 1 0 0 0;
-fx-border-color: -color-neutral-muted; -fx-border-color: -color-neutral-muted;
} }
@ -126,6 +126,11 @@
-fx-border-color: -color-neutral-muted; -fx-border-color: -color-neutral-muted;
} }
.browser .tab-pane {
-fx-border-width: 0 0 0 1px;
-fx-border-color: -color-neutral-emphasis;
}
.chooser-bar { .chooser-bar {
-fx-border-color: -color-neutral-emphasis; -fx-border-color: -color-neutral-emphasis;
-fx-border-width: 0.1em 0 0 0; -fx-border-width: 0.1em 0 0 0;