mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-11-25 09:00:26 +00:00
Various fixes
This commit is contained in:
parent
4e5f09d354
commit
6cf5b8ad45
7 changed files with 29 additions and 16 deletions
|
@ -12,7 +12,7 @@ public class TerminalWaitExchangeImpl extends TerminalWaitExchange {
|
|||
@Override
|
||||
public Object handle(HttpExchange exchange, Request msg) throws BeaconClientException, BeaconServerException {
|
||||
TerminalView.get().open(msg.getRequest(), msg.getPid());
|
||||
TerminalLauncherManager.waitExchange(msg.getRequest());
|
||||
TerminalLauncherManager.waitExchange(msg.getRequest(), msg.getPid());
|
||||
return Response.builder().build();
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ public class AppLayoutComp extends Comp<CompStructure<Pane>> {
|
|||
var sidebarR = sidebar.createRegion();
|
||||
pane.setRight(sidebarR);
|
||||
model.getSelected().addListener((c, o, n) -> {
|
||||
if (o != null && o.equals(model.getEntries().get(3))) {
|
||||
if (o != null && o.equals(model.getEntries().get(2))) {
|
||||
AppPrefs.get().save();
|
||||
DataStorage.get().saveAsync();
|
||||
}
|
||||
|
@ -55,8 +55,6 @@ public class AppLayoutComp extends Comp<CompStructure<Pane>> {
|
|||
if (o != null && o.equals(model.getEntries().get(0))) {
|
||||
StoreViewState.get().updateDisplay();
|
||||
}
|
||||
|
||||
// TerminalView.get().toggleView(model.getEntries().get(2).equals(n));
|
||||
});
|
||||
pane.addEventHandler(KeyEvent.KEY_PRESSED, event -> {
|
||||
sidebarR.getChildrenUnmodifiable().forEach(node -> {
|
||||
|
|
|
@ -52,7 +52,7 @@ public class TileButtonComp extends Comp<TileButtonComp.Structure> {
|
|||
var desc = new Label();
|
||||
desc.textProperty().bind(PlatformThread.sync(description));
|
||||
AppFont.small(desc);
|
||||
desc.setOpacity(0.65);
|
||||
desc.setOpacity(0.8);
|
||||
var text = new VBox(header, desc);
|
||||
text.setSpacing(2);
|
||||
|
||||
|
|
|
@ -56,6 +56,11 @@ public interface TabbyTerminalType extends ExternalTerminalType, TrackableTermin
|
|||
super("app.tabby", "Tabby.exe");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getProcessHierarchyOffset() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRecommended() {
|
||||
return false;
|
||||
|
@ -72,16 +77,15 @@ public interface TabbyTerminalType extends ExternalTerminalType, TrackableTermin
|
|||
.add("run")
|
||||
.addFile(configuration.getScriptFile())
|
||||
.discardOutput());
|
||||
}
|
||||
|
||||
} else {
|
||||
// This is probably not going to work as it does not launch a bat file
|
||||
LocalShell.getShell()
|
||||
.executeSimpleCommand(CommandBuilder.of()
|
||||
LocalShell.getShell().executeSimpleCommand(CommandBuilder.of()
|
||||
.addFile(file.toString())
|
||||
.add("run")
|
||||
.add(configuration.getDialectLaunchCommand())
|
||||
.discardOutput());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Optional<Path> determineInstallation() {
|
||||
|
|
|
@ -22,6 +22,10 @@ public class TerminalLaunchRequest {
|
|||
TerminalInitScriptConfig config;
|
||||
String workingDirectory;
|
||||
|
||||
@Setter
|
||||
@NonFinal
|
||||
long pid;
|
||||
|
||||
@Setter
|
||||
@NonFinal
|
||||
TerminalLaunchResult result;
|
||||
|
|
|
@ -51,7 +51,7 @@ public class TerminalLauncherManager {
|
|||
synchronized (entries) {
|
||||
var req = entries.get(request);
|
||||
if (req == null) {
|
||||
req = new TerminalLaunchRequest(request, processControl, config, directory, null, false, null);
|
||||
req = new TerminalLaunchRequest(request, processControl, config, directory, -1, null, false, null);
|
||||
entries.put(request, req);
|
||||
} else {
|
||||
req.setResult(null);
|
||||
|
@ -74,7 +74,7 @@ public class TerminalLauncherManager {
|
|||
return last.waitForCompletion();
|
||||
}
|
||||
|
||||
public static Path waitExchange(UUID request) throws BeaconClientException, BeaconServerException {
|
||||
public static Path waitExchange(UUID request, long pid) throws BeaconClientException, BeaconServerException {
|
||||
TerminalLaunchRequest req;
|
||||
synchronized (entries) {
|
||||
req = entries.get(request);
|
||||
|
@ -85,6 +85,13 @@ public class TerminalLauncherManager {
|
|||
if (req.isSetupCompleted() && AppPrefs.get().dontAllowTerminalRestart().get()) {
|
||||
throw new BeaconClientException("Terminal session restarts have been disabled in the security settings");
|
||||
}
|
||||
|
||||
var shell = ProcessHandle.of(pid).orElseThrow().parent().orElseThrow();
|
||||
if (req.getPid() != -1 && shell.pid() != req.getPid()) {
|
||||
throw new BeaconClientException("Wrong launch context");
|
||||
}
|
||||
req.setPid(shell.pid());
|
||||
|
||||
if (req.isSetupCompleted()) {
|
||||
submitAsync(req.getRequest(), req.getProcessControl(), req.getConfig(), req.getWorkingDirectory());
|
||||
}
|
||||
|
|
|
@ -16,6 +16,6 @@
|
|||
.dialog-comp .buttons {
|
||||
-fx-padding: 10;
|
||||
-fx-border-color: -color-border-default;
|
||||
-fx-background-color: -color-bg-subtle;
|
||||
-fx-background-color: -color-bg-inset;
|
||||
-fx-border-width: 1 0 0 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue