rewrite
This commit is contained in:
parent
8edaa9d713
commit
7a704e08fd
2
.gitignore
vendored
2
.gitignore
vendored
@ -1 +1 @@
|
|||||||
hypr_test.go
|
*_test.go
|
||||||
|
64
model_event.go
Normal file
64
model_event.go
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
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"
|
||||||
|
EventTypeFocusedMon EventType = "focusedMon"
|
||||||
|
EventTypeMoveWindow EventType = "moveWindow"
|
||||||
|
EventTypeOpenLayer EventType = "openLayer"
|
||||||
|
EventTypeCloseLayer EventType = "closeLayer"
|
||||||
|
EventTypeOpenWindow EventType = "openWindow"
|
||||||
|
EventTypeCloseWindow EventType = "closeWindow"
|
||||||
|
EventTypeUrgent EventType = "urgent"
|
||||||
|
EventTypeMinimize EventType = "minimize"
|
||||||
|
EventTypeMonitorAdded EventType = "monitorAdded"
|
||||||
|
EventTypeMonitorRemoved EventType = "monitorRemoved"
|
||||||
|
EventTypeCreateWorkspace EventType = "createWorkspace"
|
||||||
|
EventTypeDestroyWorkspace EventType = "destroyWorkspace"
|
||||||
|
EventTypeFullscreen EventType = "fullscreen"
|
||||||
|
EventTypeChangeFloatingMode EventType = "changeFloatingMode"
|
||||||
|
EventTypeWorkspace EventType = "workspace"
|
||||||
|
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"
|
||||||
|
)
|
Loading…
Reference in New Issue
Block a user