-
Notifications
You must be signed in to change notification settings - Fork 4
/
events.go
104 lines (91 loc) · 3.34 KB
/
events.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
package sdk
// Alert sends an alert on the StreamDeck of action with given context.
func (s *StreamDeck) Alert(context string) {
s.writeCh <- &SendEvent{Event: ShowAlert, Context: context}
}
// OpenURL tell the Stream Deck application to open an URL in the default browser.
func (s *StreamDeck) OpenURL(u string) {
s.writeCh <- &SendEvent{Event: OpenURL, Payload: &SendEventPayload{URL: u}}
}
// SetTitle tell StreamDeck to dynamically change the title of action with given context.
func (s *StreamDeck) SetTitle(context string, title string, target Target) {
s.writeCh <- &SendEvent{
Event: SetTitle,
Context: context,
Payload: &SendEventPayload{
Title: title,
Target: target,
//State: 0, TODO: state is not supported yet
},
}
}
// ShowOK temporarily show an OK checkmark icon of action with given context.
func (s *StreamDeck) ShowOK(context string) {
s.writeCh <- &SendEvent{Event: ShowOk, Context: context}
}
// SetState change the state of an action supporting multiple states.
func (s *StreamDeck) SetState(context string, state uint8) {
s.writeCh <- &SendEvent{
Event: SetState,
Context: context,
Payload: &SendEventPayload{State: state},
}
}
// SetImage change the image of an action with given context.
func (s *StreamDeck) SetImage(context string, image string) {
s.writeCh <- &SendEvent{
Event: SetImage,
Context: context,
Payload: &SendEventPayload{Image: image},
}
}
// SetTriggerDescription change the trigger description of an action with given context.
func (s *StreamDeck) SetTriggerDescription(context string, payload *SendEventSetTriggerDescriptionPayload) {
s.writeCh <- &SendEvent{
Event: SetTriggerDescription,
Context: context,
Payload: payload,
}
}
// SetFeedback change the feedback of an action with given context.
func (s *StreamDeck) SetFeedback(context string, payload *SendEventSetFeedbackPayload) {
s.writeCh <- &SendEvent{
Event: SetFeedback,
Context: context,
Payload: payload,
}
}
// SetFeedbackLayout change the feedback layout of an action with given context.
func (s *StreamDeck) SetFeedbackLayout(context string, layout string) {
s.writeCh <- &SendEvent{
Event: SetFeedbackLayout,
Context: context,
Payload: &SendEventSetFeedbackLayoutPayload{Layout: layout},
}
}
// SetSettings change the settings of an action with given context.
func (s *StreamDeck) SetSettings(context string, settings map[string]interface{}) {
s.writeCh <- &SendEvent{
Event: SetSettings,
Context: context,
Payload: &settings,
}
}
// GetSettings get the settings of an action with given context.
// Settings will be sent back to the plugin as a ReceivedEvent with the event name DidReceiveSettings.
func (s *StreamDeck) GetSettings(context string) {
s.writeCh <- &SendEvent{Event: GetSettings, Context: context}
}
// SetGlobalSettings change the global settings of an action with given context.
func (s *StreamDeck) SetGlobalSettings(context string, settings map[string]interface{}) {
s.writeCh <- &SendEvent{
Event: SetGlobalSettings,
Context: context,
Payload: &settings,
}
}
// GetGlobalSettings get the global settings of an action with given context.
// Global settings will be sent back to the plugin as a ReceivedEvent with the event name DidReceiveGlobalSettings.
func (s *StreamDeck) GetGlobalSettings(context string) {
s.writeCh <- &SendEvent{Event: GetGlobalSettings, Context: context}
}