hypr/getters.go

34 lines
1002 B
Go
Raw Normal View History

2024-02-09 20:24:48 +01:00
package hypr
import (
"strings"
)
func (i *Instance) GetActiveWindow() (*Window, error) {
return readSocket[*Window](i.SocketPath(), strings.NewReader("j/activewindow"))
}
func (i *Instance) GetActiveWorkspace() (*Workspace, error) {
return readSocket[*Workspace](i.SocketPath(), strings.NewReader("j/activeworkspace"))
}
func (i *Instance) GetBinds() ([]*Bind, error) {
return readSocket[[]*Bind](i.SocketPath(), strings.NewReader("j/binds"))
}
func (i *Instance) GetWindows() ([]*Window, error) {
return readSocket[[]*Window](i.SocketPath(), strings.NewReader("j/clients"))
}
func (i *Instance) GetCursorPos() (Point, error) {
return readSocket[Point](i.SocketPath(), strings.NewReader("j/cursorpos"))
}
func (i *Instance) GetMonitors() ([]*Monitor, error) {
return readSocket[[]*Monitor](i.SocketPath(), strings.NewReader("j/monitors"))
}
func (i *Instance) GetWorkspaces() ([]*Workspace, error) {
return readSocket[[]*Workspace](i.SocketPath(), strings.NewReader("j/workspaces"))
}