Skip to content

Commit

Permalink
Add menu window-control
Browse files Browse the repository at this point in the history
  • Loading branch information
inukshuk committed Jun 29, 2023
1 parent 15ad75c commit 685242c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/window-controls.js
Expand Up @@ -25,6 +25,11 @@ export class WindowControls {
toggle(win.html, 'window-controls-minimize', true)
}

if (!darwin) {
append(Button('menu', (event) => { win.menu(event) }), this.root)
toggle(win.html, 'window-controls-menu', true)
}

toggle(win.html, `window-controls-${this.layout.placement}`, true)

append(this.root, win.body)
Expand Down
6 changes: 6 additions & 0 deletions src/window.js
Expand Up @@ -16,6 +16,7 @@ import { WindowControls } from './window-controls.js'
import {
$$,
append,
bounds,
emit,
isLiveInput,
load,
Expand Down Expand Up @@ -440,6 +441,11 @@ export class Window extends EventEmitter {
this.send('minimize')
}

menu(event) {
let { left: x, bottom: y } = bounds(event.target)
this.send('show-menu', { x, y })
}

setFixedSize(resizable, ...args) {
this.send('fixed-size', resizable, ...args)
}
Expand Down

0 comments on commit 685242c

Please sign in to comment.