fix: bring back maximize button (#3024)
This commit is contained in:
parent
6ee5d16e5c
commit
aecc645a1a
@ -1,4 +1,4 @@
|
|||||||
import { app, ipcMain, dialog, shell, nativeTheme, screen } from 'electron'
|
import { app, ipcMain, dialog, shell, nativeTheme } from 'electron'
|
||||||
import { join } from 'path'
|
import { join } from 'path'
|
||||||
import { windowManager } from '../managers/window'
|
import { windowManager } from '../managers/window'
|
||||||
import {
|
import {
|
||||||
@ -41,12 +41,9 @@ export function handleAppIPCs() {
|
|||||||
windowManager.mainWindow?.minimize()
|
windowManager.mainWindow?.minimize()
|
||||||
})
|
})
|
||||||
|
|
||||||
ipcMain.handle(NativeRoute.setMaximizeApp, async () => {
|
ipcMain.handle(NativeRoute.setMaximizeApp, async (_event) => {
|
||||||
if (windowManager.mainWindow?.isMaximized()) {
|
if (windowManager.mainWindow?.isMaximized()) {
|
||||||
// const bounds = await getBounds()
|
windowManager.mainWindow.unmaximize()
|
||||||
// windowManager.mainWindow?.setSize(bounds.width, bounds.height)
|
|
||||||
// windowManager.mainWindow?.setPosition(Number(bounds.x), Number(bounds.y))
|
|
||||||
windowManager.mainWindow.restore()
|
|
||||||
} else {
|
} else {
|
||||||
windowManager.mainWindow?.maximize()
|
windowManager.mainWindow?.maximize()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,11 +4,12 @@ export const mainWindowConfig: Electron.BrowserWindowConstructorOptions = {
|
|||||||
skipTaskbar: false,
|
skipTaskbar: false,
|
||||||
minWidth: DEFAULT_MIN_WIDTH,
|
minWidth: DEFAULT_MIN_WIDTH,
|
||||||
show: true,
|
show: true,
|
||||||
|
transparent: true,
|
||||||
|
frame: false,
|
||||||
titleBarStyle: 'hidden',
|
titleBarStyle: 'hidden',
|
||||||
vibrancy: 'fullscreen-ui',
|
vibrancy: 'fullscreen-ui',
|
||||||
visualEffectState: 'active',
|
visualEffectState: 'active',
|
||||||
backgroundMaterial: 'acrylic',
|
backgroundMaterial: 'acrylic',
|
||||||
maximizable: false,
|
|
||||||
autoHideMenuBar: true,
|
autoHideMenuBar: true,
|
||||||
trafficLightPosition: {
|
trafficLightPosition: {
|
||||||
x: 16,
|
x: 16,
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import {
|
|||||||
PanelRightCloseIcon,
|
PanelRightCloseIcon,
|
||||||
MinusIcon,
|
MinusIcon,
|
||||||
MenuIcon,
|
MenuIcon,
|
||||||
|
SquareIcon,
|
||||||
PaletteIcon,
|
PaletteIcon,
|
||||||
XIcon,
|
XIcon,
|
||||||
} from 'lucide-react'
|
} from 'lucide-react'
|
||||||
@ -51,7 +52,7 @@ const TopPanel = () => {
|
|||||||
<Button
|
<Button
|
||||||
theme="icon"
|
theme="icon"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
window?.electronAPI.showOpenMenu(100, 100)
|
window?.electronAPI?.showOpenMenu(100, 100)
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<MenuIcon size={16} />
|
<MenuIcon size={16} />
|
||||||
@ -100,13 +101,19 @@ const TopPanel = () => {
|
|||||||
<div className="flex items-center gap-x-2">
|
<div className="flex items-center gap-x-2">
|
||||||
<Button
|
<Button
|
||||||
theme="icon"
|
theme="icon"
|
||||||
onClick={() => window?.electronAPI.setMinimizeApp()}
|
onClick={() => window?.electronAPI?.setMinimizeApp()}
|
||||||
>
|
>
|
||||||
<MinusIcon size={16} />
|
<MinusIcon size={16} />
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
theme="icon"
|
theme="icon"
|
||||||
onClick={() => window?.electronAPI.setCloseApp()}
|
onClick={() => window?.electronAPI?.setMaximizeApp()}
|
||||||
|
>
|
||||||
|
<SquareIcon size={14} />
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
theme="icon"
|
||||||
|
onClick={() => window?.electronAPI?.setCloseApp()}
|
||||||
>
|
>
|
||||||
<XIcon size={16} />
|
<XIcon size={16} />
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user