platform

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: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindWindowByTitleStandalone

func FindWindowByTitleStandalone(substring string) (uint32, error)

FindWindowByTitleStandalone searches for a window by title substring using a new temporary X11 connection.

func FocusWindowStandalone

func FocusWindowStandalone(windowID uint32) error

FocusWindowStandalone activates and raises a window using a new temporary X11 connection.

func GetCurrentDesktopStandalone

func GetCurrentDesktopStandalone() (int, error)

GetCurrentDesktopStandalone returns the current virtual desktop number using a new temporary X11 connection.

func MoveWindowToDesktopStandalone

func MoveWindowToDesktopStandalone(windowID uint32, desktop int) error

MoveWindowToDesktopStandalone moves a window to the specified virtual desktop using a new temporary X11 connection.

Types

type Backend

type Backend interface {
	Displays() ([]Display, error)
	ActiveDisplay() (Display, error)
	ActiveWindow() (WindowID, error)
	ListWindowsOnDisplay(displayID int) ([]Window, error)
	MoveResize(windowID WindowID, bounds Rect) error
	Minimize(windowID WindowID) error
	Focus(windowID WindowID) error
	Close(windowID WindowID) error
}

Backend abstracts window-system operations across platforms.

type Display

type Display struct {
	ID     int
	Name   string
	Bounds Rect
	Usable Rect
}

Display describes a physical display and its usable work area.

type LinuxBackend

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

LinuxBackend wraps an existing X11 connection behind the platform Backend interface.

func NewLinuxBackend

func NewLinuxBackend(conn *x11.Connection) *LinuxBackend

NewLinuxBackend creates a Linux platform backend from an existing X11 connection.

func NewLinuxBackendFromDisplay

func NewLinuxBackendFromDisplay() (*LinuxBackend, error)

NewLinuxBackendFromDisplay creates a new Linux backend by opening a fresh X11 connection.

func (*LinuxBackend) ActiveDisplay

func (b *LinuxBackend) ActiveDisplay() (Display, error)

ActiveDisplay returns the currently active display.

func (*LinuxBackend) ActiveWindow

func (b *LinuxBackend) ActiveWindow() (WindowID, error)

ActiveWindow returns the currently active/focused window ID.

func (*LinuxBackend) Close

func (b *LinuxBackend) Close(windowID WindowID) error

Close requests graceful window close via WM_DELETE_WINDOW.

func (*LinuxBackend) Disconnect

func (b *LinuxBackend) Disconnect()

Disconnect closes the underlying X11 connection.

func (*LinuxBackend) Displays

func (b *LinuxBackend) Displays() ([]Display, error)

Displays returns all active displays.

func (*LinuxBackend) EventLoop

func (b *LinuxBackend) EventLoop()

EventLoop starts the X11 event loop (blocking).

func (*LinuxBackend) Focus

func (b *LinuxBackend) Focus(windowID WindowID) error

Focus activates and raises a window via _NET_ACTIVE_WINDOW.

func (*LinuxBackend) ListWindowsOnDisplay

func (b *LinuxBackend) ListWindowsOnDisplay(displayID int) ([]Window, error)

ListWindowsOnDisplay lists normal windows whose centers are inside the display bounds. Only windows on the current virtual desktop are returned.

func (*LinuxBackend) ListWindowsOnDisplayAllDesktops

func (b *LinuxBackend) ListWindowsOnDisplayAllDesktops(displayID int) ([]Window, error)

ListWindowsOnDisplayAllDesktops lists normal windows whose centers are inside the display bounds, across ALL virtual desktops (skips the _NET_WM_DESKTOP filter).

func (*LinuxBackend) Minimize

func (b *LinuxBackend) Minimize(windowID WindowID) error

Minimize minimizes a window via WM_CHANGE_STATE.

func (*LinuxBackend) MoveResize

func (b *LinuxBackend) MoveResize(windowID WindowID, bounds Rect) error

MoveResize moves and resizes a window to the specified bounds.

func (*LinuxBackend) RootWindow

func (b *LinuxBackend) RootWindow() xproto.Window

RootWindow returns the X11 root window ID.

func (*LinuxBackend) XUtil

func (b *LinuxBackend) XUtil() *xgbutil.XUtil

XUtil returns the underlying xgbutil connection for X11-specific operations.

type Rect

type Rect struct {
	X      int
	Y      int
	Width  int
	Height int
}

Rect describes a rectangular region in screen coordinates.

type Window

type Window struct {
	ID     WindowID
	PID    int
	AppID  string
	Title  string
	Bounds Rect
}

Window contains metadata and geometry for a top-level window.

type WindowID

type WindowID uint32

WindowID is a platform-neutral window identifier.

Jump to

Keyboard shortcuts

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