Skip to content

Commit

Permalink
Support terminal bell
Browse files Browse the repository at this point in the history
Fixes #32184
  • Loading branch information
Tyriar committed Dec 26, 2017
1 parent 114adf7 commit 397d82d
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/vs/workbench/electron-browser/bootstrap/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src 'self' https: data:; media-src 'none'; child-src 'self'; object-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; connect-src 'self' https:; font-src 'self' https:;">
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src 'self' https: data:; media-src data:; child-src 'self'; object-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; connect-src 'self' https:; font-src 'self' https:;">
</head>
<body class="monaco-shell vs-dark" aria-label="">
<script src="preload.js"></script>
Expand Down
1 change: 1 addition & 0 deletions src/vs/workbench/parts/terminal/common/terminal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export interface ITerminalConfiguration {
commandsToSkipShell: string[];
cwd: string;
confirmOnExit: boolean;
enableBell: boolean;
env: {
linux: { [key: string]: string };
osx: { [key: string]: string };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,11 @@ configurationRegistry.registerConfiguration({
'type': 'boolean',
'default': false
},
'terminal.integrated.enableBell': {
'description': nls.localize('terminal.integrated.enableBell', "Whether the terminal bell is enabled on not."),
'type': 'boolean',
'default': false
},
'terminal.integrated.commandsToSkipShell': {
'description': nls.localize('terminal.integrated.commandsToSkipShell', "A set of command IDs whose keybindings will not be sent to the shell and instead always be handled by Code. This allows the use of keybindings that would normally be consumed by the shell to act the same as when the terminal is not focused, for example ctrl+p to launch Quick Open."),
'type': 'array',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,8 @@ export class TerminalInstance implements ITerminalInstance {
fontFamily: font.fontFamily,
fontSize: font.fontSize,
lineHeight: font.lineHeight,
enableBold: this._configHelper.config.enableBold
enableBold: this._configHelper.config.enableBold,
bellStyle: this._configHelper.config.enableBell ? 'sound' : 'none'
});
if (this._shellLaunchConfig.initialText) {
this._xterm.writeln(this._shellLaunchConfig.initialText);
Expand Down Expand Up @@ -943,6 +944,7 @@ export class TerminalInstance implements ITerminalInstance {
this._setCursorStyle(this._configHelper.config.cursorStyle);
this._setCommandsToSkipShell(this._configHelper.config.commandsToSkipShell);
this._setScrollback(this._configHelper.config.scrollback);
this._setEnableBell(this._configHelper.config.enableBell);
}

private _setCursorBlink(blink: boolean): void {
Expand Down Expand Up @@ -970,6 +972,20 @@ export class TerminalInstance implements ITerminalInstance {
}
}

private _setEnableBell(isEnabled: boolean): void {
if (this._xterm) {
if (this._xterm.getOption('bellStyle') === 'sound') {
if (!this._configHelper.config.enableBell) {
this._xterm.setOption('bellStyle', 'none');
}
} else {
if (this._configHelper.config.enableBell) {
this._xterm.setOption('bellStyle', 'sound');
}
}
}
}

public layout(dimension: Dimension): void {
const terminalWidth = this._evaluateColsAndRows(dimension.width, dimension.height);
if (!terminalWidth) {
Expand Down

0 comments on commit 397d82d

Please sign in to comment.