mirror of
https://github.com/Vencord/Vesktop.git
synced 2025-02-23 05:35:09 +00:00
popout: fix titlebar close button
This commit is contained in:
parent
8c007476c3
commit
463cd6dc46
3 changed files with 9 additions and 4 deletions
|
@ -21,6 +21,7 @@ import { VENCORD_FILES_DIR, VENCORD_QUICKCSS_FILE, VENCORD_THEMES_DIR } from "./
|
||||||
import { mainWin } from "./mainWindow";
|
import { mainWin } from "./mainWindow";
|
||||||
import { Settings } from "./settings";
|
import { Settings } from "./settings";
|
||||||
import { handle, handleSync } from "./utils/ipcWrappers";
|
import { handle, handleSync } from "./utils/ipcWrappers";
|
||||||
|
import { PopoutWindows } from "./utils/popout";
|
||||||
import { isDeckGameMode, showGamePage } from "./utils/steamOS";
|
import { isDeckGameMode, showGamePage } from "./utils/steamOS";
|
||||||
import { isValidVencordInstall } from "./utils/vencordLoader";
|
import { isValidVencordInstall } from "./utils/vencordLoader";
|
||||||
|
|
||||||
|
@ -74,8 +75,12 @@ handle(IpcEvents.FOCUS, () => {
|
||||||
mainWin.show();
|
mainWin.show();
|
||||||
});
|
});
|
||||||
|
|
||||||
handle(IpcEvents.CLOSE, e => {
|
handle(IpcEvents.CLOSE, (e, key?: string) => {
|
||||||
(BrowserWindow.fromWebContents(e.sender) ?? e.sender).close();
|
const popout = PopoutWindows.get(key!);
|
||||||
|
if (popout) return popout.close();
|
||||||
|
|
||||||
|
const win = BrowserWindow.fromWebContents(e.sender) ?? e.sender;
|
||||||
|
win.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
handle(IpcEvents.MINIMIZE, e => {
|
handle(IpcEvents.MINIMIZE, e => {
|
||||||
|
|
|
@ -52,7 +52,7 @@ const DEFAULT_POPOUT_OPTIONS: BrowserWindowConstructorOptions = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const PopoutWindows = new Map<string, BrowserWindow>();
|
export const PopoutWindows = new Map<string, BrowserWindow>();
|
||||||
|
|
||||||
function focusWindow(window: BrowserWindow) {
|
function focusWindow(window: BrowserWindow) {
|
||||||
window.setAlwaysOnTop(true);
|
window.setAlwaysOnTop(true);
|
||||||
|
|
|
@ -52,7 +52,7 @@ export const VesktopNative = {
|
||||||
},
|
},
|
||||||
win: {
|
win: {
|
||||||
focus: () => invoke<void>(IpcEvents.FOCUS),
|
focus: () => invoke<void>(IpcEvents.FOCUS),
|
||||||
close: () => invoke<void>(IpcEvents.CLOSE),
|
close: (key?: string) => invoke<void>(IpcEvents.CLOSE, key),
|
||||||
minimize: () => invoke<void>(IpcEvents.MINIMIZE),
|
minimize: () => invoke<void>(IpcEvents.MINIMIZE),
|
||||||
maximize: () => invoke<void>(IpcEvents.MAXIMIZE)
|
maximize: () => invoke<void>(IpcEvents.MAXIMIZE)
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Reference in a new issue