mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-10-01 09:40:35 +13:00
Properly use startup behavior setting
This commit is contained in:
parent
8143f69da2
commit
bf5b8c8857
4 changed files with 21 additions and 19 deletions
|
@ -6,6 +6,7 @@ import io.xpipe.app.core.mode.OperationMode;
|
|||
import io.xpipe.app.issue.ErrorEvent;
|
||||
import io.xpipe.app.issue.LogErrorHandler;
|
||||
import io.xpipe.app.issue.TrackEvent;
|
||||
import io.xpipe.app.prefs.AppPrefs;
|
||||
import io.xpipe.app.util.ThreadHelper;
|
||||
import io.xpipe.beacon.BeaconServer;
|
||||
import io.xpipe.beacon.exchange.FocusExchange;
|
||||
|
@ -112,7 +113,7 @@ public class LauncherCommand implements Callable<Integer> {
|
|||
return XPipeDaemonMode.get(opModeName);
|
||||
}
|
||||
|
||||
return XPipeDaemonMode.GUI;
|
||||
return AppPrefs.get().startupBehaviour().getValue().getMode();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -80,8 +80,6 @@ public class AppPrefs {
|
|||
FXCollections.observableArrayList(PrefsChoiceValue.getSupported(CloseBehaviour.class)));
|
||||
private final SimpleListProperty<ExternalEditorType> externalEditorList = new SimpleListProperty<>(
|
||||
FXCollections.observableArrayList(PrefsChoiceValue.getSupported(ExternalEditorType.class)));
|
||||
private final SimpleListProperty<ExternalStartupBehaviour> externalStartupBehaviourList = new SimpleListProperty<>(
|
||||
FXCollections.observableArrayList(PrefsChoiceValue.getSupported(ExternalStartupBehaviour.class)));
|
||||
private final SimpleListProperty<String> logLevelList =
|
||||
new SimpleListProperty<>(FXCollections.observableArrayList("trace", "debug", "info", "warn", "error"));
|
||||
private final Map<Object, Class<?>> classMap = new HashMap<>();
|
||||
|
@ -160,11 +158,13 @@ public class AppPrefs {
|
|||
|
||||
// Start behaviour
|
||||
// ===============
|
||||
private final ObjectProperty<ExternalStartupBehaviour> externalStartupBehaviour =
|
||||
typed(new SimpleObjectProperty<>(ExternalStartupBehaviour.TRAY), ExternalStartupBehaviour.class);
|
||||
private final SimpleListProperty<StartupBehaviour> startupBehaviourList = new SimpleListProperty<>(
|
||||
FXCollections.observableArrayList(PrefsChoiceValue.getSupported(StartupBehaviour.class)));
|
||||
private final ObjectProperty<StartupBehaviour> startupBehaviour =
|
||||
typed(new SimpleObjectProperty<>(StartupBehaviour.GUI), StartupBehaviour.class);
|
||||
|
||||
private final SingleSelectionField<ExternalStartupBehaviour> externalStartupBehaviourControl =
|
||||
Field.ofSingleSelectionType(externalStartupBehaviourList, externalStartupBehaviour)
|
||||
private final SingleSelectionField<StartupBehaviour> startupBehaviourControl =
|
||||
Field.ofSingleSelectionType(startupBehaviourList, startupBehaviour)
|
||||
.render(() -> new TranslatableComboBoxControl<>());
|
||||
|
||||
// Close behaviour
|
||||
|
@ -311,8 +311,8 @@ public class AppPrefs {
|
|||
return editorReloadTimeout;
|
||||
}
|
||||
|
||||
public ReadOnlyProperty<ExternalStartupBehaviour> externalStartupBehaviour() {
|
||||
return externalStartupBehaviour;
|
||||
public ReadOnlyProperty<StartupBehaviour> startupBehaviour() {
|
||||
return startupBehaviour;
|
||||
}
|
||||
|
||||
public ReadOnlyBooleanProperty automaticallyUpdate() {
|
||||
|
@ -524,9 +524,10 @@ public class AppPrefs {
|
|||
Group.of(
|
||||
"appBehaviour",
|
||||
Setting.of(
|
||||
"externalStartupBehaviour",
|
||||
externalStartupBehaviourControl,
|
||||
externalStartupBehaviour),
|
||||
"startupBehaviour",
|
||||
startupBehaviourControl,
|
||||
startupBehaviour
|
||||
),
|
||||
Setting.of("closeBehaviour", closeBehaviourControl, closeBehaviour)),
|
||||
Group.of("security", Setting.of("workspaceLock", lockCryptControl, lockCrypt)),
|
||||
Group.of(
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
package io.xpipe.app.prefs;
|
||||
|
||||
import io.xpipe.app.core.mode.OperationMode;
|
||||
import io.xpipe.app.ext.PrefsChoiceValue;
|
||||
import io.xpipe.core.util.XPipeDaemonMode;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum ExternalStartupBehaviour implements PrefsChoiceValue {
|
||||
GUI("app.startGui", OperationMode.GUI),
|
||||
TRAY("app.startInTray", OperationMode.TRAY);
|
||||
public enum StartupBehaviour implements PrefsChoiceValue {
|
||||
GUI("app.startGui", XPipeDaemonMode.GUI),
|
||||
TRAY("app.startInTray", XPipeDaemonMode.TRAY);
|
||||
|
||||
private final String id;
|
||||
private final OperationMode mode;
|
||||
private final XPipeDaemonMode mode;
|
||||
|
||||
public boolean isSelectable() {
|
||||
return true;
|
|
@ -35,8 +35,8 @@ continueInBackground=Continue in background
|
|||
minimizeToTray=Minimize to tray
|
||||
closeBehaviourAlertTitle=Set closing behaviour
|
||||
closeBehaviourAlertTitleHeader=Select what should happen when closing the window.
|
||||
externalStartupBehaviour=External startup behaviour
|
||||
externalStartupBehaviourDescription=Controls the behavior of the desktop application when XPipe is started from for example the CLI or an API.
|
||||
startupBehaviour=Startup behaviour
|
||||
startupBehaviourDescription=Controls the default behavior of the desktop application when XPipe is started.
|
||||
clearCachesAlertTitle=Clean Cache
|
||||
clearCachesAlertTitleHeader=Do you want to clean all XPipe caches?
|
||||
clearCachesAlertTitleContent=Note that this will delete all the data that is stored to improve the user experience.
|
||||
|
|
Loading…
Reference in a new issue