Add ability to launch custom terminal editors

This commit is contained in:
crschnick
2025-03-21 14:28:33 +00:00
parent 894b93e3c2
commit 0c0d91b67d
18 changed files with 51 additions and 9 deletions
@@ -117,6 +117,8 @@ public class AppPrefs {
mapLocal(new SimpleObjectProperty<>(), "externalEditor", ExternalEditorType.class, false);
final StringProperty customEditorCommand =
mapLocal(new SimpleStringProperty(""), "customEditorCommand", String.class, false);
final BooleanProperty customEditorCommandInTerminal =
mapLocal(new SimpleBooleanProperty(false), "customEditorCommandInTerminal", Boolean.class, false);
final BooleanProperty automaticallyCheckForUpdates =
mapLocal(new SimpleBooleanProperty(true), "automaticallyCheckForUpdates", Boolean.class, false);
final BooleanProperty encryptAllVaultData =
@@ -405,6 +407,10 @@ public class AppPrefs {
return customEditorCommand;
}
public ObservableBooleanValue customEditorCommandInTerminal() {
return customEditorCommandInTerminal;
}
public final ReadOnlyIntegerProperty editorReloadTimeout() {
return editorReloadTimeout;
}
@@ -47,9 +47,13 @@ public class EditorCategory extends AppPrefsCategory {
prefs.externalEditor, PrefsChoiceValue.getSupported(ExternalEditorType.class), false))
.nameAndDescription("customEditorCommand")
.addComp(new TextFieldComp(prefs.customEditorCommand, true)
.apply(struc -> struc.get().setPromptText("myeditor $FILE"))
.hide(prefs.externalEditor.isNotEqualTo(ExternalEditorType.CUSTOM)))
.addComp(terminalTest))
.apply(struc -> struc.get().setPromptText("myeditor $FILE")))
.hide(prefs.externalEditor.isNotEqualTo(ExternalEditorType.CUSTOM))
.addComp(terminalTest)
.nameAndDescription("customEditorCommandInTerminal")
.addToggle(prefs.customEditorCommandInTerminal)
.hide(prefs.externalEditor.isNotEqualTo(ExternalEditorType.CUSTOM))
)
.buildComp();
}
}
@@ -2,6 +2,7 @@ package io.xpipe.app.prefs;
import io.xpipe.app.ext.PrefsChoiceValue;
import io.xpipe.app.issue.ErrorEvent;
import io.xpipe.app.terminal.TerminalLauncher;
import io.xpipe.app.util.LocalShell;
import io.xpipe.app.util.WindowsRegistry;
import io.xpipe.core.process.CommandBuilder;
@@ -171,10 +172,13 @@ public interface ExternalEditorType extends PrefsChoiceValue {
throw ErrorEvent.expected(new IllegalStateException("No custom editor command specified"));
}
var format =
customCommand.toLowerCase(Locale.ROOT).contains("$file") ? customCommand : customCommand + " $FILE";
ExternalApplicationHelper.startAsync(CommandBuilder.of()
.add(ExternalApplicationHelper.replaceFileArgument(format, "FILE", file.toString())));
var format = customCommand.toLowerCase(Locale.ROOT).contains("$file") ? customCommand : customCommand + " $FILE";
var command = CommandBuilder.of().add(ExternalApplicationHelper.replaceFileArgument(format, "FILE", file.toString()));
if (AppPrefs.get().customEditorCommandInTerminal().get()) {
TerminalLauncher.openDirect(file.toString(), sc -> command.buildFull(sc), AppPrefs.get().terminalType.get());
} else {
ExternalApplicationHelper.startAsync(command);
}
}
@Override
+2
View File
@@ -1335,3 +1335,5 @@ externalLaunchTitle=Anmodning om ekstern lancering
externalLaunchContent=En ekstern terminal har anmodet om at starte en shell-forbindelse. Vil du tillade, at der oprettes shell-forbindelser uden for XPipe?
noScriptStateAvailable=Opdater for at bestemme scriptkompatibilitet ...
documentationDescription=Tjek dokumentationen ud
customEditorCommandInTerminal=Kør en brugerdefineret kommando i en terminal
customEditorCommandInTerminalDescription=Hvis din editor er terminalbaseret, kan du aktivere denne mulighed for automatisk at åbne en terminal og køre kommandoen i terminalsessionen i stedet.\n\nDu kan bruge denne indstilling til editorer som vi, vim, nvim og andre.
+2
View File
@@ -1319,3 +1319,5 @@ externalLaunchTitle=Externe Startanforderung
externalLaunchContent=Ein externes Terminal hat angefragt, eine Shell-Verbindung zu starten. Willst du das Starten von Shell-Verbindungen von außerhalb von XPipe erlauben?
noScriptStateAvailable=Aktualisieren, um die Skriptkompatibilität zu bestimmen ...
documentationDescription=Schau dir die Dokumentation an
customEditorCommandInTerminal=Benutzerdefinierten Befehl in einem Terminal ausführen
customEditorCommandInTerminalDescription=Wenn dein Editor terminalbasiert ist, kannst du diese Option aktivieren, um automatisch ein Terminal zu öffnen und den Befehl stattdessen in der Terminalsitzung auszuführen.\n\nDu kannst diese Option für Editoren wie vi, vim, nvim und andere verwenden.
+2
View File
@@ -1347,3 +1347,5 @@ externalLaunchTitle=External launch request
externalLaunchContent=An external terminal has requested to launch a shell connection. Do you want to allow launching shell connections from outside XPipe?
noScriptStateAvailable=Refresh to determine script compatibility ...
documentationDescription=Check out the documentation
customEditorCommandInTerminal=Run custom command in a terminal
customEditorCommandInTerminalDescription=If your editor is terminal-based, you can enable this option to automatically open a terminal and run the command in the terminal session instead.\n\nYou can use this option for editors like vi, vim, nvim, and others.
+2
View File
@@ -1288,3 +1288,5 @@ externalLaunchTitle=Solicitud de lanzamiento externo
externalLaunchContent=Un terminal externo ha solicitado lanzar una conexión shell. ¿Quieres permitir el lanzamiento de conexiones shell desde fuera de XPipe?
noScriptStateAvailable=Actualizar para determinar la compatibilidad del script ...
documentationDescription=Consulta la documentación
customEditorCommandInTerminal=Ejecutar un comando personalizado en un terminal
customEditorCommandInTerminalDescription=Si tu editor está basado en un terminal, puedes activar esta opción para abrir automáticamente un terminal y ejecutar el comando en la sesión del terminal en su lugar.\n\nPuedes utilizar esta opción para editores como vi, vim, nvim y otros.
+2
View File
@@ -1323,3 +1323,5 @@ externalLaunchTitle=Demande de lancement externe
externalLaunchContent=Un terminal externe a demandé à lancer une connexion shell. Veux-tu autoriser le lancement de connexions shell depuis l'extérieur de XPipe ?
noScriptStateAvailable=Actualise pour déterminer la compatibilité des scripts...
documentationDescription=Vérifie la documentation
customEditorCommandInTerminal=Exécuter une commande personnalisée dans un terminal
customEditorCommandInTerminalDescription=Si ton éditeur est basé sur un terminal, tu peux activer cette option pour ouvrir automatiquement un terminal et exécuter la commande dans la session du terminal à la place.\n\nTu peux utiliser cette option pour des éditeurs comme vi, vim, nvim et d'autres.
+2
View File
@@ -1288,3 +1288,5 @@ externalLaunchTitle=Permintaan peluncuran eksternal
externalLaunchContent=Terminal eksternal telah meminta untuk meluncurkan koneksi shell. Apakah Anda ingin mengizinkan peluncuran koneksi shell dari luar XPipe?
noScriptStateAvailable=Menyegarkan untuk menentukan kompatibilitas skrip ...
documentationDescription=Lihat dokumentasi
customEditorCommandInTerminal=Menjalankan perintah khusus di terminal
customEditorCommandInTerminalDescription=Jika editor Anda berbasis terminal, Anda dapat mengaktifkan opsi ini untuk secara otomatis membuka terminal dan menjalankan perintah dalam sesi terminal.\n\nAnda dapat menggunakan opsi ini untuk editor seperti vi, vim, nvim, dan lainnya.
+2
View File
@@ -1288,3 +1288,5 @@ externalLaunchTitle=Richiesta di lancio esterno
externalLaunchContent=Un terminale esterno ha chiesto di lanciare una connessione shell. Vuoi consentire l'avvio di connessioni shell dall'esterno di XPipe?
noScriptStateAvailable=Aggiorna per determinare la compatibilità dello script ...
documentationDescription=Controlla la documentazione
customEditorCommandInTerminal=Eseguire un comando personalizzato in un terminale
customEditorCommandInTerminalDescription=Se il tuo editor è basato su un terminale, puoi attivare questa opzione per aprire automaticamente un terminale ed eseguire il comando nella sessione del terminale.\n\nPuoi utilizzare questa opzione per editor come vi, vim, nvim e altri.
+2
View File
@@ -1288,3 +1288,5 @@ externalLaunchTitle=外部起動要求
externalLaunchContent=外部端末がシェル接続の起動を要求してきた。XPipeの外部からのシェル接続の起動を許可するか。
noScriptStateAvailable=スクリプトの互換性を判断するためにリフレッシュする...
documentationDescription=ドキュメントをチェックする
customEditorCommandInTerminal=ターミナルでカスタムコマンドを実行する
customEditorCommandInTerminalDescription=エディターがターミナルベースの場合、このオプションを有効にすると、自動的にターミナルが開き、代わりにターミナルセッションでコマンドが実行される。\n\nこのオプションは、vi、vim、nvimなどのエディタに使用できる。
+2
View File
@@ -1288,3 +1288,5 @@ externalLaunchTitle=Extern lanceringsverzoek
externalLaunchContent=Een externe terminal heeft gevraagd om een shellverbinding te starten. Wil je het starten van shellverbindingen van buiten XPipe toestaan?
noScriptStateAvailable=Vernieuwen om scriptcompatibiliteit te bepalen ...
documentationDescription=Bekijk de documentatie
customEditorCommandInTerminal=Een aangepast commando uitvoeren in een terminal
customEditorCommandInTerminalDescription=Als je editor terminalgebaseerd is, kun je deze optie inschakelen om automatisch een terminal te openen en in plaats daarvan het commando in de terminalsessie uit te voeren.\n\nJe kunt deze optie gebruiken voor editors zoals vi, vim, nvim en andere.
+2
View File
@@ -1288,3 +1288,5 @@ externalLaunchTitle=Żądanie uruchomienia zewnętrznego
externalLaunchContent=Zewnętrzny terminal zażądał uruchomienia połączenia powłoki. Czy chcesz zezwolić na uruchamianie połączeń powłoki spoza XPipe?
noScriptStateAvailable=Odśwież, aby określić zgodność skryptu ...
documentationDescription=Sprawdź dokumentację
customEditorCommandInTerminal=Uruchom niestandardowe polecenie w terminalu
customEditorCommandInTerminalDescription=Jeśli twój edytor jest oparty na terminalu, możesz włączyć tę opcję, aby automatycznie otworzyć terminal i zamiast tego uruchomić polecenie w sesji terminala.\n\nMożesz użyć tej opcji dla edytorów takich jak vi, vim, nvim i innych.
+2
View File
@@ -1288,3 +1288,5 @@ externalLaunchTitle=Pedido de lançamento externo
externalLaunchContent=Um terminal externo solicitou o lançamento de uma ligação shell. Pretendes permitir o lançamento de ligações shell a partir do exterior do XPipe?
noScriptStateAvailable=Actualiza para determinar a compatibilidade do script ...
documentationDescription=Verifica a documentação
customEditorCommandInTerminal=Executa um comando personalizado num terminal
customEditorCommandInTerminalDescription=Se o teu editor for baseado em terminal, podes ativar esta opção para abrir automaticamente um terminal e executar o comando na sessão do terminal.\n\nPodes utilizar esta opção para editores como o vi, vim, nvim e outros.
+2
View File
@@ -1288,3 +1288,5 @@ externalLaunchTitle=Запрос на внешний запуск
externalLaunchContent=Внешний терминал запросил запуск shell-соединения. Хочешь ли ты разрешить запуск shell-соединений извне XPipe?
noScriptStateAvailable=Обновите, чтобы определить совместимость скриптов ...
documentationDescription=Ознакомьтесь с документацией
customEditorCommandInTerminal=Запуск пользовательской команды в терминале
customEditorCommandInTerminalDescription=Если твой редактор работает через терминал, ты можешь включить эту опцию, чтобы автоматически открыть терминал и вместо этого выполнить команду в терминальной сессии.\n\nЭту опцию можно использовать для таких редакторов, как vi, vim, nvim и других.
+2
View File
@@ -1288,3 +1288,5 @@ externalLaunchTitle=Begäran om extern lansering
externalLaunchContent=En extern terminal har begärt att få starta en shell-anslutning. Vill du tillåta att shell-anslutningar startas från utanför XPipe?
noScriptStateAvailable=Uppdatera för att fastställa skriptkompatibilitet ...
documentationDescription=Kolla in dokumentationen
customEditorCommandInTerminal=Kör ett anpassat kommando i en terminal
customEditorCommandInTerminalDescription=Om din editor är terminalbaserad kan du aktivera det här alternativet för att automatiskt öppna en terminal och köra kommandot i terminalsessionen istället.\n\nDu kan använda det här alternativet för editorer som vi, vim, nvim och andra.
+2
View File
@@ -1288,3 +1288,5 @@ externalLaunchTitle=Harici fırlatma talebi
externalLaunchContent=Harici bir terminal bir kabuk bağlantısı başlatmak istedi. XPipe dışından kabuk bağlantılarının başlatılmasına izin vermek istiyor musunuz?
noScriptStateAvailable=Komut dosyası uyumluluğunu belirlemek için yenileyin ...
documentationDescription=Belgelere göz atın
customEditorCommandInTerminal=Terminalde özel komut çalıştırma
customEditorCommandInTerminalDescription=Düzenleyiciniz terminal tabanlı ise, otomatik olarak bir terminal açmak ve bunun yerine komutu terminal oturumunda çalıştırmak için bu seçeneği etkinleştirebilirsiniz.\n\nBu seçeneği vi, vim, nvim ve diğerleri gibi editörler için kullanabilirsiniz.
+2 -2
View File
@@ -150,7 +150,6 @@ errorDetails=显示详细信息
updateReadyAlertTitle=更新就绪
updateReadyAlertHeader=$VERSION$ 版本的更新已准备就绪,可以安装
#custom
#custom
updateReadyAlertContent=此操作将安装新版本,并在安装完成后重启 XPipe。
#custom
errorNoDetail=没有错误详细信息
@@ -1470,7 +1469,6 @@ tailscaleId=设备 ID
tailscaleIdDescription=内部 Tailscale 设备 ID
tailscaleHostName=主机名
#custom
#custom
tailscaleHostNameDescription=Tailnet 设备的主机名
tailscaleUsername=用户名
tailscaleUsernameDescription=登录用户
@@ -1516,3 +1514,5 @@ externalLaunchContent=外部终端尝试启动 Shell 连接。是否允许 XPipe
#custom
noScriptStateAvailable=请刷新以检查脚本兼容性...
documentationDescription=查看文档
customEditorCommandInTerminal=在终端中运行自定义命令
customEditorCommandInTerminalDescription=如果编辑器是基于终端的,可以启用此选项自动打开终端,并在终端会话中运行命令。\n\nvi、vim、nvim 等编辑器都可以使用该选项。