Add warning when no known terminal is recognized [release]

This commit is contained in:
crschnick 2023-03-29 18:14:04 +00:00
parent 90e18d0627
commit 56234f2abf
4 changed files with 8 additions and 5 deletions

View file

@ -11,6 +11,7 @@ import io.xpipe.core.process.ShellControl;
import lombok.Getter;
import java.util.List;
import java.util.stream.Stream;
public interface ExternalTerminalType extends PrefsChoiceValue {
@ -119,7 +120,7 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
public static final ExternalTerminalType CUSTOM = new CustomType();
public static final List<ExternalTerminalType> ALL = List.of(
public static final List<ExternalTerminalType> ALL = Stream.of(
WINDOWS_TERMINAL,
POWERSHELL,
CMD,
@ -130,15 +131,15 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
ITERM2,
MACOS_TERMINAL,
CUSTOM)
.stream()
.filter(terminalType -> terminalType.isSelectable())
.toList();
public static ExternalTerminalType getDefault() {
return ALL.stream()
.filter(externalTerminalType -> !externalTerminalType.equals(CUSTOM))
.filter(terminalType -> terminalType.isAvailable())
.findFirst()
.orElse(CUSTOM);
.orElse(null);
}
public abstract void launch(String name, String command) throws Exception;

View file

@ -1,5 +1,6 @@
package io.xpipe.app.util;
import io.xpipe.app.core.AppI18n;
import io.xpipe.app.prefs.AppPrefs;
import io.xpipe.core.process.CommandControl;
@ -17,7 +18,7 @@ public class TerminalHelper {
var type = AppPrefs.get().terminalType().getValue();
if (type == null) {
throw new IllegalStateException("No terminal has been configured to be used");
throw new IllegalStateException(AppI18n.get("noTerminalSet"));
}
type.launch(title, command);

View file

@ -120,6 +120,7 @@ gedit=GEdit
leafpad=Leafpad
mousepad=Mousepad
pluma=Pluma
noTerminalSet=No terminal application has been set. Please do so in the settings menu.
textEdit=Text Edit
sublime=Sublime Text
newTable=new_table

View file

@ -1 +1 @@
0.5.24
0.5.25