connection

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package connection contains functionality to communicate with the Niri socket.

We connect to the Niri socket NIRI_SOCKET, and perform actions and requests to it. Actions are same as niri msg action <ACTION>, where <ACTION> is the PascalCase of the dashed niri action, e.g. move-window-to-floating -> MoveWindowToFloating etc. Requests are the simple requests, e.g. niri msg <REQUEST>, where <REQUEST> is one of the niri requests to the socket. niri msg outputs -> Outputs. This is heavily inspired by https://github.com/probeldev/niri-float-sticky

Index

Constants

This section is empty.

Variables

View Source
var Socket = socketImpl

Socket can be used to get the NiriSocket from the pool.

Functions

func ListOutputs added in v0.7.0

func ListOutputs() ([]*models.Output, error)

ListOutputs returns the current list of outputs from Niri IPC.

func ListWindows added in v0.3.0

func ListWindows() ([]*models.Window, error)

ListWindows returns the current list of windows from Niri IPC.

func ListWorkspaces added in v0.3.0

func ListWorkspaces() ([]*models.Workspace, error)

ListWorkspaces returns the current list of workspaces from Niri IPC.

func PerformAction

func PerformAction(action actions.Action) bool

PerformAction performs the given action.

The action is one of the actions that niri can handle. The supported actions are defined here: https://docs.rs/niri-ipc/latest/niri_ipc/enum.Action.html

func PerformRequest

func PerformRequest(req models.NiriRequest) (<-chan models.Response, error)

PerformRequest sends a simple request to the niri socket.

The request is one of the requests that niri can handle. The supported requests are defined here: https://docs.rs/niri-ipc/latest/niri_ipc/enum.Request.html

func PutSocket

func PutSocket(socket *NiriSocket)

PutSocket adds the socket to the pool.

Types

type NiriSocket

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

NiriSocket contains the connection to the socket.

func (*NiriSocket) Close

func (s *NiriSocket) Close()

Close closes the socket connection.

func (*NiriSocket) Recv

func (s *NiriSocket) Recv() <-chan []byte

Recv reads the data from the socket.

func (*NiriSocket) Send

func (s *NiriSocket) Send(req string) error

Send writes the request to the socket.

Jump to

Keyboard shortcuts

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