mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-09-30 00:56:56 +13:00
Fix clear issue for warp properly
This commit is contained in:
parent
8e6d1cafb4
commit
68895cfb55
8 changed files with 39 additions and 16 deletions
|
@ -2,6 +2,7 @@ package io.xpipe.app.exchange;
|
|||
|
||||
import io.xpipe.beacon.BeaconHandler;
|
||||
import io.xpipe.beacon.exchange.LaunchExchange;
|
||||
import io.xpipe.core.process.TerminalInitScriptConfig;
|
||||
import io.xpipe.core.store.LaunchableStore;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
@ -15,7 +16,7 @@ public class LaunchExchangeImpl extends LaunchExchange
|
|||
public Response handleRequest(BeaconHandler handler, Request msg) throws Exception {
|
||||
var store = getStoreEntryById(msg.getId(), false);
|
||||
if (store.getStore() instanceof LaunchableStore s) {
|
||||
var command = s.prepareLaunchCommand().prepareTerminalOpen(store.getName());
|
||||
var command = s.prepareLaunchCommand().prepareTerminalOpen(TerminalInitScriptConfig.ofName(store.getName()));
|
||||
return Response.builder().command(split(command)).build();
|
||||
}
|
||||
|
||||
|
|
|
@ -580,6 +580,10 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
|
|||
return true;
|
||||
}
|
||||
|
||||
default boolean shouldClear() {
|
||||
return true;
|
||||
}
|
||||
|
||||
default void launch(LaunchConfiguration configuration) throws Exception {}
|
||||
|
||||
class MacOsTerminalType extends ExternalApplicationType.MacApplication implements ExternalTerminalType {
|
||||
|
@ -706,6 +710,11 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
|
|||
super("app.warp", "Warp");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldClear() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void launch(LaunchConfiguration configuration) throws Exception {
|
||||
if (!MacOsPermissions.waitForAccessibilityPermissions()) {
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
package io.xpipe.app.util;
|
||||
|
||||
import io.xpipe.app.issue.TrackEvent;
|
||||
import io.xpipe.core.process.*;
|
||||
import io.xpipe.core.store.FileNames;
|
||||
import io.xpipe.core.store.LocalStore;
|
||||
import io.xpipe.core.process.OsType;
|
||||
import io.xpipe.core.process.ShellControl;
|
||||
import io.xpipe.core.process.ShellDialect;
|
||||
import io.xpipe.core.process.ShellDialects;
|
||||
import io.xpipe.core.util.SecretValue;
|
||||
import lombok.SneakyThrows;
|
||||
|
||||
|
@ -44,18 +41,18 @@ public class ScriptHelper {
|
|||
}
|
||||
}
|
||||
|
||||
public static String constructInitFile(ShellControl processControl, List<String> init, String toExecuteInShell, String displayName)
|
||||
public static String constructInitFile(ShellControl processControl, List<String> init, String toExecuteInShell, TerminalInitScriptConfig config)
|
||||
throws Exception {
|
||||
return constructInitFile(processControl.getShellDialect(), processControl, init, toExecuteInShell, displayName);
|
||||
return constructInitFile(processControl.getShellDialect(), processControl, init, toExecuteInShell, config);
|
||||
}
|
||||
|
||||
public static String constructInitFile(ShellDialect t, ShellControl processControl, List<String> init, String toExecuteInShell, String displayName)
|
||||
public static String constructInitFile(ShellDialect t, ShellControl processControl, List<String> init, String toExecuteInShell, TerminalInitScriptConfig config)
|
||||
throws Exception {
|
||||
String nl = t.getNewLine().getNewLineString();
|
||||
var content = "";
|
||||
|
||||
var clear = t.clearDisplayCommand();
|
||||
if (clear != null) {
|
||||
if (clear != null && config.isClearScreen()) {
|
||||
content += clear + nl;
|
||||
}
|
||||
|
||||
|
@ -71,8 +68,8 @@ public class ScriptHelper {
|
|||
content += nl + applyProfilesCommand + nl;
|
||||
}
|
||||
|
||||
if (displayName != null) {
|
||||
content += nl + t.changeTitleCommand(displayName) + nl;
|
||||
if (config.getDisplayName() != null) {
|
||||
content += nl + t.changeTitleCommand(config.getDisplayName()) + nl;
|
||||
}
|
||||
|
||||
content += nl + String.join(nl, init.stream().filter(s -> s != null).toList()) + nl;
|
||||
|
|
|
@ -7,13 +7,13 @@ import io.xpipe.app.prefs.ExternalTerminalType;
|
|||
import io.xpipe.app.storage.DataStorage;
|
||||
import io.xpipe.app.storage.DataStoreEntry;
|
||||
import io.xpipe.core.process.ProcessControl;
|
||||
import io.xpipe.core.process.TerminalInitScriptConfig;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class TerminalHelper {
|
||||
|
||||
public static void open(String title, ProcessControl cc) throws Exception {
|
||||
var command = cc.prepareTerminalOpen(title);
|
||||
open(null, title, cc);
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@ public class TerminalHelper {
|
|||
: "";
|
||||
var cleanTitle = (title != null ? title : entry != null ? entry.getName() : "?");
|
||||
var adjustedTitle = prefix + cleanTitle;
|
||||
var file = ScriptHelper.createLocalExecScript(cc.prepareTerminalOpen(adjustedTitle));
|
||||
var file = ScriptHelper.createLocalExecScript(cc.prepareTerminalOpen(new TerminalInitScriptConfig(adjustedTitle, type.shouldClear())));
|
||||
var config = new ExternalTerminalType.LaunchConfiguration(entry != null ? color : null, adjustedTitle, cleanTitle, file);
|
||||
try {
|
||||
type.launch(config);
|
||||
|
|
|
@ -16,7 +16,7 @@ public interface ProcessControl extends AutoCloseable {
|
|||
|
||||
void resetData();
|
||||
|
||||
String prepareTerminalOpen(String displayName) throws Exception;
|
||||
String prepareTerminalOpen(TerminalInitScriptConfig config) throws Exception;
|
||||
|
||||
void closeStdin() throws IOException;
|
||||
|
||||
|
|
|
@ -76,9 +76,9 @@ public interface ShellControl extends ProcessControl {
|
|||
|
||||
ShellControl withErrorFormatter(Function<String, String> formatter);
|
||||
|
||||
String prepareTerminalOpen(String displayName) throws Exception;
|
||||
String prepareTerminalOpen(TerminalInitScriptConfig config) throws Exception;
|
||||
|
||||
String prepareIntermediateTerminalOpen(String content, String displayName) throws Exception;
|
||||
String prepareIntermediateTerminalOpen(String content, TerminalInitScriptConfig config) throws Exception;
|
||||
|
||||
String getSystemTemporaryDirectory();
|
||||
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
package io.xpipe.core.process;
|
||||
|
||||
import lombok.Value;
|
||||
|
||||
@Value
|
||||
public class TerminalInitScriptConfig {
|
||||
|
||||
public static TerminalInitScriptConfig ofName(String name) {
|
||||
return new TerminalInitScriptConfig(name, true);
|
||||
}
|
||||
|
||||
String displayName;
|
||||
boolean clearScreen;
|
||||
}
|
2
dist/changelogs/1.7.9.md
vendored
2
dist/changelogs/1.7.9.md
vendored
|
@ -11,6 +11,8 @@ If you chose to use an SSH git URL, you can also set key-based authentication op
|
|||
|
||||
Lastly, there is now a general data directory as well in which you can put any additional files like SSH keys that you want to include in the repository. You can then refer to them just as normal within XPipe but their file paths are automatically adapted on any system you clone the repository. You can open this data directory from the settings menu.
|
||||
|
||||
It is recommended to start with the git repository from scratch though to it properly fix past issues.
|
||||
|
||||
### Other changes
|
||||
|
||||
- Fix some windows being shown outside of screen bounds when display scaling values were set very high
|
||||
|
|
Loading…
Reference in a new issue