71 lines
2.6 KiB
Go
71 lines
2.6 KiB
Go
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"
|
|
EventTypeActiveWindow EventType = "activewindow"
|
|
EventTypeActiveWindowV2 EventType = "activewindowv2"
|
|
EventTypeKeyboardFocus EventType = "keyboardfocus"
|
|
EventTypeMoveWorkspace EventType = "moveworkspace"
|
|
EventTypeMoveWorkspaceV2 EventType = "moveworkspacev2"
|
|
EventTypeFocusedMon EventType = "focusedmon"
|
|
EventTypeMoveWindow EventType = "movewindow"
|
|
EventTypeMoveWindowV2 EventType = "movewindowv2"
|
|
EventTypeOpenLayer EventType = "openlayer"
|
|
EventTypeCloseLayer EventType = "closelayer"
|
|
EventTypeOpenWindow EventType = "openwindow"
|
|
EventTypeCloseWindow EventType = "closewindow"
|
|
EventTypeUrgent EventType = "urgent"
|
|
EventTypeMinimize EventType = "minimize"
|
|
EventTypeMonitorAdded EventType = "monitoradded"
|
|
EventTypeMonitorAddedV2 EventType = "monitoraddedv2"
|
|
EventTypeMonitorRemoved EventType = "monitorremoved"
|
|
EventTypeCreateWorkspace EventType = "createworkspace"
|
|
EventTypeCreateWorkspaceV2 EventType = "createworkspacev2"
|
|
EventTypeDestroyWorkspace EventType = "destroyworkspace"
|
|
EventTypeDestroyWorkspaceV2 EventType = "destroyworkspacev2"
|
|
EventTypeFullscreen EventType = "fullscreen"
|
|
EventTypeChangeFloatingMode EventType = "changefloatingmode"
|
|
EventTypeWorkspace EventType = "workspace"
|
|
EventTypeWorkspaceV2 EventType = "workspacev2"
|
|
EventTypeSubmap EventType = "submap"
|
|
EventTypeMouseMove EventType = "mousemove"
|
|
EventTypeMouseButton EventType = "mousebutton"
|
|
EventTypeMouseAxis EventType = "mouseaxis"
|
|
EventTypeTouchDown EventType = "touchdown"
|
|
EventTypeTouchUp EventType = "touchup"
|
|
EventTypeTouchMove EventType = "touchmove"
|
|
EventTypeActiveLayout EventType = "activelayout"
|
|
EventTypePreRender EventType = "prerender"
|
|
EventTypeScreencast EventType = "screencast"
|
|
EventTypeRender EventType = "render"
|
|
EventTypeWindowtitle EventType = "windowtitle"
|
|
EventTypeConfigReloaded EventType = "configreloaded"
|
|
EventTypePreConfigReload EventType = "preconfigreload"
|
|
EventTypeKeyPress EventType = "keypress"
|
|
)
|