@@ -21,6 +21,9 @@ interface SpawnArgs {
2121 args ?: string [ ] ;
2222 options ?: SpawnOptions ;
2323 skipStartupScripts ?: true ;
24+ envVars : {
25+ [ key : string ] : string ;
26+ } ;
2427}
2528
2629const getTerminalCommand = _ . memoize ( async ( ) : Promise < SpawnArgs | null > => {
@@ -80,6 +83,7 @@ const getLinuxTerminalCommand = async (): Promise<SpawnArgs | null> => {
8083 const defaultTerminal = gSettingsTerminalKey && gSettingsTerminalKey . getValue ( ) ;
8184 if ( defaultTerminal && await commandExists ( defaultTerminal ) ) {
8285 if ( defaultTerminal . includes ( 'gnome-terminal' ) ) return getGnomeTerminalCommand ( defaultTerminal ) ;
86+ if ( defaultTerminal . includes ( 'kgx' ) ) return getKgxCommand ( defaultTerminal ) ;
8387 if ( defaultTerminal . includes ( 'konsole' ) ) return getKonsoleTerminalCommand ( defaultTerminal ) ;
8488 if ( defaultTerminal . includes ( 'xfce4-terminal' ) ) return getXfceTerminalCommand ( defaultTerminal ) ;
8589 if ( defaultTerminal . includes ( 'x-terminal-emulator' ) ) return getXTerminalCommand ( defaultTerminal ) ;
@@ -91,7 +95,7 @@ const getLinuxTerminalCommand = async (): Promise<SpawnArgs | null> => {
9195 // If a specific term like this is installed, it's probably the preferred one
9296 if ( await commandExists ( 'konsole' ) ) return getKonsoleTerminalCommand ( ) ;
9397 if ( await commandExists ( 'xfce4-terminal' ) ) return getXfceTerminalCommand ( ) ;
94- if ( await commandExists ( 'kgx' ) ) return { command : 'kgx' } ;
98+ if ( await commandExists ( 'kgx' ) ) return getKgxCommand ( ) ;
9599 if ( await commandExists ( 'kitty' ) ) return { command : 'kitty' } ;
96100 if ( await commandExists ( 'urxvt' ) ) return { command : 'urxvt' } ;
97101 if ( await commandExists ( 'rxvt' ) ) return { command : 'rxvt' } ;
@@ -136,6 +140,10 @@ const getXTerminalCommand = async (command = 'x-terminal-emulator'): Promise<Spa
136140 return { command } ;
137141} ;
138142
143+ const getKgxCommand = async ( command = 'kgx' ) : Promise < SpawnArgs > => {
144+ return { command, envVars : { DBUS_SESSION_BUS_ADDRESS : '' } } ;
145+ } ;
146+
139147const getKonsoleTerminalCommand = async ( command = 'konsole' ) : Promise < SpawnArgs > => {
140148 let extraArgs : string [ ] = [ ] ;
141149
@@ -207,7 +215,7 @@ export class FreshTerminalInterceptor implements Interceptor {
207215 const terminalSpawnArgs = await getTerminalCommand ( ) ;
208216 if ( ! terminalSpawnArgs ) throw new Error ( 'Could not find a suitable terminal' ) ;
209217
210- const { command, args, options, skipStartupScripts } = terminalSpawnArgs ;
218+ const { command, args, options, skipStartupScripts, envVars } = terminalSpawnArgs ;
211219
212220 // Our PATH override below may not work, e.g. because OSX's path_helper always prepends
213221 // the real paths over the top, and git-bash ignore env var paths overrides. To fix this,
@@ -230,6 +238,7 @@ export class FreshTerminalInterceptor implements Interceptor {
230238 env : {
231239 ...currentEnv ,
232240 ...getTerminalEnvVars ( proxyPort , this . config . https , currentEnv ) ,
241+ ...envVars ,
233242 } ,
234243 cwd : currentEnv . HOME || currentEnv . USERPROFILE
235244 } )
0 commit comments