mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-07-19 01:17:31 +00:00
- Make overlay window resizable with persisted bounds via simpleStore - Add new OverlayIndicatorConfig section (isEnabled, isAlwaysShow, opacity) - Move setting from misc.isOverlayIndicatorEnabled to overlayIndicator with migration in reducer - Add responsive CSS with scale variable (full/tiny modes) - Add always-show mode that keeps overlay visible when main window is open - Add opacity slider (10-100%) applied as CSS variable - Consolidate overlay init into single updateOverlayEnabled path - Remove dead code: updateOverlayTheme, setIgnoreMouseEvents, unused shortcut param
52 lines
1.4 KiB
TypeScript
52 lines
1.4 KiB
TypeScript
import { app, BrowserWindow } from 'electron';
|
|
import { info } from 'electron-log/main';
|
|
import { getWin, getWasMaximizedBeforeHide } from './main-window';
|
|
import {
|
|
getIsOverlayAlwaysShow,
|
|
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
|
|
if (!getIsOverlayAlwaysShow()) {
|
|
hideOverlayWindow();
|
|
}
|
|
|
|
// focus window afterwards always
|
|
setTimeout(() => {
|
|
if (win.isDestroyed()) return;
|
|
win.focus();
|
|
// Ensure Chromium renderer also gets keyboard focus (electron#20464)
|
|
if (!win.webContents.isDestroyed()) {
|
|
win.webContents.focus();
|
|
}
|
|
}, 60);
|
|
}
|