diff --git a/resources/js/electron-plugin/dist/server/api/window.js b/resources/js/electron-plugin/dist/server/api/window.js index 8a75ec74..30db398f 100644 --- a/resources/js/electron-plugin/dist/server/api/window.js +++ b/resources/js/electron-plugin/dist/server/api/window.js @@ -41,6 +41,12 @@ router.post('/closable', (req, res) => { (_a = state.windows[id]) === null || _a === void 0 ? void 0 : _a.setClosable(closable); res.sendStatus(200); }); +router.post('/window-button-visibility', (req, res) => { + var _a; + const { id, windowButtonVisibility } = req.body; + (_a = state.windows[id]) === null || _a === void 0 ? void 0 : _a.setWindowButtonVisibility(windowButtonVisibility); + res.sendStatus(200); +}); router.post('/show-dev-tools', (req, res) => { var _a; const { id } = req.body; @@ -145,7 +151,7 @@ function getWindowData(id) { }; } router.post('/open', (req, res) => { - let { id, x, y, frame, width, height, minWidth, minHeight, maxWidth, maxHeight, focusable, skipTaskbar, hiddenInMissionControl, hasShadow, url, resizable, movable, minimizable, maximizable, closable, title, alwaysOnTop, titleBarStyle, trafficLightPosition, vibrancy, backgroundColor, transparency, showDevTools, fullscreen, fullscreenable, kiosk, autoHideMenuBar, webPreferences, zoomFactor, preventLeaveDomain, preventLeavePage, suppressNewWindows, } = req.body; + let { id, x, y, frame, width, height, minWidth, minHeight, maxWidth, maxHeight, focusable, skipTaskbar, hiddenInMissionControl, hasShadow, url, resizable, movable, minimizable, maximizable, closable, title, alwaysOnTop, titleBarStyle, trafficLightPosition, windowButtonVisibility, vibrancy, backgroundColor, transparency, showDevTools, fullscreen, fullscreenable, kiosk, autoHideMenuBar, webPreferences, zoomFactor, preventLeaveDomain, preventLeavePage, suppressNewWindows, } = req.body; if (state.windows[id]) { state.windows[id].show(); state.windows[id].focus(); @@ -202,6 +208,9 @@ router.post('/open', (req, res) => { return { action: "deny" }; }); } + if (process.platform === 'darwin') { + window.setWindowButtonVisibility(windowButtonVisibility); + } window.on('blur', () => { notifyLaravel('events', { event: 'Native\\Laravel\\Events\\Windows\\WindowBlurred', diff --git a/resources/js/electron-plugin/src/server/api/window.ts b/resources/js/electron-plugin/src/server/api/window.ts index 3224919a..b3244930 100644 --- a/resources/js/electron-plugin/src/server/api/window.ts +++ b/resources/js/electron-plugin/src/server/api/window.ts @@ -57,6 +57,14 @@ router.post('/closable', (req, res) => { res.sendStatus(200); }); +router.post('/window-button-visibility', (req, res) => { + const {id, windowButtonVisibility} = req.body; + + state.windows[id]?.setWindowButtonVisibility(windowButtonVisibility); + + res.sendStatus(200); +}); + router.post('/show-dev-tools', (req, res) => { const {id} = req.body; @@ -224,6 +232,7 @@ router.post('/open', (req, res) => { alwaysOnTop, titleBarStyle, trafficLightPosition, + windowButtonVisibility, vibrancy, backgroundColor, transparency, @@ -326,6 +335,10 @@ router.post('/open', (req, res) => { }); } + if (process.platform === 'darwin') { + window.setWindowButtonVisibility(windowButtonVisibility); + } + window.on('blur', () => { notifyLaravel('events', { event: 'Native\\Laravel\\Events\\Windows\\WindowBlurred', diff --git a/resources/js/electron-plugin/tests/setup.ts b/resources/js/electron-plugin/tests/setup.ts index 198961d2..79b95f7b 100644 --- a/resources/js/electron-plugin/tests/setup.ts +++ b/resources/js/electron-plugin/tests/setup.ts @@ -37,6 +37,7 @@ mockForNodeRequire('electron', () => ({ on: vi.fn(), setMenu: vi.fn(), setMenuBarVisibility: vi.fn(), + setWindowButtonVisibility: vi.fn(), webContents: { on: vi.fn(), send: vi.fn(),