-
Notifications
You must be signed in to change notification settings - Fork 0
/
menubar.go
42 lines (35 loc) · 992 Bytes
/
menubar.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package main
import "github.com/murlokswarm/app"
func init() {
app.Import(&MenuBar{})
}
// MenuBar is the component that define the menu bar.
type MenuBar app.ZeroCompo
// Render returns return the HTML describing the menu bar.
func (m *MenuBar) Render() string {
return `
<menu>
<menu label="app">
<menuitem label="Close" selector="performClose:" shortcut="meta+w" />
<menuitem label="Quit" selector="terminate:" shortcut="meta+q" />
</menu>
<menu label="Play">
<menuitem label="Toggle pause/play" onclick="TogglePause" shortcut="meta+p" />
<menuitem label="Next" onclick="Next" shortcut="meta+n" />
<menuitem label="Back" onclick="Back" shortcut="meta+b" />
</menu>
</menu>
`
}
// Next advances the playlist to the next song.
func (m *MenuBar) Next() {
playlist.Next()
}
// Back advances the playlist to the previous song.
func (m *MenuBar) Back() {
playlist.Back()
}
// TogglePause toggles playback.
func (m *MenuBar) TogglePause() {
playlist.TogglePause()
}