ipc

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: MIT, MIT Imports: 25 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 ipc serves lys-wm's state, actions and events over a Unix socket as JSON lines, for lys-wmctl, bars and scripts.

Index

Constants

This section is empty.

Variables

View Source
var ErrBadRequest = errors.New("ipc: bad request")
View Source
var ErrNoSocket = errors.New("ipc: no lys-wm socket")
View Source
var ErrShutdown = errors.New("ipc: lys-wm is shutting down")

Functions

func AppendEvent

func AppendEvent(dst []byte, e Event) ([]byte, error)

func Do

func Do(path string, req Request) (json.RawMessage, error)

func Encode

func Encode(e Event) ([]byte, error)

func EncodeCaptureCommand

func EncodeCaptureCommand(cmd CaptureCommand) ([]byte, error)

func FindSocket

func FindSocket(getenv func(string) string) (string, error)

func ParseMode

func ParseMode(s string) (wmipc.Mode, error)

func RectOf

func RectOf(r image.Rectangle) wmipc.Rect

func ReplyUpgrade

func ReplyUpgrade(file *os.File, result UpgradeResult) error

func SocketPath

func SocketPath(runtimeDir, display string) (string, error)

Types

type AppIDEvent

type AppIDEvent struct {
	Window wm.WindowID `json:"window"`
	AppID  string      `json:"app_id"`
}

func (AppIDEvent) Name

func (AppIDEvent) Name() string

type Barrier

type Barrier struct {
	ID BarrierID `json:"id"`
	X1 int       `json:"x1"`
	Y1 int       `json:"y1"`
	X2 int       `json:"x2"`
	Y2 int       `json:"y2"`
}

func (Barrier) Vertical

func (b Barrier) Vertical() bool

type BarrierID

type BarrierID uint32

type BellEvent

type BellEvent struct {
	Window *wm.WindowID `json:"window"`
}

func (BellEvent) Name

func (BellEvent) Name() string

type Bind

type Bind struct {
	Submap      string   `json:"submap"`
	Chord       string   `json:"chord"`
	Action      string   `json:"action"`
	Description string   `json:"description"`
	Flags       []string `json:"flags"`
	LongPressMS int64    `json:"long_press_ms,omitempty"`
	CooldownMS  int64    `json:"cooldown_ms,omitempty"`
}

func BindOf

func BindOf(b binds.Bind) Bind

type BindsEvent

type BindsEvent struct {
	Binds []Bind `json:"binds"`
}

func (BindsEvent) Name

func (BindsEvent) Name() string

type Capability

type Capability string
const (
	CapKeyboard  Capability = "keyboard"
	CapPointer   Capability = "pointer"
	CapTouch     Capability = "touch"
	CapTablet    Capability = "tablet"
	CapTabletPad Capability = "tablet_pad"
)

type CaptureActivatedEvent

type CaptureActivatedEvent struct {
	Activation uint32             `json:"activation"`
	At         wmipc.CapturePoint `json:"at"`
	Barrier    BarrierID          `json:"barrier"`
}

func (CaptureActivatedEvent) Name

type CaptureAppliedEvent

type CaptureAppliedEvent struct{}

func (CaptureAppliedEvent) Name

func (CaptureAppliedEvent) Name() string

type CaptureButtonEvent

type CaptureButtonEvent struct {
	Button  uint32 `json:"button"`
	Pressed bool   `json:"pressed"`
}

func (CaptureButtonEvent) Name

func (CaptureButtonEvent) Name() string

type CaptureCommand

type CaptureCommand interface {
	// contains filtered or unexported methods
}

type CaptureConn

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

func OpenCapture

func OpenCapture(path string) (*CaptureConn, error)

func (*CaptureConn) Close

func (c *CaptureConn) Close() error

func (*CaptureConn) Next

func (c *CaptureConn) Next() ([]byte, error)

func (*CaptureConn) Send

func (c *CaptureConn) Send(cmd CaptureCommand) error

type CaptureDeactivatedEvent

type CaptureDeactivatedEvent struct {
	Activation uint32             `json:"activation"`
	At         wmipc.CapturePoint `json:"at"`
}

func (CaptureDeactivatedEvent) Name

type CaptureDisabledEvent

type CaptureDisabledEvent struct{}

func (CaptureDisabledEvent) Name

type CaptureErrorEvent

type CaptureErrorEvent struct {
	Error string `json:"error"`
}

func (CaptureErrorEvent) Name

func (CaptureErrorEvent) Name() string

type CaptureFrameEvent

type CaptureFrameEvent struct{}

func (CaptureFrameEvent) Name

func (CaptureFrameEvent) Name() string

type CaptureKeyEvent

type CaptureKeyEvent struct {
	Key     uint32 `json:"key"`
	Pressed bool   `json:"pressed"`
}

func (CaptureKeyEvent) Name

func (CaptureKeyEvent) Name() string

type CaptureKeymapEvent

type CaptureKeymapEvent struct {
	Keymap string `json:"keymap"`
}

func (CaptureKeymapEvent) Name

func (CaptureKeymapEvent) Name() string

type CaptureModifiersEvent

type CaptureModifiersEvent struct {
	Depressed uint32 `json:"depressed"`
	Latched   uint32 `json:"latched"`
	Locked    uint32 `json:"locked"`
	Group     uint32 `json:"group"`
}

func (CaptureModifiersEvent) Name

type CaptureMotionEvent

type CaptureMotionEvent struct {
	DX float64 `json:"dx"`
	DY float64 `json:"dy"`
}

func (CaptureMotionEvent) Name

func (CaptureMotionEvent) Name() string

type CaptureScrollDiscreteEvent

type CaptureScrollDiscreteEvent struct {
	DX int32 `json:"dx"`
	DY int32 `json:"dy"`
}

func (CaptureScrollDiscreteEvent) Name

type CaptureScrollEvent

type CaptureScrollEvent struct {
	DX float64 `json:"dx"`
	DY float64 `json:"dy"`
}

func (CaptureScrollEvent) Name

func (CaptureScrollEvent) Name() string

type CaptureScrollStopEvent

type CaptureScrollStopEvent struct {
	X bool `json:"x"`
	Y bool `json:"y"`
}

func (CaptureScrollStopEvent) Name

type CaptureSession

type CaptureSession interface {
	Apply(cmd CaptureCommand) error
	Close() error
}

type CastKind

type CastKind string
const (
	CastNone   CastKind = "none"
	CastWindow CastKind = "window"
	CastOutput CastKind = "output"
)

type CastTarget

type CastTarget struct {
	Kind   CastKind    `json:"kind"`
	Window wm.WindowID `json:"window,omitempty"`
	Output string      `json:"output,omitempty"`
}

type CastTargetEvent

type CastTargetEvent struct {
	Target CastTarget `json:"target"`
}

func (CastTargetEvent) Name

func (CastTargetEvent) Name() string

type CloseEvent

type CloseEvent struct {
	Window wm.WindowID `json:"window"`
}

func (CloseEvent) Name

func (CloseEvent) Name() string

type ConfigProblems

type ConfigProblems struct {
	Rejected bool     `json:"rejected"`
	Messages []string `json:"messages"`
}

type ConfigProblemsEvent

type ConfigProblemsEvent struct {
	ConfigProblems
}

func (ConfigProblemsEvent) Name

func (ConfigProblemsEvent) Name() string

type CreatedOutput

type CreatedOutput struct {
	Name string `json:"name"`
}

type Device

type Device struct {
	Name         string        `json:"name"`
	Capabilities []Capability  `json:"capabilities"`
	Layout       *wmipc.Layout `json:"layout,omitempty"`
}

type DisableCapture

type DisableCapture struct{}

type DispatchEvent

type DispatchEvent struct {
	Action string `json:"action"`
}

func (DispatchEvent) Name

func (DispatchEvent) Name() string

type EnableCapture

type EnableCapture struct{}

type Event

type Event interface {
	Name() string
}

func Diff

func Diff(prev, next Snapshot) []Event

type FocusEvent

type FocusEvent struct {
	Window *wm.WindowID `json:"window"`
}

func (FocusEvent) Name

func (FocusEvent) Name() string

type FocusedOutputEvent

type FocusedOutputEvent struct {
	Output string `json:"output"`
}

func (FocusedOutputEvent) Name

func (FocusedOutputEvent) Name() string

type Group

type Group struct {
	ID     uint64 `json:"id"`
	Layout string `json:"layout"`
	Index  int    `json:"index"`
}

type GroupEvent

type GroupEvent struct {
	Window wm.WindowID `json:"window"`
	Group  *Group      `json:"group"`
}

func (GroupEvent) Name

func (GroupEvent) Name() string

type Handler

type Handler interface {
	Snapshot() Snapshot
	DispatchPrepared(a wm.Action, loaded func() error) error
	PrepareDispatch(a wm.Action) func() error
	Icon(w wm.WindowID, size int) (*image.RGBA, int, error)
	CreateOutput(spec OutputSpec) (CreatedOutput, error)
	RemoveOutput(name string) error
	Capture(send func(Event)) (CaptureSession, error)
	PickWindow(answer func(*wm.WindowID, error)) (cancel func(), err error)
}

type Icon

type Icon struct {
	Serial uint64 `json:"serial"`
	Name   string `json:"name,omitempty"`
	Sizes  []int  `json:"sizes,omitempty"`
}

type IconEvent

type IconEvent struct {
	Window wm.WindowID `json:"window"`
	Icon   *Icon       `json:"icon"`
}

func (IconEvent) Name

func (IconEvent) Name() string

type IconImage

type IconImage struct {
	Size  int    `json:"size"`
	Scale int    `json:"scale"`
	PNG   []byte `json:"png"`
}

type KeyboardInteractivity

type KeyboardInteractivity string
const (
	KeyboardNone      KeyboardInteractivity = "none"
	KeyboardExclusive KeyboardInteractivity = "exclusive"
	KeyboardOnDemand  KeyboardInteractivity = "on_demand"
)

type Layer

type Layer struct {
	ID        uint64                `json:"id"`
	Namespace string                `json:"namespace"`
	Layer     LayerLevel            `json:"layer"`
	Output    string                `json:"output"`
	Rect      wmipc.Rect            `json:"rect"`
	Keyboard  KeyboardInteractivity `json:"keyboard_interactivity"`
}

type LayerChange

type LayerChange string
const (
	LayerOpened LayerChange = "open"
	LayerClosed LayerChange = "close"
)

type LayerEvent

type LayerEvent struct {
	Change    LayerChange `json:"change"`
	ID        uint64      `json:"id"`
	Namespace string      `json:"namespace"`
	Output    string      `json:"output"`
	Layer     LayerLevel  `json:"layer"`
}

func (LayerEvent) Name

func (LayerEvent) Name() string

type LayerLevel

type LayerLevel string
const (
	LayerBackground LayerLevel = "background"
	LayerBottom     LayerLevel = "bottom"
	LayerTop        LayerLevel = "top"
	LayerOverlay    LayerLevel = "overlay"
)

type LayoutEvent

type LayoutEvent struct {
	Layout wmipc.Layout `json:"layout"`
}

func (LayoutEvent) Name

func (LayoutEvent) Name() string

type LocksEvent

type LocksEvent struct {
	Locks wmipc.Locks `json:"locks"`
}

func (LocksEvent) Name

func (LocksEvent) Name() string

type MRUEvent

type MRUEvent struct {
	Windows []wm.WindowID `json:"windows"`
}

func (MRUEvent) Name

func (MRUEvent) Name() string

type MinimizedEvent

type MinimizedEvent struct {
	Window    wm.WindowID `json:"window"`
	Minimized bool        `json:"minimized"`
}

func (MinimizedEvent) Name

func (MinimizedEvent) Name() string

type ModeEvent

type ModeEvent struct {
	Window           wm.WindowID `json:"window"`
	Floating         bool        `json:"floating"`
	Fullscreen       bool        `json:"fullscreen"`
	Maximized        bool        `json:"maximized"`
	ClientFullscreen bool        `json:"client_fullscreen"`
}

func (ModeEvent) Name

func (ModeEvent) Name() string

type MoveEvent

type MoveEvent struct {
	Window    wm.WindowID    `json:"window"`
	Workspace wm.WorkspaceID `json:"workspace"`
}

func (MoveEvent) Name

func (MoveEvent) Name() string

type OpenEvent

type OpenEvent struct {
	Window Window `json:"window"`
}

func (OpenEvent) Name

func (OpenEvent) Name() string

type Output

type Output struct {
	Name        string         `json:"name"`
	Description string         `json:"description"`
	Rect        wmipc.Rect     `json:"rect"`
	Scale       float64        `json:"scale"`
	Mode        wmipc.Mode     `json:"mode"`
	Workspace   wm.WorkspaceID `json:"workspace"`
	Focused     bool           `json:"focused"`
	Powered     bool           `json:"powered"`
	Shader      string         `json:"shader,omitempty"`
	ShaderError string         `json:"shader_error,omitempty"`
	HDR         bool           `json:"hdr,omitempty"`
	Zoom        float64        `json:"zoom,omitempty"`
	Transform   string         `json:"transform,omitempty"`
	MirrorOf    string         `json:"mirror_of,omitempty"`
}

type OutputChange

type OutputChange string
const (
	OutputAdded   OutputChange = "added"
	OutputRemoved OutputChange = "removed"
	OutputChanged OutputChange = "changed"
)

type OutputEvent

type OutputEvent struct {
	Change OutputChange `json:"change"`
	Output Output       `json:"output"`
}

func (OutputEvent) Name

func (OutputEvent) Name() string

type OutputSpec

type OutputSpec struct {
	Name       string
	Size       image.Point
	RefreshMHz int32
	Scale      float64
}

type OverviewEvent

type OverviewEvent struct {
	Open bool `json:"open"`
}

func (OverviewEvent) Name

func (OverviewEvent) Name() string

type PinEvent

type PinEvent struct {
	Window wm.WindowID `json:"window"`
	Pinned bool        `json:"pinned"`
}

func (PinEvent) Name

func (PinEvent) Name() string

type RectEvent

type RectEvent struct {
	Window wm.WindowID `json:"window"`
	Output string      `json:"output"`
	Rect   wmipc.Rect  `json:"rect"`
}

func (RectEvent) Name

func (RectEvent) Name() string

type ReducedMotionEvent

type ReducedMotionEvent struct {
	ReducedMotion bool `json:"reduced_motion"`
}

func (ReducedMotionEvent) Name

func (ReducedMotionEvent) Name() string

type ReleaseCapture

type ReleaseCapture struct{ At *wmipc.CapturePoint }

type Request

type Request struct {
	Request  wmipc.Kind  `json:"request"`
	Action   string      `json:"action,omitempty"`
	Actions  []string    `json:"actions,omitempty"`
	Snapshot bool        `json:"snapshot,omitempty"`
	Window   wm.WindowID `json:"window,omitempty"`
	Size     int         `json:"size,omitempty"`
	Binary   string      `json:"binary,omitempty"`
	DropX11  bool        `json:"drop_x11,omitempty"`
	Name     string      `json:"name,omitempty"`
	Mode     *wmipc.Mode `json:"mode,omitempty"`
	Scale    float64     `json:"scale,omitempty"`
}

type Scratchpad

type Scratchpad struct {
	Name    wm.ScratchpadName `json:"name"`
	Output  string            `json:"output"`
	Shown   bool              `json:"shown"`
	Windows int               `json:"windows"`
}

type ScratchpadEvent

type ScratchpadEvent struct {
	Scratchpad
}

func (ScratchpadEvent) Name

func (ScratchpadEvent) Name() string

type Server

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

func Adopt

func Adopt(l *loop.Loop, file *os.File, h Handler, report func(error)) (*Server, error)

func Listen

func Listen(l *loop.Loop, path string, h Handler, report func(error)) (*Server, error)

func (*Server) AdoptWatcher

func (s *Server) AdoptWatcher(file *os.File) error

func (*Server) Announce

func (s *Server) Announce(e Event)

func (*Server) Changed

func (s *Server) Changed()

func (*Server) Close

func (s *Server) Close() error

func (*Server) Dispatched

func (s *Server) Dispatched(a wm.Action)

func (*Server) ListenerFD

func (s *Server) ListenerFD() (*os.File, error)

func (*Server) OnUpgrade

func (s *Server) OnUpgrade(u Upgrader)

func (*Server) Path

func (s *Server) Path() string

func (*Server) PauseAccept

func (s *Server) PauseAccept() error

func (*Server) ResumeAccept

func (s *Server) ResumeAccept() error

func (*Server) Start

func (s *Server) Start()

func (*Server) WatcherFiles

func (s *Server) WatcherFiles() ([]*os.File, error)

type SetBarriers

type SetBarriers struct{ Barriers []Barrier }

type ShowDesktopEvent

type ShowDesktopEvent struct {
	Output string `json:"output"`
	On     bool   `json:"on"`
}

func (ShowDesktopEvent) Name

func (ShowDesktopEvent) Name() string

type Snapshot

type Snapshot struct {
	Outputs        []Output
	Workspaces     []Workspace
	Scratchpads    []Scratchpad
	ShowDesktop    []string
	Windows        []Window
	Layers         []Layer
	CastTarget     CastTarget
	Devices        []Device
	Binds          []Bind
	MRU            []wm.WindowID
	Switcher       *Switcher
	Submap         string
	Layout         wmipc.Layout
	Locks          wmipc.Locks
	ReducedMotion  bool
	Overview       bool
	ConfigProblems ConfigProblems
}

type StackEvent

type StackEvent struct {
	Window wm.WindowID `json:"window"`
	Stack  *int        `json:"stack"`
}

func (StackEvent) Name

func (StackEvent) Name() string

type Stream

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

func Subscribe

func Subscribe(path string, snapshot bool) (*Stream, error)

func (*Stream) Close

func (s *Stream) Close() error

func (*Stream) Next

func (s *Stream) Next() ([]byte, error)

type SubmapEvent

type SubmapEvent struct {
	Submap string `json:"submap"`
}

func (SubmapEvent) Name

func (SubmapEvent) Name() string

type SwallowEvent

type SwallowEvent struct {
	Window      wm.WindowID `json:"window"`
	SwallowedBy wm.WindowID `json:"swallowed_by"`
}

func (SwallowEvent) Name

func (SwallowEvent) Name() string

type Switcher

type Switcher struct {
	Selected wm.WindowID `json:"selected"`
	Title    string      `json:"title"`
}

type SwitcherEvent

type SwitcherEvent struct {
	Open     bool         `json:"open"`
	Selected *wm.WindowID `json:"selected"`
	Title    string       `json:"title"`
}

func (SwitcherEvent) Name

func (SwitcherEvent) Name() string

type TitleEvent

type TitleEvent struct {
	Window wm.WindowID `json:"window"`
	Title  string      `json:"title"`
}

func (TitleEvent) Name

func (TitleEvent) Name() string

type UnresponsiveEvent

type UnresponsiveEvent struct {
	Window       wm.WindowID `json:"window"`
	Unresponsive bool        `json:"unresponsive"`
}

func (UnresponsiveEvent) Name

func (UnresponsiveEvent) Name() string

type UpgradeResult

type UpgradeResult struct {
	PID     int    `json:"pid"`
	Binary  string `json:"binary"`
	Clients int    `json:"clients"`
	Windows int    `json:"windows"`
}

type Upgrader

type Upgrader func(binary string, dropX11 bool, conn *os.File, done func(UpgradeResult, error))

type UrgentEvent

type UrgentEvent struct {
	Window wm.WindowID `json:"window"`
	Urgent bool        `json:"urgent"`
}

func (UrgentEvent) Name

func (UrgentEvent) Name() string

type Window

type Window struct {
	ID             wm.WindowID       `json:"id"`
	AppID          string            `json:"app_id"`
	Title          string            `json:"title"`
	PID            int32             `json:"pid"`
	Workspace      wm.WorkspaceID    `json:"workspace"`
	Scratchpad     wm.ScratchpadName `json:"scratchpad,omitempty"`
	Output         string            `json:"output"`
	Rect           wmipc.Rect        `json:"rect"`
	Floating       bool              `json:"floating"`
	Fullscreen     bool              `json:"fullscreen"`
	Maximized      bool              `json:"maximized"`
	ClientFull     bool              `json:"client_fullscreen"`
	Pinned         bool              `json:"pinned"`
	Minimized      bool              `json:"minimized"`
	Urgent         bool              `json:"urgent"`
	Unresponsive   bool              `json:"unresponsive"`
	Focused        bool              `json:"focused"`
	InhibitsKeys   bool              `json:"inhibits_shortcuts"`
	ContentType    wm.ContentType    `json:"content_type"`
	ContentSource  wm.ContentSource  `json:"content_source"`
	Icon           *Icon             `json:"icon"`
	Stack          *int              `json:"stack,omitempty"`
	SwallowedBy    wm.WindowID       `json:"swallowed_by,omitempty"`
	FocusTimestamp uint64            `json:"focus_timestamp"`
	Group          *Group            `json:"group"`
}

type WindowMenuEvent

type WindowMenuEvent struct {
	Window wm.WindowID `json:"window"`
	X      int         `json:"x"`
	Y      int         `json:"y"`
}

func (WindowMenuEvent) Name

func (WindowMenuEvent) Name() string

type Workspace

type Workspace struct {
	ID      wm.WorkspaceID `json:"id"`
	Name    string         `json:"name,omitempty"`
	Output  string         `json:"output"`
	Windows int            `json:"windows"`
	Visible bool           `json:"visible"`
	Focused bool           `json:"focused"`
}

type WorkspaceEvent

type WorkspaceEvent struct {
	Output    string         `json:"output"`
	Workspace wm.WorkspaceID `json:"workspace"`
}

func (WorkspaceEvent) Name

func (WorkspaceEvent) Name() string

Jump to

Keyboard shortcuts

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