hypr/model_event.go

65 lines
2.3 KiB
Go
Raw Permalink Normal View History

2024-01-05 18:20:29 +01:00
package hypr
import (
"encoding/json"
"strings"
)
type Event struct {
Type EventType `json:"type"`
Data []string `json:"data"`
}
func parseEvent(str string) Event {
data := strings.Split(str, ">>")
return Event{
Type: EventType(data[0]),
Data: strings.Split(data[1], ","),
}
}
func (e Event) String() string {
data, _ := json.MarshalIndent(e, "", "\t")
return string(data)
}
type EventType = string
const (
EventTypeTick EventType = "tick"
2024-02-09 20:57:18 +01:00
EventTypeActiveWindow EventType = "activewindow"
EventTypeActiveWindowV2 EventType = "activewindowv2"
EventTypeKeyboardFocus EventType = "keyboardfocus"
EventTypeMoveWorkspace EventType = "moveworkspace"
EventTypeFocusedMon EventType = "focusedmon"
EventTypeMoveWindow EventType = "movewindow"
EventTypeOpenLayer EventType = "openlayer"
EventTypeCloseLayer EventType = "closelayer"
EventTypeOpenWindow EventType = "openwindow"
EventTypeCloseWindow EventType = "closewindow"
2024-01-05 18:20:29 +01:00
EventTypeUrgent EventType = "urgent"
EventTypeMinimize EventType = "minimize"
2024-02-09 20:57:18 +01:00
EventTypeMonitorAdded EventType = "monitoradded"
EventTypeMonitorRemoved EventType = "monitorremoved"
EventTypeCreateWorkspace EventType = "createworkspace"
EventTypeDestroyWorkspace EventType = "destroyworkspace"
2024-01-05 18:20:29 +01:00
EventTypeFullscreen EventType = "fullscreen"
2024-02-09 20:57:18 +01:00
EventTypeChangeFloatingMode EventType = "changefloatingmode"
2024-01-05 18:20:29 +01:00
EventTypeWorkspace EventType = "workspace"
EventTypeSubmap EventType = "submap"
2024-02-09 20:57:18 +01:00
EventTypeMouseMove EventType = "mousemove"
EventTypeMouseButton EventType = "mousebutton"
EventTypeMouseAxis EventType = "mouseaxis"
EventTypeTouchDown EventType = "touchdown"
EventTypeTouchUp EventType = "touchup"
EventTypeTouchMove EventType = "touchmove"
EventTypeActiveLayout EventType = "activelayout"
EventTypePreRender EventType = "prerender"
2024-01-05 18:20:29 +01:00
EventTypeScreencast EventType = "screencast"
EventTypeRender EventType = "render"
EventTypeWindowtitle EventType = "windowtitle"
2024-02-09 20:57:18 +01:00
EventTypeConfigReloaded EventType = "configreloaded"
EventTypePreConfigReload EventType = "preconfigreload"
EventTypeKeyPress EventType = "keypress"
2024-01-05 18:20:29 +01:00
)