Fixes [stage]

This commit is contained in:
crschnick
2025-04-21 18:29:33 +00:00
parent 869f5a7977
commit e0c598bc8a
31 changed files with 69 additions and 139 deletions
@@ -16,12 +16,16 @@ public class GuiMode extends PlatformMode {
@Override
public void onSwitchFrom() {
Platform.runLater(() -> {
TrackEvent.info("Closing windows");
Stage.getWindows().stream().toList().forEach(w -> {
w.hide();
// If we are in an externally started shutdown hook, don't close the windows until the platform exits
// That way, it is kept open to block for shutdowns
if (!OperationMode.isInShutdownHook()) {
Platform.runLater(() -> {
TrackEvent.info("Closing windows");
Stage.getWindows().stream().toList().forEach(w -> {
w.hide();
});
});
});
}
}
@Override
@@ -36,6 +36,9 @@ public abstract class OperationMode {
@Getter
private static boolean inShutdown;
@Getter
private static boolean inShutdownHook;
private static OperationMode CURRENT = null;
public static OperationMode map(XPipeDaemonMode mode) {
@@ -71,6 +74,7 @@ public abstract class OperationMode {
return;
}
inShutdownHook = true;
TrackEvent.info("Received SIGTERM externally");
OperationMode.shutdown(false);
}));
@@ -59,13 +59,9 @@ public abstract class ConfigFileTerminalPrompt implements TerminalPrompt {
return Optional.empty();
}
FilePath configFile = getTargetConfigFile(shellControl);
if (configuration == null || configuration.isBlank()) {
shellControl.view().deleteFileIfPossible(configFile);
configFile = null;
} else {
prepareCustomConfigFile(shellControl, configFile);
shellControl.view().writeTextFile(configFile, configuration);
FilePath configFile = null;
if (configuration != null && !configuration.isBlank()) {
configFile = shellControl.view().writeTextFileDeterministic(getTargetConfigFile(shellControl), configuration);
}
var s = shellControl
@@ -158,11 +158,6 @@ public class OhMyPoshTerminalPrompt extends ConfigFileTerminalPrompt {
public void install(ShellControl sc) throws Exception {
if (sc.getShellDialect() == ShellDialects.CMD) {
ClinkHelper.install(sc);
var configDir = getConfigurationDirectory(sc);
sc.view().mkdir(configDir);
sc.view()
.writeTextFile(
configDir.join("oh-my-posh.lua"), "load(io.popen('oh-my-posh init cmd'):read(\"*a\"))()");
}
var dir = getBinaryDirectory(sc);
@@ -189,19 +184,25 @@ public class OhMyPoshTerminalPrompt extends ConfigFileTerminalPrompt {
var lines = new ArrayList<String>();
var dialect = shellControl.getOriginalShellDialect();
if (dialect == ShellDialects.CMD) {
var configDir = getConfigurationDirectory(shellControl);
shellControl.view().mkdir(configDir);
var configFile = configDir.join("oh-my-posh.lua");
if (!shellControl.view().fileExists(configFile)) {
shellControl.view().writeTextFile(configFile, "load(io.popen('oh-my-posh init cmd'):read(\"*a\"))()");
}
lines.add(dialect.addToPathVariableCommand(
List.of(ClinkHelper.getTargetDir(shellControl).toString()), false));
}
var configArg = config != null ? " --config \"" + config + "\"" : "";
if (dialect == ShellDialects.CMD) {
lines.add("clink inject --quiet --profile \"" + getConfigurationDirectory(shellControl) + "\"");
} else if (ShellDialects.isPowershell(shellControl)) {
lines.add("& ([ScriptBlock]::Create((oh-my-posh init $(oh-my-posh get shell) --print" + configArg
+ ") -join \"`n\"))");
} else if (dialect == ShellDialects.FISH) {
lines.add("oh-my-posh init fish" + configArg + " | source");
lines.add("clink inject --quiet --profile \"" + configDir + "\"");
} else {
lines.add("eval \"$(oh-my-posh init " + dialect.getId() + configArg + ")\"");
var configArg = config != null ? " --config \"" + config + "\"" : "";
if (ShellDialects.isPowershell(shellControl)) {
lines.add("& ([ScriptBlock]::Create((oh-my-posh init $(oh-my-posh get shell) --print" + configArg + ") -join \"`n\"))");
} else if (dialect == ShellDialects.FISH) {
lines.add("oh-my-posh init fish" + configArg + " | source");
} else {
lines.add("eval \"$(oh-my-posh init " + dialect.getId() + configArg + ")\"");
}
}
return ShellScript.lines(lines);
}
@@ -91,11 +91,6 @@ disabled = true
public void install(ShellControl sc) throws Exception {
if (sc.getShellDialect() == ShellDialects.CMD) {
ClinkHelper.install(sc);
var configDir = getConfigurationDirectory(sc);
sc.view().mkdir(configDir);
sc.view()
.writeTextFile(
configDir.join("starship.lua"), "load(io.popen('starship init cmd'):read(\"*a\"))()");
}
var dir = getBinaryDirectory(sc);
@@ -119,21 +114,28 @@ disabled = true
protected ShellScript setupTerminalCommand(ShellControl shellControl, FilePath config) throws Exception {
var lines = new ArrayList<String>();
var dialect = shellControl.getOriginalShellDialect();
if (dialect == ShellDialects.CMD) {
lines.add(dialect.addToPathVariableCommand(
List.of(ClinkHelper.getTargetDir(shellControl).toString()), false));
}
if (config != null) {
lines.add(dialect.getSetEnvironmentVariableCommand("STARSHIP_CONFIG", config.toString()));
}
if (dialect == ShellDialects.CMD) {
lines.add("clink inject --quiet --profile \"" + getConfigurationDirectory(shellControl) + "\"");
} else if (ShellDialects.isPowershell(shellControl)) {
lines.add("Invoke-Expression (&starship init powershell)");
} else if (dialect == ShellDialects.FISH) {
lines.add("starship init fish | source");
var configDir = getConfigurationDirectory(shellControl);
shellControl.view().mkdir(configDir);
var configFile = configDir.join("starship.lua");
if (!shellControl.view().fileExists(configFile)) {
shellControl.view().writeTextFile(configFile, "load(io.popen('starship init cmd'):read(\"*a\"))()");
}
lines.add(dialect.addToPathVariableCommand(
List.of(ClinkHelper.getTargetDir(shellControl).toString()), false));
lines.add("clink inject --quiet --profile \"" + configDir + "\"");
} else {
lines.add("eval \"$(starship init " + dialect.getId() + ")\"");
if (ShellDialects.isPowershell(shellControl)) {
lines.add("Invoke-Expression (&starship init powershell)");
} else if (dialect == ShellDialects.FISH) {
lines.add("starship init fish | source");
} else {
lines.add("eval \"$(starship init " + dialect.getId() + ")\"");
}
}
return ShellScript.lines(lines);
}
@@ -100,11 +100,11 @@
-fx-font-size: 0.9em;
}
.store-creator > .top > .choice-comp {
.store-creator > .choice-comp {
-fx-opacity: 0.9;
}
.store-creator > .top > .choice-comp * {
.store-creator > .choice-comp * {
-fx-opacity: 1.0;
}
@@ -19,10 +19,9 @@ public class ShellView {
return shellControl.getShellDialect();
}
public FilePath writeTempTextFileDeterministic(String fileName, String text) throws Exception {
public FilePath writeTextFileDeterministic(FilePath base, String text) throws Exception {
var hash = Math.abs(text.hashCode());
var f = FilePath.of(fileName);
var target = FilePath.of(f.getBaseName().toString() + "-" + hash + f.getExtension());
var target = FilePath.of(base.getBaseName().toString() + "-" + hash + "." + base.getExtension());
if (fileExists(target)) {
return target;
}
@@ -1,16 +0,0 @@
WHERE /q oh-my-posh
IF NOT %ERRORLEVEL%==0 (
IF NOT EXIST "%USERPROFILE%\AppData\Local\Programs\oh-my-posh\bin\oh-my-posh.exe" (
WHERE /q winget
IF NOT %ERRORLEVEL%==0 (
winget install JanDeDobbeleer.OhMyPosh -s winget
) ELSE (
powershell -ExecutionPolicy Bypass -Command "Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://ohmyposh.dev/install.ps1'))"
)
)
SET "PATH=%PATH%;%USERPROFILE%\AppData\Local\Programs\oh-my-posh\bin"
)
MKDIR "%TEMP%\\xpipe\\scriptdata\\ohmyposh" >NUL 2>NUL
ECHO load(io.popen('oh-my-posh init cmd'):read("*a"))() > "%TEMP%\\xpipe\\scriptdata\\ohmyposh\\ohmyposh.lua"
clink inject --quiet --profile "%TEMP%\\xpipe\\scriptdata\\ohmyposh"
@@ -1,11 +0,0 @@
if ( -not Get-Command "oh-my-posh" -ErrorAction SilentlyContinue) {
if ( -not Test-Path "$env:USERPROFILE\AppData\Local\Programs\oh-my-posh\bin\oh-my-posh.exe" -PathType Leaf) {
if (Get-Command "winget" -ErrorAction SilentlyContinue) {
winget install JanDeDobbeleer.OhMyPosh -s winget
} else {
Set-ExecutionPolicy Bypass -Scope Process -Force; Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://ohmyposh.dev/install.ps1'))
}
}
$env:Path += ";$env:USERPROFILE\AppData\Local\Programs\oh-my-posh\bin"
}
& ([ScriptBlock]::Create((oh-my-posh init $(oh-my-posh get shell) --config "$env:POSH_THEMES_PATH\jandedobbeleer.omp.json" --print) -join "`n"))
@@ -1,5 +0,0 @@
test -f ~/.local/bin/oh-my-posh
if [ $? != 0 ]; then
which brew >/dev/null 2>&1 && brew install jandedobbeleer/oh-my-posh/oh-my-posh || curl -s https://ohmyposh.dev/install.sh | bash -s;
fi
eval "$(~/.local/bin/oh-my-posh init $(~/.local/bin/oh-my-posh get shell))"
@@ -1,9 +0,0 @@
dir="/tmp/xpipe/$USER/scriptdata/starship"
export PATH="$PATH:$dir"
which starship > /dev/null 2>&1
if [ "$?" != 0 ]; then
mkdir -p "$dir" && \
which curl > /dev/null && \
curl -sS https://starship.rs/install.sh | sh /dev/stdin -y --bin-dir "$dir" > /dev/null
fi
eval "$(starship init bash)"
@@ -1,9 +0,0 @@
WHERE starship >NUL 2>NUL
IF NOT %ERRORLEVEL%==0 (
winget install starship
SET "PATH=%PATH%;C:\\Program Files\\starship\\bin"
)
MKDIR "%TEMP%\\xpipe\\scriptdata\\starship" >NUL 2>NUL
echo load(io.popen('starship init cmd'):read("*a"))() > "%TEMP%\\xpipe\\scriptdata\\starship\\starship.lua"
clink inject --quiet --profile "%TEMP%\\xpipe\\scriptdata\\starship"
@@ -1,9 +0,0 @@
set dir "/tmp/xpipe/$USER/scriptdata/starship"
export PATH="$PATH:$dir"
which starship > /dev/null 2>&1
if [ $status != 0 ]
mkdir -p "$dir" && \
which curl > /dev/null && \
curl -sS https://starship.rs/install.sh | sh /dev/stdin -y --bin-dir "$dir" > /dev/null
end
starship init fish | source
@@ -1,8 +0,0 @@
if (-not $(Get-Command -ErrorAction SilentlyContinue starship)) {
winget install starship
# Update current process PATH environment variable
$env:Path=([System.Environment]::GetEnvironmentVariable("Path", "Machine"), [System.Environment]::GetEnvironmentVariable("Path", "User")) -match '.' -join ';'
}
Invoke-Expression (&starship init powershell)
@@ -1,9 +0,0 @@
dir="/tmp/xpipe/$USER/scriptdata/starship"
export PATH="$PATH:$dir"
which starship > /dev/null 2>&1
if [ "$?" != 0 ]; then
mkdir -p "$dir" && \
which curl > /dev/null && \
curl -sS https://starship.rs/install.sh | sh /dev/stdin -y --bin-dir "$dir" > /dev/null
fi
eval "$(starship init zsh)"
+1 -1
View File
@@ -1382,7 +1382,7 @@ terminalPromptConfigDescription=Den brugerdefinerede konfigurationsfil, der skal
passwordManagerKey=Nøgle til adgangskodehåndtering
passwordManagerAgent=Ekstern password manager-agent
dockerComposeProject.displayName=Docker compose-projektet
dockerComposeProject.displayDescription=Grupper containere i et sammensat projekt sammen
dockerComposeProject.displayDescription=Grupper containere i et compose-projekt sammen
sshVerboseOutput=Aktiver verbose SSH-output
sshVerboseOutputDescription=Dette udskriver en masse fejlsøgningsinformation, når der oprettes forbindelse via SSH. Nyttig til fejlfinding af problemer med SSH-forbindelser.
dontUseGateway=Brug ikke gateway
+1 -1
View File
@@ -1368,7 +1368,7 @@ terminalPromptConfigDescription=Die benutzerdefinierte Konfigurationsdatei, die
passwordManagerKey=Passwortmanager-Schlüssel
passwordManagerAgent=Externer Passwortmanager-Agent
dockerComposeProject.displayName=Docker compose Projekt
dockerComposeProject.displayDescription=Container eines zusammengesetzten Projekts zusammenfassen
dockerComposeProject.displayDescription=Container eines Compose-Projekts zusammenfassen
sshVerboseOutput=Ausführliche SSH-Ausgabe aktivieren
sshVerboseOutputDescription=Damit werden bei einer Verbindung über SSH viele Debug-Informationen ausgegeben. Nützlich für die Fehlersuche bei Problemen mit SSH-Verbindungen.
dontUseGateway=Verwende kein Gateway
+1 -1
View File
@@ -1402,7 +1402,7 @@ terminalPromptConfigDescription=The custom config file to apply to the prompt. T
passwordManagerKey=Password manager key
passwordManagerAgent=External password manager agent
dockerComposeProject.displayName=Docker compose project
dockerComposeProject.displayDescription=Group containers of a composed project together
dockerComposeProject.displayDescription=Group containers of a compose project together
sshVerboseOutput=Enable verbose SSH output
sshVerboseOutputDescription=This will print a lot of debug information when connecting via SSH. Useful for troubleshooting issues with SSH connections.
dontUseGateway=Don't use gateway
+1 -1
View File
@@ -1337,7 +1337,7 @@ terminalPromptConfigDescription=El archivo de configuración personalizada que s
passwordManagerKey=Clave del gestor de contraseñas
passwordManagerAgent=Agente gestor de contraseñas externo
dockerComposeProject.displayName=Proyecto Docker Compose
dockerComposeProject.displayDescription=Agrupar contenedores de un proyecto compuesto
dockerComposeProject.displayDescription=Agrupar contenedores de un proyecto de composición
sshVerboseOutput=Activar la salida detallada SSH
sshVerboseOutputDescription=Esto imprimirá mucha información de depuración cuando te conectes mediante SSH. Es útil para solucionar problemas con las conexiones SSH.
dontUseGateway=No utilices puerta de enlace
+1 -1
View File
@@ -1376,7 +1376,7 @@ terminalPromptConfigDescription=Le fichier de configuration personnalisé à app
passwordManagerKey=Clé du gestionnaire de mots de passe
passwordManagerAgent=Agent externe de gestion des mots de passe
dockerComposeProject.displayName=Projet Docker compose
dockerComposeProject.displayDescription=Regrouper les conteneurs d'un projet composé
dockerComposeProject.displayDescription=Regrouper les conteneurs d'un projet de composition
sshVerboseOutput=Activer la sortie verbeuse de SSH
sshVerboseOutputDescription=Ceci imprimera beaucoup d'informations de débogage lors d'une connexion via SSH. Utile pour résoudre les problèmes liés aux connexions SSH.
dontUseGateway=N'utilise pas de passerelle
+1 -1
View File
@@ -1337,7 +1337,7 @@ terminalPromptConfigDescription=File konfigurasi khusus untuk diterapkan pada pr
passwordManagerKey=Kunci pengelola kata sandi
passwordManagerAgent=Agen pengelola kata sandi eksternal
dockerComposeProject.displayName=Proyek penulisan Docker
dockerComposeProject.displayDescription=Mengelompokkan wadah dari proyek yang disusun bersama-sama
dockerComposeProject.displayDescription=Mengelompokkan wadah dari proyek penulisan bersama
sshVerboseOutput=Mengaktifkan keluaran SSH yang bertele-tele
sshVerboseOutputDescription=Ini akan mencetak banyak informasi debug saat menyambung melalui SSH. Berguna untuk memecahkan masalah pada koneksi SSH.
dontUseGateway=Jangan gunakan gateway
+1 -1
View File
@@ -1337,7 +1337,7 @@ terminalPromptConfigDescription=Il file di configurazione personalizzato da appl
passwordManagerKey=Chiave del gestore di password
passwordManagerAgent=Agente esterno per la gestione delle password
dockerComposeProject.displayName=Progetto Docker compose
dockerComposeProject.displayDescription=Raggruppa i contenitori di un progetto composto
dockerComposeProject.displayDescription=Raggruppa i contenitori di un progetto di composizione
sshVerboseOutput=Abilita l'output verboso di SSH
sshVerboseOutputDescription=Stampa molte informazioni di debug quando ci si connette tramite SSH. È utile per risolvere i problemi delle connessioni SSH.
dontUseGateway=Non usare il gateway
+1 -1
View File
@@ -1337,7 +1337,7 @@ terminalPromptConfigDescription=プロンプトに適用するカスタムconfig
passwordManagerKey=パスワードマネージャーキー
passwordManagerAgent=外部パスワードマネージャーエージェント
dockerComposeProject.displayName=Docker composeプロジェクト
dockerComposeProject.displayDescription=構成されたプロジェクトのコンテナをグループ化する
dockerComposeProject.displayDescription=コンポーズプロジェクトのコンテナをグループ化する
sshVerboseOutput=冗長なSSH出力を有効にする
sshVerboseOutputDescription=SSHで接続するときに、多くのデバッグ情報を表示する。SSH接続のトラブルシューティングに役立つ。
dontUseGateway=ゲートウェイを使用しない
+1 -1
View File
@@ -1337,7 +1337,7 @@ terminalPromptConfigDescription=Het aangepaste configuratiebestand om toe te pas
passwordManagerKey=Wachtwoordmanager sleutel
passwordManagerAgent=Externe wachtwoordbeheerder agent
dockerComposeProject.displayName=Docker compose project
dockerComposeProject.displayDescription=Groepeer containers van een samengesteld project
dockerComposeProject.displayDescription=Groepeer containers van een compose project
sshVerboseOutput=Uitgebreide SSH-uitvoer inschakelen
sshVerboseOutputDescription=Hiermee wordt veel debug-informatie afgedrukt bij het verbinden via SSH. Nuttig voor het oplossen van problemen met SSH-verbindingen.
dontUseGateway=Gebruik geen gateway
+1 -1
View File
@@ -1338,7 +1338,7 @@ terminalPromptConfigDescription=Niestandardowy plik konfiguracyjny do zastosowan
passwordManagerKey=Klucz menedżera haseł
passwordManagerAgent=Agent zewnętrznego menedżera haseł
dockerComposeProject.displayName=Projekt Docker compose
dockerComposeProject.displayDescription=Grupuj razem kontenery złożonego projektu
dockerComposeProject.displayDescription=Grupuj razem kontenery projektu kompozycji
sshVerboseOutput=Włącz szczegółowe dane wyjściowe SSH
sshVerboseOutputDescription=Spowoduje to wydrukowanie wielu informacji debugowania podczas łączenia się przez SSH. Przydatne do rozwiązywania problemów z połączeniami SSH.
dontUseGateway=Nie używaj bramy
+1 -1
View File
@@ -1337,7 +1337,7 @@ terminalPromptConfigDescription=O arquivo de configuração personalizado para a
passwordManagerKey=Chave do gestor de senhas
passwordManagerAgent=Agente externo de gestão de palavras-passe
dockerComposeProject.displayName=Projeto Docker compose
dockerComposeProject.displayDescription=Agrupa contentores de um projeto composto
dockerComposeProject.displayDescription=Agrupa contentores de um projeto de composição
sshVerboseOutput=Habilita a saída verbosa do SSH
sshVerboseOutputDescription=Imprime muitas informações de depuração ao se conectar via SSH. Útil para solucionar problemas com conexões SSH.
dontUseGateway=Não uses o gateway
+1 -1
View File
@@ -1337,7 +1337,7 @@ terminalPromptConfigDescription=Файл пользовательского ко
passwordManagerKey=Ключ менеджера паролей
passwordManagerAgent=Внешний агент менеджера паролей
dockerComposeProject.displayName=Проект Docker compose
dockerComposeProject.displayDescription=Группировать контейнеры составленного проекта вместе
dockerComposeProject.displayDescription=Группируйте контейнеры проекта compose вместе
sshVerboseOutput=Включить подробный вывод SSH
sshVerboseOutputDescription=При подключении по SSH будет выведено много отладочной информации. Полезно для устранения проблем с SSH-соединениями.
dontUseGateway=Не используй шлюз
+1 -1
View File
@@ -1337,7 +1337,7 @@ terminalPromptConfigDescription=Den anpassade konfigurationsfilen som ska tillä
passwordManagerKey=Nyckel för lösenordshanterare
passwordManagerAgent=Agent för extern lösenordshanterare
dockerComposeProject.displayName=Docker compose-projekt
dockerComposeProject.displayDescription=Gruppera containrar för ett sammansatt projekt tillsammans
dockerComposeProject.displayDescription=Gruppera containrar i ett compose-projekt tillsammans
sshVerboseOutput=Aktivera utförlig SSH-utdata
sshVerboseOutputDescription=Detta skriver ut en hel del felsökningsinformation när du ansluter via SSH. Användbart för felsökning av problem med SSH-anslutningar.
dontUseGateway=Använd inte gateway
+1 -1
View File
@@ -1337,7 +1337,7 @@ terminalPromptConfigDescription=Komut istemine uygulanacak özel yapılandırma
passwordManagerKey=Parola yöneticisi anahtarı
passwordManagerAgent=Harici parola yöneticisi aracısı
dockerComposeProject.displayName=Docker compose projesi
dockerComposeProject.displayDescription=Oluşturulan bir projenin kapsayıcılarını birlikte gruplama
dockerComposeProject.displayDescription=Bir compose projesinin kapsayıcılarını birlikte gruplama
sshVerboseOutput=Ayrıntılı SSH çıktısını etkinleştirme
sshVerboseOutputDescription=Bu, SSH üzerinden bağlanırken birçok hata ayıklama bilgisi yazdıracaktır. SSH bağlantıları ile ilgili sorunları gidermek için kullanışlıdır.
dontUseGateway=Ağ geçidi kullanmayın
+1 -1
View File
@@ -1562,7 +1562,7 @@ terminalPromptConfigDescription=应用于提示符的自定义配置文件。该
passwordManagerKey=密码管理器密钥
passwordManagerAgent=外部密码管理器代理
dockerComposeProject.displayName=Docker compose 项目
dockerComposeProject.displayDescription=组成项目的容器组合在一起
dockerComposeProject.displayDescription=编译项目的容器组合在一起
sshVerboseOutput=启用 SSH 冗余输出
sshVerboseOutputDescription=通过 SSH 连接时,它会打印大量调试信息。有助于排除 SSH 连接的故障。
dontUseGateway=不要使用网关
+1 -1
View File
@@ -1 +1 @@
16.0-50
16.0-51