hypr/model_instance.go

26 lines
511 B
Go
Raw Permalink Normal View History

2024-02-09 20:24:48 +01:00
package hypr
import (
"encoding/json"
"fmt"
)
type Instance struct {
Signature string `json:"instance"`
PID int `json:"pid"`
WaylandSocket string `json:"wl_socket"`
}
func (i Instance) String() string {
data, _ := json.MarshalIndent(i, "", "\t")
return string(data)
}
func (i Instance) SocketPath() string {
return fmt.Sprintf("/tmp/hypr/%s/.socket.sock", i.Signature)
}
func (i Instance) EventSocketPath() string {
return fmt.Sprintf("/tmp/hypr/%s/.socket2.sock", i.Signature)
}