26 lines
511 B
Go
26 lines
511 B
Go
|
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)
|
||
|
}
|