-
-
Notifications
You must be signed in to change notification settings - Fork 46
/
module.go
61 lines (50 loc) · 1.67 KB
/
module.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package fynedesk
import "fyne.io/fyne/v2"
// ModuleMetadata is the information required to describe a module in FyneDesk
type ModuleMetadata struct {
Name string
NewInstance func() Module
}
// KeyBindModule marks a module that provides key bindings.
// This is optional but can be enabled for any module by implementing the interface.
type KeyBindModule interface {
Shortcuts() map[*Shortcut]func()
}
// Module marks the required methods of a pluggable module in FyneDesk.
type Module interface {
Metadata() ModuleMetadata
Destroy()
}
// LaunchSuggestion represents an item that can appear in the app launcher and be actioned on tap
type LaunchSuggestion interface {
Icon() fyne.Resource
Title() string
Launch()
}
// LaunchSuggestionModule is a module that can provide suggestions for the app launcher
type LaunchSuggestionModule interface {
Module
LaunchSuggestions(string) []LaunchSuggestion
}
// StatusAreaModule describes a module that can add items to the status area
// (the bottom of the widget panel)
type StatusAreaModule interface {
Module
StatusAreaWidget() fyne.CanvasObject
}
// ScreenAreaModule describes a module that can draw on the whole screen -
// these items will appear over the background image.
type ScreenAreaModule interface {
Module
ScreenAreaWidget() fyne.CanvasObject
}
var modules []ModuleMetadata
// AvailableModules lists all of the FyneDesk modules that were found at runtime
func AvailableModules() []ModuleMetadata {
return modules
}
// RegisterModule adds a module to the list of available modules.
// New module packages should probably call this in their init().
func RegisterModule(m ModuleMetadata) {
modules = append(modules, m)
}