display

package module
v0.0.0-...-7faca0a Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2026 License: EUPL-1.2 Imports: 16 Imported by: 0

README

Display

This repository is a display module for the core web3 framework. It includes a Go backend, an Angular custom element, and a full release cycle configuration.

Getting Started

  1. Clone the repository:

    git clone https://github.com/Snider/display.git
    
  2. Install the dependencies:

    cd display
    go mod tidy
    cd ui
    npm install
    
  3. Run the development server:

    go run ./cmd/demo-cli serve
    

    This will start the Go backend and serve the Angular custom element.

Building the Custom Element

To build the Angular custom element, run the following command:

cd ui
npm run build

This will create a single JavaScript file in the dist directory that you can use in any HTML page.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the EUPL-1.2 License - see the LICENSE file for details.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(c *core.Core) (any, error)

Register creates and registers a new display service with the given Core instance. This wires up the ServiceRuntime so the service can access other services.

Types

type ActionOpenWindow

type ActionOpenWindow struct {
	application.WebviewWindowOptions
}

ActionOpenWindow is an IPC message used to request a new window. It contains the options for the new window.

example:

action := display.ActionOpenWindow{
	WebviewWindowOptions: application.WebviewWindowOptions{
		Name: "my-window",
		Title: "My Window",
		Width: 800,
		Height: 600,
	},
}

type App

type App interface {
	Window() WindowManager
	Menu() MenuManager
	Dialog() DialogManager
	SystemTray() SystemTrayManager
	Env() EnvManager
	Event() EventManager
	Logger() Logger
	Quit()
}

App abstracts the Wails application API for testing.

type ClipboardContent

type ClipboardContent struct {
	Type ClipboardContentType `json:"type"`
	Text string               `json:"text,omitempty"`
	HTML string               `json:"html,omitempty"`
}

ClipboardContent holds clipboard data.

type ClipboardContentType

type ClipboardContentType string

ClipboardContentType represents the type of content in the clipboard.

const (
	ClipboardText  ClipboardContentType = "text"
	ClipboardImage ClipboardContentType = "image"
	ClipboardHTML  ClipboardContentType = "html"
)

type CreateWindowOptions

type CreateWindowOptions struct {
	Name   string `json:"name"`
	Title  string `json:"title,omitempty"`
	URL    string `json:"url,omitempty"`
	X      int    `json:"x,omitempty"`
	Y      int    `json:"y,omitempty"`
	Width  int    `json:"width,omitempty"`
	Height int    `json:"height,omitempty"`
}

CreateWindowOptions contains options for creating a new window.

type DialogManager

type DialogManager interface {
	Info() *application.MessageDialog
	Warning() *application.MessageDialog
	OpenFile() *application.OpenFileDialogStruct
}

DialogManager handles dialog creation.

type EnvManager

type EnvManager interface {
	Info() application.EnvironmentInfo
	IsDarkMode() bool
}

EnvManager provides environment information.

type Event

type Event struct {
	Type      EventType      `json:"type"`
	Timestamp int64          `json:"timestamp"`
	Window    string         `json:"window,omitempty"`
	Data      map[string]any `json:"data,omitempty"`
}

Event represents a display event sent to subscribers.

type EventManager

type EventManager interface {
	OnApplicationEvent(eventType events.ApplicationEventType, handler func(*application.ApplicationEvent)) func()
	Emit(name string, data ...any) bool
}

EventManager handles event registration and emission.

type EventType

type EventType string

EventType represents the type of event.

const (
	EventWindowFocus  EventType = "window.focus"
	EventWindowBlur   EventType = "window.blur"
	EventWindowMove   EventType = "window.move"
	EventWindowResize EventType = "window.resize"
	EventWindowClose  EventType = "window.close"
	EventWindowCreate EventType = "window.create"
	EventThemeChange  EventType = "theme.change"
	EventScreenChange EventType = "screen.change"
)

type FileFilter

type FileFilter struct {
	DisplayName string   `json:"displayName"`
	Pattern     string   `json:"pattern"`
	Extensions  []string `json:"extensions,omitempty"`
}

FileFilter represents a file type filter for dialogs.

type Layout

type Layout struct {
	Name      string                 `json:"name"`
	Windows   map[string]WindowState `json:"windows"`
	CreatedAt int64                  `json:"createdAt"`
	UpdatedAt int64                  `json:"updatedAt"`
}

Layout represents a saved window arrangement.

type LayoutInfo

type LayoutInfo struct {
	Name        string `json:"name"`
	WindowCount int    `json:"windowCount"`
	CreatedAt   int64  `json:"createdAt"`
	UpdatedAt   int64  `json:"updatedAt"`
}

LayoutInfo contains summary information about a layout.

type LayoutManager

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

LayoutManager handles saving and restoring window layouts.

func NewLayoutManager

func NewLayoutManager() *LayoutManager

NewLayoutManager creates a new layout manager.

func (*LayoutManager) DeleteLayout

func (m *LayoutManager) DeleteLayout(name string) error

DeleteLayout removes a layout by name.

func (*LayoutManager) GetLayout

func (m *LayoutManager) GetLayout(name string) *Layout

GetLayout returns a layout by name.

func (*LayoutManager) ListLayouts

func (m *LayoutManager) ListLayouts() []LayoutInfo

ListLayouts returns all saved layout names with metadata.

func (*LayoutManager) SaveLayout

func (m *LayoutManager) SaveLayout(name string, windows map[string]WindowState) error

SaveLayout saves a new layout or updates an existing one.

type Logger

type Logger interface {
	Info(message string, args ...any)
}

Logger provides logging capabilities.

type MenuManager interface {
	New() *application.Menu
	Set(menu *application.Menu)
}

MenuManager handles menu creation.

type NotificationOptions

type NotificationOptions struct {
	ID       string `json:"id,omitempty"`
	Title    string `json:"title"`
	Message  string `json:"message"`
	Subtitle string `json:"subtitle,omitempty"`
}

NotificationOptions contains options for showing a notification.

type OpenDirectoryOptions

type OpenDirectoryOptions struct {
	Title            string `json:"title,omitempty"`
	DefaultDirectory string `json:"defaultDirectory,omitempty"`
	AllowMultiple    bool   `json:"allowMultiple,omitempty"`
}

OpenDirectoryOptions contains options for the directory picker.

type OpenFileOptions

type OpenFileOptions struct {
	Title            string       `json:"title,omitempty"`
	DefaultDirectory string       `json:"defaultDirectory,omitempty"`
	DefaultFilename  string       `json:"defaultFilename,omitempty"`
	Filters          []FileFilter `json:"filters,omitempty"`
	AllowMultiple    bool         `json:"allowMultiple,omitempty"`
}

OpenFileOptions contains options for the open file dialog.

type Options

type Options struct{}

Options holds configuration for the display service. This struct is used to configure the display service at startup.

type SaveFileOptions

type SaveFileOptions struct {
	Title            string       `json:"title,omitempty"`
	DefaultDirectory string       `json:"defaultDirectory,omitempty"`
	DefaultFilename  string       `json:"defaultFilename,omitempty"`
	Filters          []FileFilter `json:"filters,omitempty"`
}

SaveFileOptions contains options for the save file dialog.

type ScreenInfo

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

ScreenInfo contains information about a display screen.

type Service

type Service struct {
	*core.ServiceRuntime[Options]
	// contains filtered or unexported fields
}

Service manages windowing, dialogs, and other visual elements. It is the primary interface for interacting with the UI.

func New

func New() (*Service, error)

New is the constructor for the display service. It creates a new Service and returns it.

example:

displayService, err := display.New()
if err != nil {
	log.Fatal(err)
}

func (*Service) ApplyWorkflowLayout

func (s *Service) ApplyWorkflowLayout(workflow WorkflowType) error

ApplyWorkflowLayout applies a predefined layout for a specific workflow.

func (*Service) CheckNotificationPermission

func (s *Service) CheckNotificationPermission() (bool, error)

CheckNotificationPermission checks if notifications are authorized.

func (*Service) ClearClipboard

func (s *Service) ClearClipboard() error

ClearClipboard clears the clipboard by setting empty text.

func (*Service) CloseWindow

func (s *Service) CloseWindow(name string) error

CloseWindow closes a window by name.

func (*Service) ConfirmDialog

func (s *Service) ConfirmDialog(title, message string) (bool, error)

ConfirmDialog shows a confirmation dialog and returns the user's choice.

func (*Service) CreateWindow

func (s *Service) CreateWindow(opts CreateWindowOptions) (*WindowInfo, error)

CreateWindow creates a new window with the specified options.

func (*Service) DeleteLayout

func (s *Service) DeleteLayout(name string) error

DeleteLayout removes a saved layout by name.

func (*Service) FocusWindow

func (s *Service) FocusWindow(name string) error

FocusWindow brings a window to the front.

func (*Service) GetEventManager

func (s *Service) GetEventManager() *WSEventManager

GetEventManager returns the event manager for WebSocket event subscriptions.

func (*Service) GetFocusedWindow

func (s *Service) GetFocusedWindow() string

GetFocusedWindow returns the name of the currently focused window, or empty if none.

func (*Service) GetLayout

func (s *Service) GetLayout(name string) *Layout

GetLayout returns a specific layout by name.

func (*Service) GetPrimaryScreen

func (s *Service) GetPrimaryScreen() (*ScreenInfo, error)

GetPrimaryScreen returns information about the primary screen.

func (*Service) GetSavedWindowStates

func (s *Service) GetSavedWindowStates() map[string]*WindowState

GetSavedWindowStates returns all saved window states.

func (*Service) GetScreen

func (s *Service) GetScreen(id string) (*ScreenInfo, error)

GetScreen returns information about a specific screen by ID.

func (*Service) GetScreenAtPoint

func (s *Service) GetScreenAtPoint(x, y int) (*ScreenInfo, error)

GetScreenAtPoint returns the screen containing a specific point.

func (*Service) GetScreenForWindow

func (s *Service) GetScreenForWindow(name string) (*ScreenInfo, error)

GetScreenForWindow returns the screen containing a specific window.

func (*Service) GetScreens

func (s *Service) GetScreens() []ScreenInfo

GetScreens returns information about all available screens.

func (*Service) GetSystemTheme

func (s *Service) GetSystemTheme() ThemeInfo

GetSystemTheme returns the system's theme preference. This is the same as GetTheme since Wails follows the system theme.

func (*Service) GetTheme

func (s *Service) GetTheme() ThemeInfo

GetTheme returns the current application theme.

func (*Service) GetTrayInfo

func (s *Service) GetTrayInfo() map[string]any

GetTrayInfo returns information about the current tray state.

func (*Service) GetWindowInfo

func (s *Service) GetWindowInfo(name string) (*WindowInfo, error)

GetWindowInfo returns information about a window by name.

func (*Service) GetWindowTitle

func (s *Service) GetWindowTitle(name string) (string, error)

GetWindowTitle returns the title of a window by name. Note: Wails v3 doesn't expose a title getter, so we track it ourselves or return the name.

func (*Service) GetWorkAreas

func (s *Service) GetWorkAreas() []WorkArea

GetWorkAreas returns the usable work area for all screens.

func (*Service) HasClipboard

func (s *Service) HasClipboard() bool

HasClipboard checks if the clipboard has content.

func (*Service) ListLayouts

func (s *Service) ListLayouts() []LayoutInfo

ListLayouts returns all saved layout names with metadata.

func (*Service) ListWindowInfos

func (s *Service) ListWindowInfos() []WindowInfo

ListWindowInfos returns information about all windows.

func (*Service) MaximizeWindow

func (s *Service) MaximizeWindow(name string) error

MaximizeWindow maximizes a window.

func (*Service) MinimizeWindow

func (s *Service) MinimizeWindow(name string) error

MinimizeWindow minimizes a window.

func (*Service) NewWithOptions

func (s *Service) NewWithOptions(opts ...WindowOption) (*application.WebviewWindow, error)

NewWithOptions creates a new window by applying a series of options.

func (*Service) NewWithStruct

func (s *Service) NewWithStruct(options *Window) (*application.WebviewWindow, error)

NewWithStruct creates a new window using the provided options and returns its handle.

func (*Service) NewWithURL

func (s *Service) NewWithURL(url string) (*application.WebviewWindow, error)

NewWithURL creates a new default window pointing to the specified URL.

func (*Service) OpenDirectoryDialog

func (s *Service) OpenDirectoryDialog(opts OpenDirectoryOptions) (string, error)

OpenDirectoryDialog shows a directory picker.

func (*Service) OpenFileDialog

func (s *Service) OpenFileDialog(opts OpenFileOptions) ([]string, error)

OpenFileDialog shows a file open dialog and returns selected path(s).

func (*Service) OpenSingleFileDialog

func (s *Service) OpenSingleFileDialog(opts OpenFileOptions) (string, error)

OpenSingleFileDialog shows a file open dialog for a single file.

func (*Service) OpenWindow

func (s *Service) OpenWindow(opts ...WindowOption) error

OpenWindow creates a new window with the given options. If no options are provided, it will use the default options.

example:

err := displayService.OpenWindow(
	display.WithName("my-window"),
	display.WithTitle("My Window"),
	display.WithWidth(800),
	display.WithHeight(600),
)
if err != nil {
	log.Fatal(err)
}

func (*Service) PromptDialog

func (s *Service) PromptDialog(title, message string) (string, bool, error)

PromptDialog shows an input prompt dialog. Note: Wails v3 doesn't have a native prompt dialog, so this uses a question dialog.

func (*Service) ReadClipboard

func (s *Service) ReadClipboard() (string, error)

ReadClipboard reads text content from the system clipboard.

func (*Service) RegisterTrayMenuCallback

func (s *Service) RegisterTrayMenuCallback(actionID string, callback func())

RegisterTrayMenuCallback registers a callback for a tray menu action ID.

func (*Service) RequestNotificationPermission

func (s *Service) RequestNotificationPermission() (bool, error)

RequestNotificationPermission requests permission for native notifications.

func (*Service) ResetWindowState

func (s *Service) ResetWindowState() error

ResetWindowState clears saved window positions.

func (*Service) RestoreLayout

func (s *Service) RestoreLayout(name string) error

RestoreLayout applies a saved layout, positioning all windows.

func (*Service) RestoreWindow

func (s *Service) RestoreWindow(name string) error

RestoreWindow restores a maximized/minimized window.

func (*Service) SaveFileDialog

func (s *Service) SaveFileDialog(opts SaveFileOptions) (string, error)

SaveFileDialog shows a save file dialog and returns the selected path.

func (*Service) SaveLayout

func (s *Service) SaveLayout(name string) error

SaveLayout saves the current window arrangement as a named layout.

func (*Service) SelectDirectory

func (s *Service) SelectDirectory() (string, error)

SelectDirectory opens a directory selection dialog and returns the selected path.

func (*Service) ServiceName

func (s *Service) ServiceName() string

ServiceName returns the canonical name for this service.

func (*Service) ServiceStartup

func (s *Service) ServiceStartup(ctx context.Context, options application.ServiceOptions) error

ServiceStartup is called by Wails when the app starts. It initializes the display service and sets up the main application window and system tray.

func (*Service) SetNotifier

func (s *Service) SetNotifier(notifier *notifications.NotificationService)

SetNotifier sets the notifications service for native notifications.

func (*Service) SetTrayIcon

func (s *Service) SetTrayIcon(iconData []byte) error

SetTrayIcon sets the system tray icon from raw PNG data.

func (*Service) SetTrayLabel

func (s *Service) SetTrayLabel(label string) error

SetTrayLabel sets the system tray label text.

func (*Service) SetTrayMenu

func (s *Service) SetTrayMenu(items []TrayMenuItem) error

SetTrayMenu sets the system tray menu from a list of menu items.

func (*Service) SetTrayTooltip

func (s *Service) SetTrayTooltip(tooltip string) error

SetTrayTooltip sets the system tray tooltip text.

func (*Service) SetWindowAlwaysOnTop

func (s *Service) SetWindowAlwaysOnTop(name string, alwaysOnTop bool) error

SetWindowAlwaysOnTop sets whether a window stays on top of other windows.

func (*Service) SetWindowBackgroundColour

func (s *Service) SetWindowBackgroundColour(name string, r, g, b, a uint8) error

SetWindowBackgroundColour sets the background color of a window with alpha for transparency. Note: On Windows, only alpha 0 or 255 are supported. Other values treated as 255.

func (*Service) SetWindowBounds

func (s *Service) SetWindowBounds(name string, x, y, width, height int) error

SetWindowBounds sets both position and size of a window.

func (*Service) SetWindowFullscreen

func (s *Service) SetWindowFullscreen(name string, fullscreen bool) error

SetWindowFullscreen sets a window to fullscreen mode.

func (*Service) SetWindowPosition

func (s *Service) SetWindowPosition(name string, x, y int) error

SetWindowPosition moves a window to the specified position.

func (*Service) SetWindowSize

func (s *Service) SetWindowSize(name string, width, height int) error

SetWindowSize resizes a window.

func (*Service) SetWindowTitle

func (s *Service) SetWindowTitle(name string, title string) error

SetWindowTitle changes a window's title.

func (*Service) SetWindowVisibility

func (s *Service) SetWindowVisibility(name string, visible bool) error

SetWindowVisibility shows or hides a window.

func (*Service) ShowEnvironmentDialog

func (s *Service) ShowEnvironmentDialog()

ShowEnvironmentDialog displays a dialog containing detailed information about the application's runtime environment. This is useful for debugging and understanding the context in which the application is running.

example:

displayService.ShowEnvironmentDialog()

func (*Service) ShowErrorNotification

func (s *Service) ShowErrorNotification(title, message string) error

ShowErrorNotification shows an error notification.

func (*Service) ShowInfoNotification

func (s *Service) ShowInfoNotification(title, message string) error

ShowInfoNotification shows an info notification with a simple message.

func (*Service) ShowNotification

func (s *Service) ShowNotification(opts NotificationOptions) error

ShowNotification displays a native system notification. Falls back to dialog if notifier is not available.

func (*Service) ShowWarningNotification

func (s *Service) ShowWarningNotification(title, message string) error

ShowWarningNotification shows a warning notification.

func (*Service) SnapWindow

func (s *Service) SnapWindow(name string, position SnapPosition) error

SnapWindow snaps a window to a screen edge or corner.

func (*Service) StackWindows

func (s *Service) StackWindows(windowNames []string, offsetX, offsetY int) error

StackWindows arranges windows in a cascade (stacked) pattern. Each window is offset by the given amount from the previous one.

func (*Service) Startup

func (s *Service) Startup(ctx context.Context) error

Startup is called when the app starts. It initializes the display service and sets up the main application window and system tray.

err := displayService.Startup(ctx)
if err != nil {
	log.Fatal(err)
}

func (*Service) TileWindows

func (s *Service) TileWindows(mode TileMode, windowNames []string) error

TileWindows arranges windows in a tiled layout. mode can be: left, right, top, bottom, top-left, top-right, bottom-left, bottom-right, grid If windowNames is empty, tiles all windows.

func (*Service) WriteClipboard

func (s *Service) WriteClipboard(text string) error

WriteClipboard writes text content to the system clipboard.

type SnapPosition

type SnapPosition string

SnapPosition represents positions for snapping windows.

const (
	SnapLeft        SnapPosition = "left"
	SnapRight       SnapPosition = "right"
	SnapTop         SnapPosition = "top"
	SnapBottom      SnapPosition = "bottom"
	SnapTopLeft     SnapPosition = "top-left"
	SnapTopRight    SnapPosition = "top-right"
	SnapBottomLeft  SnapPosition = "bottom-left"
	SnapBottomRight SnapPosition = "bottom-right"
	SnapCenter      SnapPosition = "center"
)

type Subscription

type Subscription struct {
	ID         string      `json:"id"`
	EventTypes []EventType `json:"eventTypes"`
}

Subscription represents a client subscription to events.

type SystemTrayManager

type SystemTrayManager interface {
	New() *application.SystemTray
}

SystemTrayManager handles system tray creation.

type ThemeInfo

type ThemeInfo struct {
	IsDark bool   `json:"isDark"`
	Theme  string `json:"theme"`  // "dark" or "light"
	System bool   `json:"system"` // Whether following system theme
}

ThemeInfo contains information about the current theme.

type TileMode

type TileMode string

TileMode represents different tiling arrangements.

const (
	TileModeLeft        TileMode = "left"
	TileModeRight       TileMode = "right"
	TileModeTop         TileMode = "top"
	TileModeBottom      TileMode = "bottom"
	TileModeTopLeft     TileMode = "top-left"
	TileModeTopRight    TileMode = "top-right"
	TileModeBottomLeft  TileMode = "bottom-left"
	TileModeBottomRight TileMode = "bottom-right"
	TileModeGrid        TileMode = "grid"
)

type TrayMenuItem

type TrayMenuItem struct {
	Label    string         `json:"label"`
	Type     string         `json:"type,omitempty"`    // "normal", "separator", "checkbox", "radio"
	Checked  bool           `json:"checked,omitempty"` // for checkbox/radio items
	Disabled bool           `json:"disabled,omitempty"`
	Tooltip  string         `json:"tooltip,omitempty"`
	Submenu  []TrayMenuItem `json:"submenu,omitempty"`
	ActionID string         `json:"actionId,omitempty"` // ID for callback
}

TrayMenuItem represents a menu item for the system tray.

type WSEventManager

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

WSEventManager manages WebSocket connections and event subscriptions.

func NewWSEventManager

func NewWSEventManager(display *Service) *WSEventManager

NewWSEventManager creates a new event manager.

func (*WSEventManager) AttachWindowListeners

func (em *WSEventManager) AttachWindowListeners(window *application.WebviewWindow)

AttachWindowListeners attaches event listeners to a specific window.

func (*WSEventManager) Close

func (em *WSEventManager) Close()

Close shuts down the event manager.

func (*WSEventManager) ConnectedClients

func (em *WSEventManager) ConnectedClients() int

ConnectedClients returns the number of connected WebSocket clients.

func (*WSEventManager) Emit

func (em *WSEventManager) Emit(event Event)

Emit sends an event to all subscribed clients.

func (*WSEventManager) EmitWindowEvent

func (em *WSEventManager) EmitWindowEvent(eventType EventType, windowName string, data map[string]any)

EmitWindowEvent is a helper to emit window-related events.

func (*WSEventManager) HandleWebSocket

func (em *WSEventManager) HandleWebSocket(w http.ResponseWriter, r *http.Request)

HandleWebSocket handles WebSocket upgrade and connection.

func (*WSEventManager) SetupWindowEventListeners

func (em *WSEventManager) SetupWindowEventListeners()

SetupWindowEventListeners attaches event listeners to all windows.

type WindowInfo

type WindowInfo struct {
	Name      string `json:"name"`
	X         int    `json:"x"`
	Y         int    `json:"y"`
	Width     int    `json:"width"`
	Height    int    `json:"height"`
	Maximized bool   `json:"maximized"`
}

WindowInfo contains information about a window for MCP.

type WindowManager

type WindowManager interface {
	NewWithOptions(opts application.WebviewWindowOptions) *application.WebviewWindow
	GetAll() []application.Window
}

WindowManager handles window creation and management.

type WindowOption

type WindowOption func(*application.WebviewWindowOptions) error

func WindowHeight

func WindowHeight(i int) WindowOption

func WindowName

func WindowName(s string) WindowOption

func WindowTitle

func WindowTitle(s string) WindowOption

func WindowURL

func WindowURL(s string) WindowOption

func WindowWidth

func WindowWidth(i int) WindowOption

type WindowState

type WindowState struct {
	X         int    `json:"x"`
	Y         int    `json:"y"`
	Width     int    `json:"width"`
	Height    int    `json:"height"`
	Maximized bool   `json:"maximized"`
	Screen    string `json:"screen,omitempty"` // Screen identifier for multi-monitor
	URL       string `json:"url,omitempty"`    // Last URL/route
	UpdatedAt int64  `json:"updatedAt"`
}

WindowState holds the persisted state of a window.

type WindowStateManager

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

WindowStateManager handles saving and restoring window positions.

func NewWindowStateManager

func NewWindowStateManager() *WindowStateManager

NewWindowStateManager creates a new window state manager. It loads existing state from the config directory.

func (*WindowStateManager) ApplyState

ApplyState applies saved state to window options. Returns the modified options with position/size restored.

func (*WindowStateManager) CaptureState

func (m *WindowStateManager) CaptureState(name string, window *application.WebviewWindow)

CaptureState captures the current state from a window.

func (*WindowStateManager) Clear

func (m *WindowStateManager) Clear() error

Clear removes all saved window states.

func (*WindowStateManager) ForceSync

func (m *WindowStateManager) ForceSync() error

ForceSync immediately saves all state to disk.

func (*WindowStateManager) GetState

func (m *WindowStateManager) GetState(name string) *WindowState

GetState returns the saved state for a window, or nil if none.

func (*WindowStateManager) ListStates

func (m *WindowStateManager) ListStates() []string

ListStates returns all saved window names.

func (*WindowStateManager) SetState

func (m *WindowStateManager) SetState(name string, state *WindowState)

SetState saves the state for a window.

func (*WindowStateManager) UpdateMaximized

func (m *WindowStateManager) UpdateMaximized(name string, maximized bool)

UpdateMaximized updates the maximized state of a window.

func (*WindowStateManager) UpdatePosition

func (m *WindowStateManager) UpdatePosition(name string, x, y int)

UpdatePosition updates just the position of a window.

func (*WindowStateManager) UpdateSize

func (m *WindowStateManager) UpdateSize(name string, width, height int)

UpdateSize updates just the size of a window.

type WorkArea

type WorkArea struct {
	ScreenID string `json:"screenId"`
	X        int    `json:"x"`
	Y        int    `json:"y"`
	Width    int    `json:"width"`
	Height   int    `json:"height"`
}

WorkArea represents usable screen space (excluding dock, menubar, etc).

type WorkflowType

type WorkflowType string

WorkflowType represents predefined workflow layouts.

const (
	WorkflowCoding     WorkflowType = "coding"
	WorkflowDebugging  WorkflowType = "debugging"
	WorkflowPresenting WorkflowType = "presenting"
	WorkflowSideBySide WorkflowType = "side-by-side"
)

Directories

Path Synopsis
cmd
demo-cli command

Jump to

Keyboard shortcuts

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