This commit is contained in:
crschnick
2026-03-21 15:38:10 +00:00
parent fd2df3e912
commit 88f720e27c
4 changed files with 41 additions and 5 deletions
@@ -90,11 +90,11 @@ public class AppTheme {
r.pseudoClassStateChanged(PseudoClass.getPseudoClass(OsType.ofLocal().getId()), true);
Theme.ALL.forEach(theme -> {
r.pseudoClassStateChanged(
PseudoClass.getPseudoClass(theme.getCssId()),
theme.getCssId().equals(t.getCssId()));
});
if (t != null) {
Theme.ALL.forEach(theme -> {
r.pseudoClassStateChanged(PseudoClass.getPseudoClass(theme.getCssId()), theme.getCssId().equals(t.getCssId()));
});
}
if (t != null) {
r.pseudoClassStateChanged(LIGHT, !t.isDark());
@@ -133,6 +133,7 @@ public class TerminalDockView {
terminal.restoreStyle();
terminal.close();
// If the process blocked the exit, still don't track it anymore
terminalInstances.remove(terminal);
}
@@ -105,6 +105,20 @@ public class TerminalMultiplexerManager {
}
public static Optional<UUID> getActiveMultiplexerContainerRequest() {
var mult = getEffectiveMultiplexer();
if (mult.isEmpty()) {
return Optional.empty();
}
// Check for changed multiplexer
var session = TerminalView.get().getSessions().stream()
.filter(shellSession -> shellSession.getTerminal().isRunning()
&& mult.get() == connectionHubRequests.get(shellSession.getRequest()))
.findFirst();
if (session.isEmpty()) {
return Optional.empty();
}
return Optional.ofNullable(runningMultiplexerContainer);
}
@@ -1,10 +1,13 @@
package io.xpipe.app.terminal;
import io.xpipe.app.core.AppSystemInfo;
import io.xpipe.app.prefs.AppPrefs;
import io.xpipe.app.process.*;
import io.xpipe.app.util.ThreadHelper;
import com.fasterxml.jackson.annotation.JsonTypeName;
import io.xpipe.core.FilePath;
import io.xpipe.core.OsType;
import lombok.Builder;
import lombok.SneakyThrows;
import lombok.extern.jackson.Jacksonized;
@@ -74,6 +77,16 @@ public class ZellijTerminalMultiplexer implements TerminalMultiplexer {
@Override
public ShellScript launchNewSession(ShellControl control, TerminalLaunchConfiguration config) throws Exception {
var configFile = getConfigFile(control);
if (control.view().fileExists(configFile)) {
var text = control.view().readTextFile(configFile);
var s = "// show_startup_tips false";
if (text.contains(s)) {
var replaced = text.replace(s, "show_startup_tips false");
control.view().writeTextFile(configFile, replaced);
}
}
var l = new ArrayList<String>();
var firstConfig = config.getPanes().getFirst();
var firstCommand = firstConfig.getDialectLaunchCommand().buildSimple();
@@ -135,6 +148,14 @@ public class ZellijTerminalMultiplexer implements TerminalMultiplexer {
return ShellScript.lines(l);
}
private FilePath getConfigFile(ShellControl sc) throws Exception {
if (sc.getOsType() == OsType.MACOS) {
return sc.view().userHome().join("Library", "Application Support", "org.Zellij-Contributors.Zellij", "config.kdl");
} else {
return sc.view().getEnvironmentVariable("XDG_HOME").map(FilePath::of).orElse(sc.view().userHome().join(".config")).join("zellij", "config.kdl");
}
}
private String escape(String s, boolean spaces, boolean quotes) {
var r = s.replaceAll("\\\\", "\\\\\\\\");
if (quotes) {