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 ¶
var Socket = socketImpl
Socket can be used to get the NiriSocket from the pool.
Functions ¶
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.