mirror of
https://github.com/xpipe-io/xpipe.git
synced 2026-05-03 03:10:34 +00:00
Rework prefs
This commit is contained in:
@@ -25,7 +25,7 @@ public class OpenSplitHubBatchProvider implements BatchHubProvider<ShellStore> {
|
||||
|
||||
@Override
|
||||
public boolean isActive(DataStoreEntryRef<ShellStore> o) {
|
||||
return TerminalSplitStrategy.getEffectiveSplitStrategy().isPresent();
|
||||
return TerminalSplitStrategy.getEffectiveSplitStrategyObservable().getValue() != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -319,6 +319,12 @@ public class OptionsBuilder {
|
||||
return addComp(Comp.of(() -> new Spacer(size, Orientation.VERTICAL)));
|
||||
}
|
||||
|
||||
public OptionsBuilder name(ObservableValue<String> name) {
|
||||
finishCurrent();
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OptionsBuilder name(String nameKey) {
|
||||
finishCurrent();
|
||||
name = AppI18n.observable(nameKey);
|
||||
|
||||
@@ -31,9 +31,9 @@ public class LoggingCategory extends AppPrefsCategory {
|
||||
.addTitle("sessionLogging")
|
||||
.sub(new OptionsBuilder()
|
||||
.pref(prefs.enableTerminalLogging)
|
||||
.documentationLink(DocumentationLink.API)
|
||||
.addToggle(prefs.enableTerminalLogging)
|
||||
.nameAndDescription("terminalLoggingDirectory")
|
||||
.documentationLink(DocumentationLink.TERMINAL_LOGGING_FILES)
|
||||
.addComp(new ButtonComp(AppI18n.observable("openSessionLogs"), () -> {
|
||||
var dir = AppProperties.get().getDataDir().resolve("sessions");
|
||||
try {
|
||||
|
||||
@@ -172,6 +172,7 @@ public class TerminalCategory extends AppPrefsCategory {
|
||||
== TerminalOpenFormat.NEW_WINDOW_OR_TABBED;
|
||||
},
|
||||
prefs.terminalType());
|
||||
var splitViewSupported = Bindings.isNotNull(TerminalSplitStrategy.getEffectiveSplitStrategyObservable());
|
||||
|
||||
return new OptionsBuilder()
|
||||
.addTitle("terminalConfiguration")
|
||||
@@ -182,13 +183,17 @@ public class TerminalCategory extends AppPrefsCategory {
|
||||
// .sub(terminalInitScript())
|
||||
.sub(
|
||||
new OptionsBuilder()
|
||||
.pref(prefs.terminalSplitStrategy)
|
||||
.name("terminalSplitStrategy")
|
||||
.description(Bindings.createStringBinding(() -> {
|
||||
return AppI18n.get(splitViewSupported.get() ? "terminalSplitStrategyDescription" : "terminalSplitStrategyDisabledDescription");
|
||||
}, splitViewSupported, AppI18n.activeLanguage()))
|
||||
.documentationLink(DocumentationLink.TERMINAL_SPLIT)
|
||||
.addComp(ChoiceComp.ofTranslatable(
|
||||
prefs.terminalSplitStrategy,
|
||||
Arrays.asList(TerminalSplitStrategy.values()),
|
||||
false).maxWidth(getCompWidth()), prefs.terminalSplitStrategy
|
||||
)
|
||||
.disable(Bindings.isNull(TerminalSplitStrategy.getEffectiveSplitStrategyObservable()))
|
||||
.disable(splitViewSupported.not())
|
||||
.pref(prefs.terminalAlwaysPauseOnExit)
|
||||
.addToggle(prefs.terminalAlwaysPauseOnExit)
|
||||
.pref(prefs.clearTerminalOnInit)
|
||||
@@ -235,6 +240,7 @@ public class TerminalCategory extends AppPrefsCategory {
|
||||
proxyChoice.maxWidth(getCompWidth());
|
||||
return new OptionsBuilder()
|
||||
.nameAndDescription("terminalEnvironment")
|
||||
.documentationLink(DocumentationLink.TERMINAL_ENVIRONMENT)
|
||||
.addComp(proxyChoice, ref)
|
||||
.hide(OsType.ofLocal() != OsType.WINDOWS);
|
||||
}
|
||||
|
||||
@@ -50,25 +50,6 @@ public enum TerminalSplitStrategy implements PrefsChoiceValue {
|
||||
}
|
||||
};
|
||||
|
||||
public static Optional<TerminalSplitStrategy> getEffectiveSplitStrategy() {
|
||||
var prefsValue = AppPrefs.get().terminalSplitStrategy().getValue();
|
||||
if (prefsValue == null) {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
var term = AppPrefs.get().terminalType().getValue();
|
||||
if (term == null || !term.supportsSplitView()) {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
var multiplexer = AppPrefs.get().terminalMultiplexer().getValue();
|
||||
if (multiplexer != null && !multiplexer.supportsSplitView()) {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
return Optional.of(prefsValue);
|
||||
}
|
||||
|
||||
private static ObservableObjectValue<TerminalSplitStrategy> splitStrategy = null;
|
||||
|
||||
public static synchronized ObservableObjectValue<TerminalSplitStrategy> getEffectiveSplitStrategyObservable() {
|
||||
@@ -82,13 +63,13 @@ public enum TerminalSplitStrategy implements PrefsChoiceValue {
|
||||
return null;
|
||||
}
|
||||
|
||||
var term = AppPrefs.get().terminalType().getValue();
|
||||
if (term == null || !term.supportsSplitView()) {
|
||||
return null;
|
||||
var multiplexer = AppPrefs.get().terminalMultiplexer().getValue();
|
||||
if (multiplexer != null && multiplexer.supportsSplitView()) {
|
||||
return prefsValue;
|
||||
}
|
||||
|
||||
var multiplexer = AppPrefs.get().terminalMultiplexer().getValue();
|
||||
if (multiplexer != null && !multiplexer.supportsSplitView()) {
|
||||
var term = AppPrefs.get().terminalType().getValue();
|
||||
if (term == null || !term.supportsSplitView()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -86,8 +86,11 @@ public enum DocumentationLink {
|
||||
SERIAL_PORTS("guide/serial#serial-ports"),
|
||||
TERMINAL("guide/terminals#noteworthy-integrations"),
|
||||
TERMINAL_LOGGING("guide/terminals#logging"),
|
||||
TERMINAL_LOGGING_FILES("guide/terminals#output-format"),
|
||||
TERMINAL_MULTIPLEXER("guide/terminals#multiplexers"),
|
||||
TERMINAL_PROMPT("guide/terminals#prompts"),
|
||||
TERMINAL_SPLIT("guide/terminals#split-views"),
|
||||
TERMINAL_ENVIRONMENT("guide/terminals#windows-environments"),
|
||||
TEAM_VAULTS("guide/sync#team-vaults"),
|
||||
SSH_TROUBLESHOOT("troubleshoot/ssh"),
|
||||
NO_EXEC("troubleshoot/noexec"),
|
||||
|
||||
Generated
+5
-5
@@ -1418,7 +1418,8 @@ refreshOpenpubkey=Refresh openpubkey identity
|
||||
refreshOpenpubkeyDescription=Run opkssh refresh to make the openpubkey identity valid again
|
||||
all=All
|
||||
terminalPrompt=Terminal prompt
|
||||
terminalPromptDescription=The terminal prompt tool to use in your remote terminals. Enabling a terminal prompt will automatically set up and configure the prompt tool on the target system when opening a terminal session.\n\nThis does not modify any existing prompt configurations or profile files on a system. This will increase the terminal loading time for the first time while the prompt is being set up on the remote system. Your terminal might need a special font from https://github.com/ryanoasis/nerd-fonts to display the prompt correctly.
|
||||
#force
|
||||
terminalPromptDescription=The terminal prompt tool to use in your remote terminals. Enabling a terminal prompt will automatically set up and configure the prompt tool on the target system when opening a terminal session.\n\nThis does not modify any existing prompt configurations or profile files on a system. This will increase the terminal loading time for the first time while the prompt is being set up on the remote system. Your terminal might need additional fonts to display the prompt correctly.
|
||||
terminalPromptConfiguration=Terminal prompt configuration
|
||||
terminalPromptConfig=Config file
|
||||
terminalPromptConfigDescription=The custom config file to apply to the prompt. This config will be automatically set up on the target system when the terminal is initialized and used as the default prompt config.\n\nIf you want to use the existing default config file on each system, you can leave this field empty.
|
||||
@@ -1694,10 +1695,9 @@ openSftp=Open in SFTP session
|
||||
capslockWarning=You have capslock enabled
|
||||
inherit=Inherit
|
||||
openSplit=Open in Split-View
|
||||
terminalSplitStrategy=Split pane direction
|
||||
terminalSplitStrategyDescription=Controls how terminal tabs are split when using the Open in Split-View functionality in batch mode to open multiple connections in terminal view.
|
||||
terminalSplitStrategyDisabled=Split pane direction (not supported)
|
||||
terminalSplitStrategyDisabledDescription=Controls how terminal tabs are split when using the Open in Split-View functionality in batch mode to open multiple connections in terminal view.\n\nYour current terminal configuration does not support split views.
|
||||
terminalSplitStrategy=Split view direction
|
||||
terminalSplitStrategyDescription=Controls how terminal tabs are split when using the split view functionality in batch mode to open multiple terminal sessions next to each other.
|
||||
terminalSplitStrategyDisabledDescription=Controls how terminal tabs are split when using the split view functionality in batch mode to open multiple terminal sessions next to each other.\n\nYour current terminal configuration does not support split views.
|
||||
horizontal=Horizontal
|
||||
vertical=Vertical
|
||||
balanced=Balanced
|
||||
Reference in New Issue
Block a user