From f9639f0884d57007173d504a3cf0b96e7f118585 Mon Sep 17 00:00:00 2001 From: Lauri Nevala Date: Fri, 19 Feb 2021 18:11:03 +0200 Subject: [PATCH] Allow to define the path of the shell in app preferences Signed-off-by: Lauri Nevala --- src/common/user-store.ts | 1 + src/main/shell-session.ts | 7 ++++--- .../components/+preferences/preferences.tsx | 13 ++++++++++++- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/common/user-store.ts b/src/common/user-store.ts index b0294d9e5a..3df9125224 100644 --- a/src/common/user-store.ts +++ b/src/common/user-store.ts @@ -20,6 +20,7 @@ export interface UserStoreModel { export interface UserPreferences { httpsProxy?: string; + shell?: string; colorTheme?: string; allowUntrustedCAs?: boolean; allowTelemetry?: boolean; diff --git a/src/main/shell-session.ts b/src/main/shell-session.ts index 9e5af371f7..f9e44dad0a 100644 --- a/src/main/shell-session.ts +++ b/src/main/shell-session.ts @@ -105,13 +105,14 @@ export class ShellSession extends EventEmitter { protected async getShellEnv() { const env = JSON.parse(JSON.stringify(await shellEnv())); const pathStr = [this.kubectlBinDir, this.helmBinDir, process.env.PATH].join(path.delimiter); + const shell = userStore.preferences.shell && userStore.preferences.shell !== "" ? userStore.preferences.shell : process.env.SHELL; if(isWindows) { env["SystemRoot"] = process.env.SystemRoot; - env["PTYSHELL"] = process.env.SHELL || "powershell.exe"; + env["PTYSHELL"] = shell || "powershell.exe"; env["PATH"] = pathStr; - } else if(typeof(process.env.SHELL) != "undefined") { - env["PTYSHELL"] = process.env.SHELL; + } else if(typeof(shell) != "undefined") { + env["PTYSHELL"] = shell; env["PATH"] = pathStr; } else { env["PTYSHELL"] = ""; // blank runs the system default shell diff --git a/src/renderer/components/+preferences/preferences.tsx b/src/renderer/components/+preferences/preferences.tsx index 56e881d9f5..17df93a363 100644 --- a/src/renderer/components/+preferences/preferences.tsx +++ b/src/renderer/components/+preferences/preferences.tsx @@ -25,6 +25,7 @@ export class Preferences extends React.Component { @observable helmRepos: HelmRepo[] = []; @observable helmAddedRepos = observable.map(); @observable httpProxy = userStore.preferences.httpsProxy || ""; + @observable shell = userStore.preferences.shell || ""; @computed get themeOptions(): SelectOption[] { return themeStore.themes.map(theme => ({ @@ -130,7 +131,17 @@ export class Preferences extends React.Component { Proxy is used only for non-cluster communication. - +

Terminal Shell

+ this.shell = v} + onBlur={() => preferences.shell = this.shell} + /> + + The path of the shell that the terminal uses. +

Helm