1
1
mirror of https://github.com/Eugeny/tabby.git synced 2024-12-23 10:32:29 +03:00

fixed bell

This commit is contained in:
Eugene Pankov 2021-05-13 17:30:48 +02:00
parent c9367d04c3
commit ee368a3716
No known key found for this signature in database
GPG Key ID: 5896FCBBDD1CF4F4
3 changed files with 32 additions and 3 deletions

View File

@ -119,3 +119,22 @@ ngb-typeahead-window {
opacity: 1;
}
}
@keyframes terminalShakeFrames {
0% {
transform: translateX(0);
}
25% {
transform: translateX(5px);
}
50% {
transform: translateX(-5px);
}
75% {
transform: translateX(5px);
}
100% {
transform: translateX(0);
}
}

View File

@ -223,7 +223,7 @@ export class BaseTerminalTabComponent extends BaseTabComponent implements OnInit
}
})
this.bellPlayer = document.createElement('audio')
this.bellPlayer.src = require<string>('../bell.ogg')
this.bellPlayer.src = require('../bell.ogg').default
this.contextMenuProviders.sort((a, b) => a.weight - b.weight)
}

View File

@ -24,6 +24,7 @@ export class XTermFrontend extends Frontend {
protected xtermCore: any
protected enableWebGL = false
private xterm: Terminal
private element?: HTMLElement
private configuredFontSize = 0
private configuredLinePadding = 0
private zoom = 0
@ -63,6 +64,9 @@ export class XTermFrontend extends Frontend {
this.copySelection()
}
})
this.xterm.onBell(() => {
this.bell.next()
})
this.xterm.loadAddon(this.fitAddon)
this.xterm.loadAddon(this.serializeAddon)
@ -135,6 +139,7 @@ export class XTermFrontend extends Frontend {
async attach (host: HTMLElement): Promise<void> {
this.configure()
this.element = host
this.xterm.open(host)
this.opened = true
@ -217,7 +222,12 @@ export class XTermFrontend extends Frontend {
}
visualBell (): void {
this.xtermCore.bell()
if (this.element) {
this.element.style.animation = 'none'
setTimeout(() => {
this.element!.style.animation = 'terminalShakeFrames 0.3s ease'
})
}
}
scrollToBottom (): void {