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);
selected.setValue(model);
if (path != null) {
model.cd(path);
model.initWithGivenDirectory(path);
} else {
model.initDirectory();
model.initWithDefaultDirectory();
}
});
}

View file

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

View file

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

View file

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

View file

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