hypripc

package
v0.1.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 11, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package hypripc provides an API for interacting with the Hyprland IPC bus

Index

Constants

View Source
const (
	// EventUnspecified is the default catch-all event.
	EventUnspecified = `unspecified`
	// EventWorkspace event identifier.
	EventWorkspace = `workspace`
	// EventWorkspaceV2 event identifier.
	EventWorkspaceV2 = `workspacev2`
	// EventFocusedMon event identifier.
	EventFocusedMon = `focusedmon`
	// EventActiveWindow event identifier.
	EventActiveWindow = `activewindow`
	// EventActiveWindowV2 event identifier.
	EventActiveWindowV2 = `activewindowv2`
	// EventFullscreen event identifier.
	EventFullscreen = `fullscreen`
	// EventMonitorRemoved event identifier.
	EventMonitorRemoved = `monitorremoved`
	// EventMonitorAdded event identifier.
	EventMonitorAdded = `monitoradded`
	// EventCreateWorkspace event identifier.
	EventCreateWorkspace = `createworkspace`
	// EventCreateWorkspaceV2 event identifier.
	EventCreateWorkspaceV2 = `createworkspacev2`
	// EventDestroyWorkspace event identifier.
	EventDestroyWorkspace = `destroyworkspace`
	// EventDestroyWorkspaceV2 event identifier.
	EventDestroyWorkspaceV2 = `destroyworkspacev2`
	// EventMoveWorkspace event identifier.
	EventMoveWorkspace = `moveworkspace`
	// EventMoveWorkspaceV2 event identifier.
	EventMoveWorkspaceV2 = `moveworkspacev2`
	// EventRenameWorkspace event identifier.
	EventRenameWorkspace = `renameworkspace`
	// EventActiveSpecial event identifier.
	EventActiveSpecial = `activespecial`
	// EventActiveLayout event identifier.
	EventActiveLayout = `activelayout`
	// EventOpenWindow event identifier.
	EventOpenWindow = `openwindow`
	// EventCloseWindow event identifier.
	EventCloseWindow = `closewindow`
	// EventMoveWindow event identifier.
	EventMoveWindow = `movewindow`
	// EventMoveWindowV2 event identifier.
	EventMoveWindowV2 = `movewindowv2`
	// EventOpenLayer event identifier.
	EventOpenLayer = `openlayer`
	// EventCloseLayer event identifier.
	EventCloseLayer = `closelayer`
	// EventSubmap event identifier.
	EventSubmap = `submap`
	// EventChangeFloatingMode event identifier.
	EventChangeFloatingMode = `changefloatingmode`
	// EventUrgent event identifier.
	EventUrgent = `urgent`
	// EventMinimize event identifier.
	EventMinimize = `minimize`
	// EventScreencast event identifier.
	EventScreencast = `screencast`
	// EventWindowTitle event identifier.
	EventWindowTitle = `windowtitle`
	// EventIgnoreGroupLock event identifier.
	EventIgnoreGroupLock = `ignoregrouplock`
	// EventLockGroups event identifier.
	EventLockGroups = `lockgroups`

	// DispatchWorkspace dispatcher identifier.
	DispatchWorkspace = `workspace`
	// DispatchFocusWindow dispatcher identifier.
	DispatchFocusWindow = `focuswindow`
	// DispatchCloseWindow dispatcher identifier.
	DispatchCloseWindow = `closewindow`
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CancelFunc

type CancelFunc func()

CancelFunc cancels a subscription when called.

type Client

type Client struct {
	Address   string `json:"address"`
	Mapped    bool   `json:"mapped"`
	Hidden    bool   `json:"hidden"`
	At        []int  `json:"at"`
	Size      []int  `json:"size"`
	Workspace struct {
		ID   int    `json:"id"`
		Name string `json:"name"`
	} `json:"workspace"`
	Floating       bool          `json:"floating"`
	Monitor        int           `json:"monitor"`
	Class          string        `json:"class"`
	Title          string        `json:"title"`
	InitialClass   string        `json:"initialClass"`
	InitialTitle   string        `json:"initialTitle"`
	Pid            int64         `json:"pid"`
	Xwayland       bool          `json:"xwayland"`
	Pinned         bool          `json:"pinned"`
	Fullscreen     bool          `json:"fullscreen"`
	FullscreenMode int           `json:"fullscreenMode"`
	FakeFullscreen bool          `json:"fakeFullscreen"`
	Grouped        []interface{} `json:"grouped"`
	Swallowing     string        `json:"swallowing"`
	FocusHistoryID int           `json:"focusHistoryID"`
}

Client window container.

type Event

type Event string

Event enum.

type HyprIPC

type HyprIPC struct {
	// contains filtered or unexported fields
}

HyprIPC client.

func New

func New(log hclog.Logger) (*HyprIPC, error)

New instantiates a new HyprIPC client

func (*HyprIPC) ActiveWindow

func (h *HyprIPC) ActiveWindow() (*Client, error)

ActiveWindow returns the currently active window client.

func (*HyprIPC) ActiveWorkspace

func (h *HyprIPC) ActiveWorkspace() (*Workspace, error)

ActiveWorkspace returns the currently actie workspace.

func (*HyprIPC) Clients

func (h *HyprIPC) Clients() ([]Client, error)

Clients returns a list of all active client windows,

func (*HyprIPC) Close

func (h *HyprIPC) Close()

Close terminates all connections, event loops, and closes all subscriptions.

func (*HyprIPC) Dispatch

func (h *HyprIPC) Dispatch(args ...string) error

Dispatch calls a dispatcher.

func (*HyprIPC) Monitors

func (h *HyprIPC) Monitors() ([]Monitor, error)

Monitors returns a list of active monitors.

func (*HyprIPC) StartEvents

func (h *HyprIPC) StartEvents()

StartEvents begins the event loop.

func (*HyprIPC) Subscribe

func (h *HyprIPC) Subscribe(evt ...Event) (chan *eventv1.Event, CancelFunc)

Subscribe returns a channel that will emit the specified event(s) when they arrive.

func (*HyprIPC) Workspaces

func (h *HyprIPC) Workspaces() ([]Workspace, error)

Workspaces returns a list of all active workspaces.

type Monitor

type Monitor struct {
	ID              int     `json:"id"`
	Name            string  `json:"name"`
	Description     string  `json:"description"`
	Make            string  `json:"make"`
	Model           string  `json:"model"`
	Serial          string  `json:"serial"`
	Width           int     `json:"width"`
	Height          int     `json:"height"`
	RefreshRate     float64 `json:"refreshRate"`
	X               int     `json:"x"`
	Y               int     `json:"y"`
	ActiveWorkspace struct {
		ID   int    `json:"id"`
		Name string `json:"name"`
	} `json:"activeWorkspace"`
	SpecialWorkspace struct {
		ID   int    `json:"id"`
		Name string `json:"name"`
	} `json:"specialWorkspace"`
	Reserved        []int   `json:"reserved"`
	Scale           float64 `json:"scale"`
	Transform       int     `json:"transform"`
	Focused         bool    `json:"focused"`
	DpmsStatus      bool    `json:"dpmsStatus"`
	Vrr             bool    `json:"vrr"`
	ActivelyTearing bool    `json:"activelyTearing"`
}

Monitor container.

type Workspace

type Workspace struct {
	ID              int    `json:"id"`
	Name            string `json:"name"`
	Monitor         string `json:"monitor"`
	MonitorID       int    `json:"monitorID"`
	Windows         int    `json:"windows"`
	Hasfullscreen   bool   `json:"hasfullscreen"`
	Lastwindow      string `json:"lastwindow"`
	Lastwindowtitle string `json:"lastwindowtitle"`
}

Workspace container.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL