mirror of
https://github.com/xpipe-io/xpipe.git
synced 2026-05-13 00:00:38 +00:00
Rework
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user