Calling support
This commit is contained in:
parent
83574eb067
commit
d3a27a6442
72 changed files with 3864 additions and 191 deletions
34
ts/services/bounce.ts
Normal file
34
ts/services/bounce.ts
Normal file
|
@ -0,0 +1,34 @@
|
|||
import { app, BrowserWindow, ipcMain } from 'electron';
|
||||
|
||||
let bounceId = -1;
|
||||
|
||||
export function init(win: BrowserWindow) {
|
||||
ipcMain.on('bounce-app-icon-start', (_, isCritical = false) => {
|
||||
if (app.dock) {
|
||||
const type = isCritical ? 'critical' : 'informational';
|
||||
bounceId = app.dock.bounce(type);
|
||||
|
||||
if (bounceId < 0) {
|
||||
return;
|
||||
}
|
||||
} else if (win && win.flashFrame) {
|
||||
win.once('focus', () => {
|
||||
win.flashFrame(false);
|
||||
});
|
||||
win.flashFrame(true);
|
||||
}
|
||||
});
|
||||
|
||||
ipcMain.on('bounce-app-icon-stop', () => {
|
||||
if (app.dock) {
|
||||
if (bounceId < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
app.dock.cancelBounce(bounceId);
|
||||
bounceId = -1;
|
||||
} else if (win && win.flashFrame) {
|
||||
win.flashFrame(false);
|
||||
}
|
||||
});
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue