Documentation
¶
Overview ¶
Package widgetipc is the widget socket: the shell's JSON-RPC listener for out-of-process pushes (`lys-shell toast`, `lys-shell widget update`) and the client half those CLIs drive. It ports wayle-ipc/src/widget_socket.rs (protocol and client) and wayle-shell-core/src/services/widget_ipc.rs (the listener).
Index ¶
Constants ¶
const ( MethodToastShow = "toast.show" MethodWidgetUpdate = "widget.update" )
Methods.
Variables ¶
This section is empty.
Functions ¶
func SendToast ¶
func SendToast(ctx context.Context, req ToastRequest) error
SendToast pushes one toast to the running shell (send_toast).
func SendWidgetUpdate ¶
SendWidgetUpdate pushes output to the widget whose config id is id (send_widget_update).
func SocketPath ¶
func SocketPath() string
SocketPath mirrors wayle-ipc's lookup: $XDG_RUNTIME_DIR/lys-shell/ widget.sock, falling back to /tmp/lys-shell-widget.sock.
Types ¶
type ClientError ¶
type ClientError struct {
// contains filtered or unexported fields
}
ClientError is widget_socket.rs's ClientError, with its messages.
func (*ClientError) Error ¶
func (e *ClientError) Error() string
func (*ClientError) Unwrap ¶
func (e *ClientError) Unwrap() error
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server listens on the widget socket and publishes requests.
func (*Server) Listen ¶
Listen binds the socket path (creating its directory, replacing a stale socket, restricting it to the owner) and starts accepting. The returned stop closes the listener and removes the socket file.
func (*Server) Toasts ¶
func (s *Server) Toasts() <-chan ToastRequest
Toasts ticks per toast.show request.
func (*Server) Updates ¶
func (s *Server) Updates() <-chan WidgetUpdate
Updates ticks per widget.update request.
type ToastRequest ¶
type ToastRequest struct {
Label *string `json:"label,omitempty"`
Icon *string `json:"icon,omitempty"`
Percentage *float64 `json:"percentage,omitempty"`
DurationMS *uint32 `json:"duration_ms,omitempty"`
Preset *string `json:"preset,omitempty"`
Class *string `json:"class,omitempty"`
}
ToastRequest is one toast.show payload (ToastShowParams).
type WidgetUpdate ¶
WidgetUpdate is one widget.update payload (WidgetUpdateParams): the output a custom widget receives as if its own command printed it.