mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-01-23 02:36:05 +00:00
feat: implement progressBarMode none for electron
This commit is contained in:
parent
536a218650
commit
0a64079de7
2 changed files with 21 additions and 4 deletions
5
electron/electronAPI.d.ts
vendored
5
electron/electronAPI.d.ts
vendored
|
|
@ -104,7 +104,10 @@ export interface ElectronAPI {
|
|||
|
||||
setDoneRegisterBeforeClose(id: string): void;
|
||||
|
||||
setProgressBar(args: { progress: number; progressBarMode: 'normal' | 'pause' }): void;
|
||||
setProgressBar(args: {
|
||||
progress: number;
|
||||
progressBarMode: 'normal' | 'pause' | 'none';
|
||||
}): void;
|
||||
|
||||
sendAppSettingsToElectron(globalCfg: GlobalConfigState): void;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,14 @@
|
|||
// FRONTEND EVENTS
|
||||
// ---------------
|
||||
import { app, dialog, globalShortcut, ipcMain, IpcMainEvent, shell } from 'electron';
|
||||
import {
|
||||
app,
|
||||
dialog,
|
||||
globalShortcut,
|
||||
ipcMain,
|
||||
IpcMainEvent,
|
||||
ProgressBarOptions,
|
||||
shell,
|
||||
} from 'electron';
|
||||
import { IPC } from './shared-with-frontend/ipc-events.const';
|
||||
import { lockscreen } from './lockscreen';
|
||||
import { errorHandlerWithFrontendInform } from './error-handler-with-frontend-inform';
|
||||
|
|
@ -83,10 +91,16 @@ export const initIpcInterfaces = (): void => {
|
|||
}
|
||||
});
|
||||
|
||||
ipcMain.on(IPC.SET_PROGRESS_BAR, (ev, { progress, mode }) => {
|
||||
ipcMain.on(IPC.SET_PROGRESS_BAR, (ev, { progress, progressBarMode }) => {
|
||||
const mainWin = getWin();
|
||||
if (mainWin) {
|
||||
mainWin.setProgressBar(Math.min(Math.max(progress, 0), 1), { mode });
|
||||
if (progressBarMode === 'none') {
|
||||
mainWin.setProgressBar(-1);
|
||||
} else {
|
||||
mainWin.setProgressBar(Math.min(Math.max(progress, 0), 1), {
|
||||
mode: progressBarMode as ProgressBarOptions['mode'],
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue