hypr/model_event.go

71 lines
2.6 KiB
Go
Raw 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"
EventTypeMoveWorkspaceV2 EventType = "moveworkspacev2"
2024-02-09 20:57:18 +01:00
EventTypeFocusedMon EventType = "focusedmon"
EventTypeMoveWindow EventType = "movewindow"
EventTypeMoveWindowV2 EventType = "movewindowv2"
2024-02-09 20:57:18 +01:00
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"
EventTypeMonitorAddedV2 EventType = "monitoraddedv2"
2024-02-09 20:57:18 +01:00
EventTypeMonitorRemoved EventType = "monitorremoved"
EventTypeCreateWorkspace EventType = "createworkspace"
EventTypeCreateWorkspaceV2 EventType = "createworkspacev2"
2024-02-09 20:57:18 +01:00
EventTypeDestroyWorkspace EventType = "destroyworkspace"
EventTypeDestroyWorkspaceV2 EventType = "destroyworkspacev2"
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"
EventTypeWorkspaceV2 EventType = "workspacev2"
2024-01-05 18:20:29 +01:00
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
)