widgetipc

package
v0.3.15 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2026 License: MIT Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
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

func SendWidgetUpdate(ctx context.Context, id, output string) error

SendWidgetUpdate pushes output to the widget whose config id is id (send_widget_update).

func SocketPath

func SocketPath() (string, error)

SocketPath is $XDG_RUNTIME_DIR/lys-shell/widget.sock; an error naming XDG_RUNTIME_DIR when the process has no absolute one.

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 NewServer

func NewServer() *Server

NewServer builds the server; Listen binds the socket.

func (*Server) Listen

func (s *Server) Listen() (func(), error)

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

type WidgetUpdate struct {
	ID     string `json:"id"`
	Output string `json:"output"`
}

WidgetUpdate is one widget.update payload (WidgetUpdateParams): the output a custom widget receives as if its own command printed it.

Jump to

Keyboard shortcuts

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