Adjust terminal hierarchies

This commit is contained in:
crschnick 2024-11-09 04:08:04 +00:00
parent 27d38c7030
commit dd5881f9ad
3 changed files with 26 additions and 0 deletions

View file

@ -803,6 +803,12 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
} }
}; };
ExternalTerminalType MACOS_TERMINAL = new MacOsType("app.macosTerminal", "Terminal") { ExternalTerminalType MACOS_TERMINAL = new MacOsType("app.macosTerminal", "Terminal") {
@Override
public int getProcessHierarchyOffset() {
return 2;
}
@Override @Override
public boolean supportsTabs() { public boolean supportsTabs() {
return false; return false;
@ -828,6 +834,12 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
} }
}; };
ExternalTerminalType ITERM2 = new MacOsType("app.iterm2", "iTerm") { ExternalTerminalType ITERM2 = new MacOsType("app.iterm2", "iTerm") {
@Override
public int getProcessHierarchyOffset() {
return 3;
}
@Override @Override
public String getWebsite() { public String getWebsite() {
return "https://iterm2.com/"; return "https://iterm2.com/";
@ -859,6 +871,11 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
}; };
ExternalTerminalType WARP = new MacOsType("app.warp", "Warp") { ExternalTerminalType WARP = new MacOsType("app.warp", "Warp") {
@Override
public int getProcessHierarchyOffset() {
return 2;
}
@Override @Override
public String getWebsite() { public String getWebsite() {
return "https://www.warp.dev/"; return "https://www.warp.dev/";

View file

@ -154,6 +154,11 @@ public interface KittyTerminalType extends ExternalTerminalType {
super("app.kitty", "kitty"); super("app.kitty", "kitty");
} }
@Override
public int getProcessHierarchyOffset() {
return 1;
}
@Override @Override
public void launch(LaunchConfiguration configuration) throws Exception { public void launch(LaunchConfiguration configuration) throws Exception {
// We use the absolute path to force the usage of macOS netcat // We use the absolute path to force the usage of macOS netcat

View file

@ -132,6 +132,10 @@ public class TerminalView {
} }
var off = trackableTerminalType.getProcessHierarchyOffset(); var off = trackableTerminalType.getProcessHierarchyOffset();
if (AppPrefs.get().enableTerminalLogging().get() && OsType.getLocal() != OsType.WINDOWS) {
off += 2;
}
var current = Optional.of(shell); var current = Optional.of(shell);
for (int i = 0; i < 1 + off; i++) { for (int i = 0; i < 1 + off; i++) {
current = current.flatMap(processHandle -> processHandle.parent()); current = current.flatMap(processHandle -> processHandle.parent());