hypr/model_instance.go

26 lines
523 B
Go
Raw Permalink Normal View History

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