mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-06-28 19:10:57 +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 lombok.Getter;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
public interface ExternalTerminalType extends PrefsChoiceValue {
|
public interface ExternalTerminalType extends PrefsChoiceValue {
|
||||||
|
|
||||||
|
@ -119,7 +120,7 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
|
||||||
|
|
||||||
public static final ExternalTerminalType CUSTOM = new CustomType();
|
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,
|
WINDOWS_TERMINAL,
|
||||||
POWERSHELL,
|
POWERSHELL,
|
||||||
CMD,
|
CMD,
|
||||||
|
@ -130,15 +131,15 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
|
||||||
ITERM2,
|
ITERM2,
|
||||||
MACOS_TERMINAL,
|
MACOS_TERMINAL,
|
||||||
CUSTOM)
|
CUSTOM)
|
||||||
.stream()
|
|
||||||
.filter(terminalType -> terminalType.isSelectable())
|
.filter(terminalType -> terminalType.isSelectable())
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
public static ExternalTerminalType getDefault() {
|
public static ExternalTerminalType getDefault() {
|
||||||
return ALL.stream()
|
return ALL.stream()
|
||||||
|
.filter(externalTerminalType -> !externalTerminalType.equals(CUSTOM))
|
||||||
.filter(terminalType -> terminalType.isAvailable())
|
.filter(terminalType -> terminalType.isAvailable())
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.orElse(CUSTOM);
|
.orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract void launch(String name, String command) throws Exception;
|
public abstract void launch(String name, String command) throws Exception;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package io.xpipe.app.util;
|
package io.xpipe.app.util;
|
||||||
|
|
||||||
|
import io.xpipe.app.core.AppI18n;
|
||||||
import io.xpipe.app.prefs.AppPrefs;
|
import io.xpipe.app.prefs.AppPrefs;
|
||||||
import io.xpipe.core.process.CommandControl;
|
import io.xpipe.core.process.CommandControl;
|
||||||
|
|
||||||
|
@ -17,7 +18,7 @@ public class TerminalHelper {
|
||||||
|
|
||||||
var type = AppPrefs.get().terminalType().getValue();
|
var type = AppPrefs.get().terminalType().getValue();
|
||||||
if (type == null) {
|
if (type == null) {
|
||||||
throw new IllegalStateException("No terminal has been configured to be used");
|
throw new IllegalStateException(AppI18n.get("noTerminalSet"));
|
||||||
}
|
}
|
||||||
|
|
||||||
type.launch(title, command);
|
type.launch(title, command);
|
||||||
|
|
|
@ -120,6 +120,7 @@ gedit=GEdit
|
||||||
leafpad=Leafpad
|
leafpad=Leafpad
|
||||||
mousepad=Mousepad
|
mousepad=Mousepad
|
||||||
pluma=Pluma
|
pluma=Pluma
|
||||||
|
noTerminalSet=No terminal application has been set. Please do so in the settings menu.
|
||||||
textEdit=Text Edit
|
textEdit=Text Edit
|
||||||
sublime=Sublime Text
|
sublime=Sublime Text
|
||||||
newTable=new_table
|
newTable=new_table
|
||||||
|
|
Loading…
Reference in a new issue