mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-06-24 17:10:19 +12:00
Add warning when no known terminal is recognized [release]
This commit is contained in:
parent
90e18d0627
commit
56234f2abf
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue