mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-05-28 12:55:17 -07:00
fix: settings window z-order on Hyprland and Linux app detach (#85)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
export interface ConfigSettingsWindowLike {
|
||||
isDestroyed(): boolean;
|
||||
show(): void;
|
||||
focus(): void;
|
||||
loadFile(path: string): unknown;
|
||||
on(event: 'closed', handler: () => void): unknown;
|
||||
@@ -11,6 +12,7 @@ export interface OpenConfigSettingsWindowDeps<TWindow extends ConfigSettingsWind
|
||||
setSettingsWindow(window: TWindow | null): void;
|
||||
createSettingsWindow(): TWindow;
|
||||
settingsHtmlPath: string;
|
||||
promoteSettingsWindowAboveOverlay?: (window: TWindow) => void;
|
||||
log?: (message: string) => void;
|
||||
}
|
||||
|
||||
@@ -18,9 +20,15 @@ export function createOpenConfigSettingsWindowHandler<TWindow extends ConfigSett
|
||||
deps: OpenConfigSettingsWindowDeps<TWindow>,
|
||||
): () => boolean {
|
||||
return () => {
|
||||
const showAndFocus = (window: TWindow): void => {
|
||||
window.show();
|
||||
window.focus();
|
||||
deps.promoteSettingsWindowAboveOverlay?.(window);
|
||||
};
|
||||
|
||||
const existing = deps.getSettingsWindow();
|
||||
if (existing && !existing.isDestroyed()) {
|
||||
existing.focus();
|
||||
showAndFocus(existing);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -35,7 +43,7 @@ export function createOpenConfigSettingsWindowHandler<TWindow extends ConfigSett
|
||||
window.on('closed', () => {
|
||||
deps.setSettingsWindow(null);
|
||||
});
|
||||
window.focus();
|
||||
showAndFocus(window);
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user