Skip to content

Commit

Permalink
Fix FramelessNavigation logic (#2437)
Browse files Browse the repository at this point in the history
  • Loading branch information
comountainclimber authored Sep 30, 2022
1 parent 96bd240 commit 72d251e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
11 changes: 4 additions & 7 deletions app/components/FramelessNavigation/FramelessNavigation.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Minimize from '../../assets/icons/minimize.svg'
import Maximize from '../../assets/icons/maximize.svg'
import styles from './FramelessNavigation.scss'

const { remote } = require('electron')
const { ipcRenderer } = require('electron')

type Props = {}

Expand All @@ -33,18 +33,15 @@ const platformsNames = {

export default class HeaderBar extends React.PureComponent<Props> {
minimize = () => {
const win = remote.BrowserWindow.getFocusedWindow()
win.minimize()
ipcRenderer.invoke('minimize')
}

maximize = () => {
const win = remote.BrowserWindow.getFocusedWindow()
win.setFullScreen(!win.isFullScreen())
ipcRenderer.invoke('maximize')
}

close = () => {
const win = remote.BrowserWindow.getFocusedWindow()
win.close()
ipcRenderer.invoke('close')
}

render() {
Expand Down
13 changes: 13 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,19 @@ ipcMain.handle('dialog', async (event, method, params) => {
return result
})

ipcMain.handle('minimize', () => {
const win = BrowserWindow.getFocusedWindow()
win.minimize()
})
ipcMain.handle('maximize', () => {
const win = BrowserWindow.getFocusedWindow()
win.setFullScreen(!win.isFullScreen())
})
ipcMain.handle('close', () => {
const win = BrowserWindow.getFocusedWindow()
win.close()
})

autoUpdater.logger = log
autoUpdater.logger.transports.file.level = 'info'

Expand Down

0 comments on commit 72d251e

Please sign in to comment.