mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-07-25 08:53:50 +00:00
- Fix isLoading staying true after search results arrive in issue panel - Use getPayloadKey() for correct entity key derivation in conflict resolution - Update archive-wins comments/logs to reflect all op types, not just updates - Add archive-wins unit tests for local/remote archive vs UPDATE/DELETE - Tighten WebDAV archive E2E assertion to deterministic archive-wins check - Add @deprecated JSDoc to legacy pfapi meta-model-ctrl.js - Refactor wasMaximizedBeforeHide from exported let to getter/setter
42 lines
1.2 KiB
TypeScript
42 lines
1.2 KiB
TypeScript
import { app, BrowserWindow } from 'electron';
|
|
import { info } from 'electron-log/main';
|
|
import { getWin, getWasMaximizedBeforeHide } from './main-window';
|
|
import { hideOverlayWindow } from './overlay-indicator/overlay-indicator';
|
|
import { setIsQuiting } from './shared-state';
|
|
|
|
// eslint-disable-next-line prefer-arrow/prefer-arrow-functions
|
|
export function quitApp(): void {
|
|
setIsQuiting(true);
|
|
app.quit();
|
|
}
|
|
|
|
// eslint-disable-next-line prefer-arrow/prefer-arrow-functions
|
|
export function showOrFocus(passedWin: BrowserWindow): void {
|
|
// default to main winpc
|
|
const win = passedWin || getWin();
|
|
|
|
// sometimes when starting a second instance we get here although we don't want to
|
|
if (!win) {
|
|
info(
|
|
'special case occurred when showOrFocus is called even though, this is a second instance of the app',
|
|
);
|
|
return;
|
|
}
|
|
|
|
if (win.isVisible()) {
|
|
win.focus();
|
|
} else {
|
|
// restore explicitly
|
|
if (win.isMinimized()) win.restore();
|
|
win.show();
|
|
if (getWasMaximizedBeforeHide()) win.maximize();
|
|
}
|
|
|
|
// Hide overlay when main window is shown
|
|
hideOverlayWindow();
|
|
|
|
// focus window afterwards always
|
|
setTimeout(() => {
|
|
win.focus();
|
|
}, 60);
|
|
}
|