Skip to content

Commit

Permalink
Added terminal preferences to control which shell & which shell argum…
Browse files Browse the repository at this point in the history
…ents to use

Signed-off-by: Luca Jaeger <[email protected]>
  • Loading branch information
owlJaeger committed Apr 23, 2020
1 parent 66dd2bc commit 4b989d0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
10 changes: 10 additions & 0 deletions packages/terminal/src/browser/terminal-preferences.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ import { EDITOR_FONT_DEFAULTS } from '@theia/editor/lib/browser';
export const TerminalConfigSchema: PreferenceSchema = {
type: 'object',
properties: {
'terminal.shellPath': {
type: 'string',
description: 'Controls what shell to use',
},
'terminal.shellArgs': {
type: 'array',
description: 'Controls what shell arguments to use',
},
'terminal.enableCopy': {
type: 'boolean',
description: 'Enable ctrl-c (cmd-c on macOS) to copy selected text',
Expand Down Expand Up @@ -111,6 +119,8 @@ export const TerminalConfigSchema: PreferenceSchema = {
};

export interface TerminalConfiguration {
'terminal.shellPath': string
'terminal.shellArgs': string
'terminal.enableCopy': boolean
'terminal.enablePaste': boolean
'terminal.integrated.fontFamily': string
Expand Down
12 changes: 10 additions & 2 deletions packages/terminal/src/browser/terminal-widget-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,8 @@ export class TerminalWidgetImpl extends TerminalWidget implements StatefulWidget
const { cols, rows } = this.term;

const terminalId = await this.shellTerminalServer.create({
shell: this.options.shellPath,
args: this.options.shellArgs,
shell: this.shellPath || this.options.shellPath,
args: this.shellArgs || this.options.shellArgs,
env: this.options.env,
rootURI,
cols,
Expand Down Expand Up @@ -581,6 +581,14 @@ export class TerminalWidgetImpl extends TerminalWidget implements StatefulWidget
return this.preferences['terminal.enablePaste'];
}

protected get shellPath(): string | undefined {
return this.preferences['terminal.shellPath'];
}

protected get shellArgs(): string | undefined {
return this.preferences['terminal.shellArgs'];
}

protected customKeyHandler(event: KeyboardEvent): boolean {
const keyBindings = KeyCode.createKeyCode(event).toString();
const ctrlCmdCopy = (isOSX && keyBindings === 'meta+c') || (!isOSX && keyBindings === 'ctrl+c');
Expand Down

0 comments on commit 4b989d0

Please sign in to comment.