ipc

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApplyLayoutPayload

type ApplyLayoutPayload struct {
	LayoutName  string   `json:"layout_name"`
	TileNow     bool     `json:"tile_now,omitempty"`
	WindowOrder []uint32 `json:"window_order,omitempty"` // If set, use this window order instead of sorting
}

type Client

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

Client handles IPC communication with the daemon

func NewClient

func NewClient() *Client

NewClient creates a new IPC client

func (*Client) ApplyLayout

func (c *Client) ApplyLayout(layoutName string, tileNow bool) error

ApplyLayout sets the daemon's active layout (optionally tiles immediately).

func (*Client) ApplyLayoutWithOrder

func (c *Client) ApplyLayoutWithOrder(layoutName string, windowOrder []uint32) error

ApplyLayoutWithOrder sets the daemon's active layout and tiles with a specific window order. This is used by workspace load to ensure windows end up in the correct slots.

func (*Client) GetMonitors

func (c *Client) GetMonitors() (*MonitorsData, error)

GetMonitors retrieves monitor information

func (*Client) GetStatus

func (c *Client) GetStatus() (*StatusData, error)

GetStatus retrieves daemon status

func (*Client) ListLayouts

func (c *Client) ListLayouts() (*LayoutsData, error)

ListLayouts retrieves available layouts and current selection.

func (*Client) Ping

func (c *Client) Ping() error

Ping checks if the daemon is responding

func (*Client) PreviewLayout

func (c *Client) PreviewLayout(layoutName string, durationSeconds int) error

PreviewLayout temporarily applies a layout for preview

func (*Client) Reload

func (c *Client) Reload() error

Reload sends a RELOAD command to the daemon

func (*Client) SetDefaultLayout

func (c *Client) SetDefaultLayout(layoutName string, tileNow bool) error

SetDefaultLayout updates default_layout in config (optionally tiles immediately).

func (*Client) Undo

func (c *Client) Undo() error

Undo sends an UNDO command to the daemon.

type CommandType

type CommandType string

CommandType represents different IPC command types

const (
	CommandReload           CommandType = "RELOAD"
	CommandGetStatus        CommandType = "GET_STATUS"
	CommandGetMonitors      CommandType = "GET_MONITORS"
	CommandPreviewLayout    CommandType = "PREVIEW_LAYOUT"
	CommandListLayouts      CommandType = "LIST_LAYOUTS"
	CommandApplyLayout      CommandType = "APPLY_LAYOUT"
	CommandSetDefaultLayout CommandType = "SET_DEFAULT_LAYOUT"
	CommandUndo             CommandType = "UNDO"
)

type LayoutsData

type LayoutsData struct {
	Layouts       []string `json:"layouts"`
	DefaultLayout string   `json:"default_layout"`
	ActiveLayout  string   `json:"active_layout"`
}

type MonitorInfo

type MonitorInfo struct {
	ID     int    `json:"id"`
	Name   string `json:"name"`
	X      int    `json:"x"`
	Y      int    `json:"y"`
	Width  int    `json:"width"`
	Height int    `json:"height"`
}

MonitorInfo represents information about a single monitor

type MonitorsData

type MonitorsData struct {
	Monitors []MonitorInfo `json:"monitors"`
}

MonitorsData represents the data returned by GET_MONITORS

type PreviewLayoutPayload

type PreviewLayoutPayload struct {
	LayoutName      string `json:"layout_name"`
	DurationSeconds int    `json:"duration_seconds"`
}

PreviewLayoutPayload represents the payload for PREVIEW_LAYOUT command

type Request

type Request struct {
	Command CommandType     `json:"command"`
	Payload json.RawMessage `json:"payload,omitempty"`
}

Request represents an IPC request from client to server

func ParseRequest

func ParseRequest(data []byte) (*Request, error)

ParseRequest parses a request from JSON bytes

type Response

type Response struct {
	Status string          `json:"status"` // "OK" or "ERROR"
	Data   json.RawMessage `json:"data,omitempty"`
	Error  string          `json:"error,omitempty"`
}

Response represents an IPC response from server to client

func NewErrorResponse

func NewErrorResponse(errMsg string) *Response

NewErrorResponse creates an error response with a message

func NewOKResponse

func NewOKResponse(data interface{}) (*Response, error)

NewOKResponse creates a successful response with optional data

func (*Response) Marshal

func (r *Response) Marshal() ([]byte, error)

Marshal converts a response to JSON bytes

type Server

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

Server handles IPC requests from clients

func NewServer

func NewServer(cfg *config.Config, tiler *tiling.Tiler, backend platform.Backend, reloadChan chan struct{}) (*Server, error)

NewServer creates a new IPC server

func (*Server) GetConfig

func (s *Server) GetConfig() *config.Config

GetConfig returns the current config (thread-safe)

func (*Server) Start

func (s *Server) Start() error

Start begins listening for IPC connections

func (*Server) Stop

func (s *Server) Stop()

Stop gracefully shuts down the IPC server

func (*Server) UpdateConfig

func (s *Server) UpdateConfig(cfg *config.Config)

UpdateConfig updates the config (thread-safe)

type SetDefaultLayoutPayload

type SetDefaultLayoutPayload struct {
	LayoutName string `json:"layout_name"`
	TileNow    bool   `json:"tile_now,omitempty"`
}

type StatusData

type StatusData struct {
	ActiveLayout  string `json:"active_layout"`
	TerminalCount int    `json:"terminal_count"`
	UptimeSeconds int64  `json:"uptime_seconds"`
	DaemonRunning bool   `json:"daemon_running"`
}

StatusData represents the data returned by GET_STATUS

Jump to

Keyboard shortcuts

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