Shell fixes for bsd and opnsense

This commit is contained in:
crschnick 2023-10-10 05:41:30 +00:00
parent 7638d8404a
commit cad89dd337
11 changed files with 40 additions and 4 deletions

View file

@ -31,6 +31,7 @@ public class GuiErrorHandler extends GuiErrorHandlerBase implements ErrorHandler
if (event.getThrowable() instanceof LicenseRequiredException lex) {
LicenseProvider.get().showLicenseAlert(lex);
event.setShouldSendDiagnostics(true);
} else {
ErrorHandlerComp.showAndTryWait(event, true);
}

View file

@ -46,6 +46,11 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
ExternalTerminalType POWERSHELL_WINDOWS = new SimplePathType("app.powershell", "powershell") {
@Override
public boolean supportsColoredTitle() {
return false;
}
@Override
protected CommandBuilder toCommand(String name, String file) {
return CommandBuilder.of()
@ -60,6 +65,11 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
ExternalTerminalType PWSH_WINDOWS = new SimplePathType("app.pwsh", "pwsh") {
@Override
public boolean supportsColoredTitle() {
return false;
}
@Override
protected CommandBuilder toCommand(String name, String file) {
// Fix for https://github.com/PowerShell/PowerShell/issues/18530#issuecomment-1325691850
@ -243,6 +253,11 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
ExternalTerminalType KONSOLE = new SimplePathType("app.konsole", "konsole") {
@Override
public boolean supportsColoredTitle() {
return false;
}
@Override
protected CommandBuilder toCommand(String name, String file) {
// Note for later: When debugging konsole launches, it will always open as a child process of
@ -309,7 +324,7 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
@Override
protected CommandBuilder toCommand(String name, String file) {
return CommandBuilder.of().add("-T").addQuoted(name).addQuoted(file);
return CommandBuilder.of().add("-1").add("-T").addQuoted(name).addQuoted(file);
}
@Override
@ -533,6 +548,11 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
super("app.custom");
}
@Override
public boolean supportsColoredTitle() {
return false;
}
@Override
public void launch(LaunchConfiguration configuration) throws Exception {
var custom = AppPrefs.get().customTerminalCommand().getValue();

View file

@ -212,6 +212,10 @@ public abstract class DataStorage {
}
public DataStoreEntry getRootForEntry(DataStoreEntry entry) {
if (entry == null) {
return null;
}
if (isRootEntry(entry)) {
return entry;
}

View file

@ -12,7 +12,7 @@ public class LicenseRequiredException extends RuntimeException {
LicenseType minLicense;
public LicenseRequiredException(String featureName, boolean plural, LicenseType minLicense) {
super(featureName + " are only supported with a " + minLicense.name().toLowerCase() + " license");
super(featureName + (plural ? " are" : " is") + " only supported with a " + minLicense.name().toLowerCase() + " license");
this.featureName = featureName;
this.plural = plural;
this.minLicense = minLicense;

View file

@ -23,7 +23,7 @@ public class TerminalHelper {
throw ErrorEvent.unreportable(new IllegalStateException(AppI18n.get("noTerminalSet")));
}
var color = DataStorage.get().getRootForEntry(entry).getColor();
var color = entry != null ? DataStorage.get().getRootForEntry(entry).getColor() : null;
var prefix = entry != null && color != null && type.supportsColoredTitle()
? color.getEmoji() + " "
: "";

View file

@ -0,0 +1 @@
<svg fill="#AB2B28" role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>FreeBSD</title><path d="M23.682 2.406c-.001-.149-.097-.187-.24-.189h-.25v.659h.108v-.282h.102l.17.282h.122l-.184-.29c.102-.012.175-.065.172-.18zm-.382.096v-.193h.13c.06-.002.145.011.143.089.005.09-.08.107-.153.103h-.12zM21.851 1.49c1.172 1.171-2.077 6.319-2.626 6.869-.549.548-1.944.044-3.115-1.128-1.172-1.171-1.676-2.566-1.127-3.115.549-.55 5.697-3.798 6.868-2.626zM1.652 6.61C.626 4.818-.544 2.215.276 1.395c.81-.81 3.355.319 5.144 1.334A11.003 11.003 0 0 0 1.652 6.61zm18.95.418a10.584 10.584 0 0 1 1.368 5.218c0 5.874-4.762 10.636-10.637 10.636C5.459 22.882.697 18.12.697 12.246.697 6.371 5.459 1.61 11.333 1.61c1.771 0 3.441.433 4.909 1.199-.361.201-.69.398-.969.574-.428-.077-.778-.017-.998.202-.402.402-.269 1.245.263 2.2.273.539.701 1.124 1.25 1.674.103.104.208.202.315.297 1.519 1.446 3.205 2.111 3.829 1.486.267-.267.297-.728.132-1.287.167-.27.35-.584.538-.927zm2.814-5.088c-.322 0-.584.266-.584.595s.261.595.584.595c.323 0 .584-.266.584-.595s-.261-.595-.584-.595zm0 1.087c-.252 0-.457-.22-.457-.492s.204-.492.457-.492c.252 0 .457.22.457.492s-.204.492-.457.492z"/></svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -0,0 +1 @@
<svg fill="#FF6600" role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>NetBSD</title><path d="M22.686 10.681c0-.181.064-.336.193-.464a.634.634 0 0 1 .464-.193c.182 0 .336.065.465.193a.633.633 0 0 1 .192.464.635.635 0 0 1-.192.465.632.632 0 0 1-.465.193.634.634 0 0 1-.464-.193.634.634 0 0 1-.193-.465zm1.206 0a.53.53 0 0 0-.16-.388.53.53 0 0 0-.389-.16.53.53 0 0 0-.388.16.528.528 0 0 0-.161.388.53.53 0 0 0 .16.389.53.53 0 0 0 .39.161.529.529 0 0 0 .388-.161.53.53 0 0 0 .16-.389zm-.344.396-.207-.349h-.117v.349h-.114v-.808h.207c.194 0 .292.074.292.223 0 .104-.053.177-.157.22l.221.365zm-.324-.71v.27l.076.001c.075 0 .126-.01.151-.028.026-.02.04-.056.04-.11 0-.09-.059-.134-.175-.134h-.092m-3.892 3.28c0 .403.014.667.146.82.132.147.344.213.607.213 1.266 0 1.698-1.127 1.698-2.122 0-1.318-.695-2.1-2.02-2.1-.197 0-.336.036-.38.095-.044.058-.051.197-.051.424v2.67zm-1.046-2.319c0-.695-.015-.834-.352-.87l-.139-.015c-.073-.037-.073-.25.015-.257a30.521 30.521 0 0 1 1.96-.065c.6 0 1.2.059 1.706.241.958.344 1.485 1.208 1.485 2.122 0 .981-.468 1.771-1.31 2.188-.497.25-1.097.344-1.85.344-.345 0-.71-.044-.974-.044-.351 0-.724.008-1.141.022-.059-.044-.059-.22 0-.256l.226-.036c.33-.059.374-.11.374-.783v-2.59m-2.405 3.76c-.673 0-1.09-.19-1.244-.277-.139-.161-.234-.688-.234-1.186.051-.095.22-.102.278-.022.146.476.636 1.149 1.258 1.149.542 0 .79-.373.79-.74 0-.592-.555-.943-.994-1.163-.527-.263-1.098-.702-1.105-1.427 0-.827.636-1.398 1.697-1.398.242 0 .542.03.834.118.095.029.161.043.25.058.057.161.13.556.13 1.047-.036.087-.219.095-.285.022-.124-.374-.439-.908-.965-.908-.483 0-.747.315-.747.68 0 .337.3.645.666.835l.483.256c.454.242 1.032.666 1.032 1.471 0 .9-.74 1.486-1.844 1.486m-4.2-1.354c0 .57.072.93.643.93.542 0 .827-.418.827-1.01 0-.637-.366-1.084-1.068-1.084-.403 0-.403.007-.403.3v.864zm0-1.69c0 .19.007.204.387.204.63 0 .863-.402.863-.841 0-.637-.395-.952-.9-.952-.343 0-.35.06-.35.381zm-1.01-.71c0-.74-.015-.82-.322-.857l-.198-.03c-.066-.036-.08-.255.03-.263.555-.036 1.09-.065 1.821-.065.703 0 1.171.08 1.493.27.314.19.505.498.505.93 0 .615-.52.856-.747.915-.073.014-.146.044-.146.08 0 .022.037.044.103.059.578.124 1.068.504 1.075 1.214.007.673-.395 1.069-.856 1.23-.461.16-1.01.183-1.456.183-.263 0-.541-.03-.754-.03-.358 0-.717.008-1.134.022-.058-.044-.058-.234 0-.256l.213-.044c.329-.065.373-.117.373-.775v-2.584M9.038 12.44c-.095 0-.102.007-.102.168v1.097c0 .41 0 .864.512.864.102 0 .22-.051.307-.11.073.022.117.103.102.19-.204.22-.6.425-1.053.425-.607 0-.82-.351-.82-.834v-1.632c0-.154-.007-.168-.139-.168H7.62c-.08-.03-.103-.176-.044-.227.226-.08.431-.213.607-.33.132-.095.315-.248.541-.57.051-.03.183-.022.22.036v.549c0 .139.007.146.139.146h.651c.037.03.059.074.059.14 0 .08-.022.211-.095.256h-.66m-2.627.475c.103 0 .22-.015.3-.066.037-.022.051-.095.051-.168 0-.241-.139-.402-.388-.402-.307 0-.57.292-.57.526 0 .103.102.11.336.11zm-.483.322c-.168 0-.183.015-.183.132 0 .549.351 1.083 1.032 1.083.205 0 .483-.044.68-.38.08-.015.19.043.19.168-.3.622-.84.834-1.28.834-.988 0-1.522-.695-1.522-1.493 0-.922.666-1.64 1.58-1.64.762 0 1.171.491 1.171 1.055 0 .139-.036.241-.263.241H5.927m-1.255.49c0 .476 0 .937.014 1.179-.05.087-.256.168-.431.168-.008 0-.25-.373-.593-.798l-1.69-2.093c-.417-.527-.666-.826-.798-.936-.036.073-.036.197-.036.468v1.42c0 .593.029 1.141.11 1.339.065.154.234.198.424.234l.205.03c.058.058.044.212 0 .255a26.585 26.585 0 0 0-.98-.022c-.271 0-.542.008-.82.022-.044-.043-.059-.197 0-.256l.124-.022c.198-.044.337-.087.403-.241.073-.198.102-.746.102-1.34v-1.858c0-.402 0-.52-.051-.622-.051-.124-.161-.198-.417-.249l-.205-.029c-.051-.059-.044-.234.03-.256.343.014.709.022 1.009.022.249 0 .46-.008.615-.022.073.33.548.885 1.207 1.668l.614.725c.33.38.535.636.703.805.03-.073.03-.198.03-.33v-1.01c0-.592-.03-1.141-.11-1.339-.067-.153-.227-.197-.425-.234l-.198-.029c-.058-.059-.043-.212 0-.256.396.014.68.022.98.022.272 0 .535-.008.82-.022.044.044.059.197 0 .256l-.131.022c-.19.044-.33.088-.396.242-.08.197-.11.746-.11 1.339v1.749M21.537 3.59c-2.848-1.367-5.425-.715-8.306.148-2.902.868-5.482 1.337-8.381.154l.79 1.41.87 1.557.79 1.41c2.309.652 4.22-.194 6.271-1.22 2.463-1.23 4.688-2.337 7.502-1.696-2.378-1.19-4.534-.895-7.02-.22 2.434-1.24 4.726-2.204 7.484-1.543M13.16 20.478l-2.272-4.385H9.91l2.283 4.826s.23.455.724.203c.493-.25.245-.644.245-.644M4.634 4.025s-.068-.159-.26-.053c-.16.089-.077.253-.077.253l3.004 6.351h.728L4.634 4.025"/></svg>

After

Width:  |  Height:  |  Size: 4.3 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 16 KiB

View file

@ -6,6 +6,7 @@ import io.xpipe.core.charsetter.StreamCharset;
import io.xpipe.core.store.FileSystem;
import io.xpipe.core.util.SecretValue;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.List;
import java.util.Map;
@ -25,7 +26,7 @@ public interface ShellDialect {
.collect(Collectors.joining(" "));
}
default boolean isSupported() {
default boolean isSelectable() {
return true;
}
@ -93,6 +94,10 @@ public interface ShellDialect {
String prepareScriptContent(String content);
default void exit(ShellControl sc) throws IOException {
sc.writeLine("exit");
}
default String getExitCommand() {
return "exit";
}

View file

@ -9,6 +9,7 @@ import java.util.ServiceLoader;
public class ShellDialects {
public static final List<ShellDialect> ALL = new ArrayList<>();
public static ShellDialect OPNSENSE;
public static ShellDialect POWERSHELL;
public static ShellDialect POWERSHELL_CORE;
public static ShellDialect CMD;
@ -31,6 +32,7 @@ public class ShellDialects {
CMD = byName("cmd");
POWERSHELL = byName("powershell");
POWERSHELL_CORE = byName("pwsh");
OPNSENSE = byName("opnsense");
FISH = byName("fish");
DASH = byName("dash");
BASH = byName("bash");

View file

@ -19,6 +19,7 @@ It also enables a custom display and instant updates of the information displaye
### Other changes
- Add support for bsd-based servers
- Fix OPNsense shells timing out
- Make window transparency setting a slider
- Save configuration data more frequently to avoid any data loss