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 ¶
- Variables
- func ListOutputs() ([]*models.Output, error)
- func ListWindows() ([]*models.Window, error)
- func ListWorkspaces() ([]*models.Workspace, error)
- func PerformAction(action actions.Action) bool
- func PerformRequest(req models.NiriRequest) (<-chan models.Response, error)
- func PutSocket(socket *NiriSocket)
- type NiriSocket
Constants ¶
This section is empty.
Variables ¶
var Socket = socketImpl
Socket can be used to get the NiriSocket from the pool.
Functions ¶
func ListOutputs ¶ added in v0.7.0
ListOutputs returns the current list of outputs from Niri IPC.
func ListWindows ¶ added in v0.3.0
ListWindows returns the current list of windows from Niri IPC.
func ListWorkspaces ¶ added in v0.3.0
ListWorkspaces returns the current list of workspaces from Niri IPC.
func PerformAction ¶
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
Types ¶
type NiriSocket ¶
type NiriSocket struct {
// contains filtered or unexported fields
}
NiriSocket contains the connection to the socket.
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.