proper visual bell (fixes #131)

This commit is contained in:
Eugene Pankov 2017-07-23 20:55:41 +02:00
parent 49b90f15bc
commit 932ed9b8f2
4 changed files with 11 additions and 6 deletions

Binary file not shown.

View File

@ -32,6 +32,7 @@ export class TerminalTabComponent extends BaseTabComponent {
alternateScreenActive$ = new BehaviorSubject(false) alternateScreenActive$ = new BehaviorSubject(false)
mouseEvent$ = new Subject<Event>() mouseEvent$ = new Subject<Event>()
htermVisible = false htermVisible = false
private bellPlayer: HTMLAudioElement
private io: any private io: any
constructor ( constructor (
@ -84,6 +85,8 @@ export class TerminalTabComponent extends BaseTabComponent {
this.resetZoom() this.resetZoom()
} }
}) })
this.bellPlayer = document.createElement('audio')
this.bellPlayer.src = require<string>('../bell.ogg')
} }
getRecoveryToken (): any { getRecoveryToken (): any {
@ -126,13 +129,15 @@ export class TerminalTabComponent extends BaseTabComponent {
}, 1000) }, 1000)
this.bell$.subscribe(() => { this.bell$.subscribe(() => {
if (this.config.store.terminal.bell !== 'off') { if (this.config.store.terminal.bell === 'visual') {
let bg = preferenceManager.get('background-color')
preferenceManager.set('background-color', 'rgba(128,128,128,.25)') preferenceManager.set('background-color', 'rgba(128,128,128,.25)')
setTimeout(() => { setTimeout(() => {
preferenceManager.set('background-color', bg) this.configure()
}, 125) }, 125)
} }
if (this.config.store.terminal.bell === 'audible') {
this.bellPlayer.play()
}
// TODO audible // TODO audible
}) })
} }
@ -246,7 +251,7 @@ export class TerminalTabComponent extends BaseTabComponent {
preferenceManager.set('font-family', `"${config.terminal.font}", "monospace-fallback", monospace`) preferenceManager.set('font-family', `"${config.terminal.font}", "monospace-fallback", monospace`)
this.setFontSize() this.setFontSize()
preferenceManager.set('enable-bold', true) preferenceManager.set('enable-bold', true)
preferenceManager.set('audible-bell-sound', '') // preferenceManager.set('audible-bell-sound', '')
preferenceManager.set('desktop-notification-bell', config.terminal.bell === 'notification') preferenceManager.set('desktop-notification-bell', config.terminal.bell === 'notification')
preferenceManager.set('enable-clipboard-notice', false) preferenceManager.set('enable-clipboard-notice', false)
preferenceManager.set('receive-encoding', 'raw') preferenceManager.set('receive-encoding', 'raw')

View File

@ -87,7 +87,7 @@ export class ScreenPersistenceProvider extends SessionPersistenceProvider {
let configPath = '/tmp/.termScreenConfig' let configPath = '/tmp/.termScreenConfig'
await fs.writeFile(configPath, ` await fs.writeFile(configPath, `
escape ^^^ escape ^^^
vbell on vbell off
deflogin on deflogin on
defflow off defflow off
term xterm-color term xterm-color

View File

@ -35,7 +35,7 @@ module.exports = {
{ test: /\.scss$/, use: ['to-string-loader', 'css-loader', 'sass-loader'] }, { test: /\.scss$/, use: ['to-string-loader', 'css-loader', 'sass-loader'] },
{ test: /\.css$/, use: ['to-string-loader', 'css-loader'] }, { test: /\.css$/, use: ['to-string-loader', 'css-loader'] },
{ {
test: /\.(ttf|eot|otf|woff|woff2)(\?v=[0-9]\.[0-9]\.[0-9])?$/, test: /\.(ttf|eot|otf|woff|woff2|ogg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: "url-loader", loader: "url-loader",
options: { options: {
limit: 999999999999, limit: 999999999999,