Documentation
¶
Index ¶
- func Register(c *core.Core) (any, error)
- type ActionOpenWindow
- type App
- type ClipboardContent
- type ClipboardContentType
- type CreateWindowOptions
- type DialogManager
- type EnvManager
- type Event
- type EventManager
- type EventType
- type FileFilter
- type Layout
- type LayoutInfo
- type LayoutManager
- type Logger
- type MenuManager
- type NotificationOptions
- type OpenDirectoryOptions
- type OpenFileOptions
- type Options
- type SaveFileOptions
- type ScreenInfo
- type Service
- func (s *Service) ApplyWorkflowLayout(workflow WorkflowType) error
- func (s *Service) CheckNotificationPermission() (bool, error)
- func (s *Service) ClearClipboard() error
- func (s *Service) CloseWindow(name string) error
- func (s *Service) ConfirmDialog(title, message string) (bool, error)
- func (s *Service) CreateWindow(opts CreateWindowOptions) (*WindowInfo, error)
- func (s *Service) DeleteLayout(name string) error
- func (s *Service) FocusWindow(name string) error
- func (s *Service) GetEventManager() *WSEventManager
- func (s *Service) GetFocusedWindow() string
- func (s *Service) GetLayout(name string) *Layout
- func (s *Service) GetPrimaryScreen() (*ScreenInfo, error)
- func (s *Service) GetSavedWindowStates() map[string]*WindowState
- func (s *Service) GetScreen(id string) (*ScreenInfo, error)
- func (s *Service) GetScreenAtPoint(x, y int) (*ScreenInfo, error)
- func (s *Service) GetScreenForWindow(name string) (*ScreenInfo, error)
- func (s *Service) GetScreens() []ScreenInfo
- func (s *Service) GetSystemTheme() ThemeInfo
- func (s *Service) GetTheme() ThemeInfo
- func (s *Service) GetTrayInfo() map[string]any
- func (s *Service) GetWindowInfo(name string) (*WindowInfo, error)
- func (s *Service) GetWindowTitle(name string) (string, error)
- func (s *Service) GetWorkAreas() []WorkArea
- func (s *Service) HasClipboard() bool
- func (s *Service) ListLayouts() []LayoutInfo
- func (s *Service) ListWindowInfos() []WindowInfo
- func (s *Service) MaximizeWindow(name string) error
- func (s *Service) MinimizeWindow(name string) error
- func (s *Service) NewWithOptions(opts ...WindowOption) (*application.WebviewWindow, error)
- func (s *Service) NewWithStruct(options *Window) (*application.WebviewWindow, error)
- func (s *Service) NewWithURL(url string) (*application.WebviewWindow, error)
- func (s *Service) OpenDirectoryDialog(opts OpenDirectoryOptions) (string, error)
- func (s *Service) OpenFileDialog(opts OpenFileOptions) ([]string, error)
- func (s *Service) OpenSingleFileDialog(opts OpenFileOptions) (string, error)
- func (s *Service) OpenWindow(opts ...WindowOption) error
- func (s *Service) PromptDialog(title, message string) (string, bool, error)
- func (s *Service) ReadClipboard() (string, error)
- func (s *Service) RegisterTrayMenuCallback(actionID string, callback func())
- func (s *Service) RequestNotificationPermission() (bool, error)
- func (s *Service) ResetWindowState() error
- func (s *Service) RestoreLayout(name string) error
- func (s *Service) RestoreWindow(name string) error
- func (s *Service) SaveFileDialog(opts SaveFileOptions) (string, error)
- func (s *Service) SaveLayout(name string) error
- func (s *Service) SelectDirectory() (string, error)
- func (s *Service) ServiceName() string
- func (s *Service) ServiceStartup(ctx context.Context, options application.ServiceOptions) error
- func (s *Service) SetNotifier(notifier *notifications.NotificationService)
- func (s *Service) SetTrayIcon(iconData []byte) error
- func (s *Service) SetTrayLabel(label string) error
- func (s *Service) SetTrayMenu(items []TrayMenuItem) error
- func (s *Service) SetTrayTooltip(tooltip string) error
- func (s *Service) SetWindowAlwaysOnTop(name string, alwaysOnTop bool) error
- func (s *Service) SetWindowBackgroundColour(name string, r, g, b, a uint8) error
- func (s *Service) SetWindowBounds(name string, x, y, width, height int) error
- func (s *Service) SetWindowFullscreen(name string, fullscreen bool) error
- func (s *Service) SetWindowPosition(name string, x, y int) error
- func (s *Service) SetWindowSize(name string, width, height int) error
- func (s *Service) SetWindowTitle(name string, title string) error
- func (s *Service) SetWindowVisibility(name string, visible bool) error
- func (s *Service) ShowEnvironmentDialog()
- func (s *Service) ShowErrorNotification(title, message string) error
- func (s *Service) ShowInfoNotification(title, message string) error
- func (s *Service) ShowNotification(opts NotificationOptions) error
- func (s *Service) ShowWarningNotification(title, message string) error
- func (s *Service) SnapWindow(name string, position SnapPosition) error
- func (s *Service) StackWindows(windowNames []string, offsetX, offsetY int) error
- func (s *Service) Startup(ctx context.Context) error
- func (s *Service) TileWindows(mode TileMode, windowNames []string) error
- func (s *Service) WriteClipboard(text string) error
- type SnapPosition
- type Subscription
- type SystemTrayManager
- type ThemeInfo
- type TileMode
- type TrayMenuItem
- type WSEventManager
- func (em *WSEventManager) AttachWindowListeners(window *application.WebviewWindow)
- func (em *WSEventManager) Close()
- func (em *WSEventManager) ConnectedClients() int
- func (em *WSEventManager) Emit(event Event)
- func (em *WSEventManager) EmitWindowEvent(eventType EventType, windowName string, data map[string]any)
- func (em *WSEventManager) HandleWebSocket(w http.ResponseWriter, r *http.Request)
- func (em *WSEventManager) SetupWindowEventListeners()
- type Window
- type WindowInfo
- type WindowManager
- type WindowOption
- type WindowState
- type WindowStateManager
- func (m *WindowStateManager) ApplyState(opts application.WebviewWindowOptions) application.WebviewWindowOptions
- func (m *WindowStateManager) CaptureState(name string, window *application.WebviewWindow)
- func (m *WindowStateManager) Clear() error
- func (m *WindowStateManager) ForceSync() error
- func (m *WindowStateManager) GetState(name string) *WindowState
- func (m *WindowStateManager) ListStates() []string
- func (m *WindowStateManager) SetState(name string, state *WindowState)
- func (m *WindowStateManager) UpdateMaximized(name string, maximized bool)
- func (m *WindowStateManager) UpdatePosition(name string, x, y int)
- func (m *WindowStateManager) UpdateSize(name string, width, height int)
- type WorkArea
- type WorkflowType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 MenuManager ¶
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 ¶
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 ¶
CheckNotificationPermission checks if notifications are authorized.
func (*Service) ClearClipboard ¶
ClearClipboard clears the clipboard by setting empty text.
func (*Service) CloseWindow ¶
CloseWindow closes a window by name.
func (*Service) ConfirmDialog ¶
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 ¶
DeleteLayout removes a saved layout by name.
func (*Service) FocusWindow ¶
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 ¶
GetFocusedWindow returns the name of the currently focused window, or empty if none.
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 ¶
GetSystemTheme returns the system's theme preference. This is the same as GetTheme since Wails follows the system theme.
func (*Service) GetTrayInfo ¶
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 ¶
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 ¶
GetWorkAreas returns the usable work area for all screens.
func (*Service) HasClipboard ¶
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 ¶
MaximizeWindow maximizes a window.
func (*Service) MinimizeWindow ¶
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 ¶
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 ¶
ReadClipboard reads text content from the system clipboard.
func (*Service) RegisterTrayMenuCallback ¶
RegisterTrayMenuCallback registers a callback for a tray menu action ID.
func (*Service) RequestNotificationPermission ¶
RequestNotificationPermission requests permission for native notifications.
func (*Service) ResetWindowState ¶
ResetWindowState clears saved window positions.
func (*Service) RestoreLayout ¶
RestoreLayout applies a saved layout, positioning all windows.
func (*Service) RestoreWindow ¶
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 ¶
SaveLayout saves the current window arrangement as a named layout.
func (*Service) SelectDirectory ¶
SelectDirectory opens a directory selection dialog and returns the selected path.
func (*Service) ServiceName ¶
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 ¶
SetTrayIcon sets the system tray icon from raw PNG data.
func (*Service) SetTrayLabel ¶
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 ¶
SetTrayTooltip sets the system tray tooltip text.
func (*Service) SetWindowAlwaysOnTop ¶
SetWindowAlwaysOnTop sets whether a window stays on top of other windows.
func (*Service) SetWindowBackgroundColour ¶
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 ¶
SetWindowBounds sets both position and size of a window.
func (*Service) SetWindowFullscreen ¶
SetWindowFullscreen sets a window to fullscreen mode.
func (*Service) SetWindowPosition ¶
SetWindowPosition moves a window to the specified position.
func (*Service) SetWindowSize ¶
SetWindowSize resizes a window.
func (*Service) SetWindowTitle ¶
SetWindowTitle changes a window's title.
func (*Service) SetWindowVisibility ¶
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 ¶
ShowErrorNotification shows an error notification.
func (*Service) ShowInfoNotification ¶
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 ¶
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 ¶
StackWindows arranges windows in a cascade (stacked) pattern. Each window is offset by the given amount from the previous one.
func (*Service) Startup ¶
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 ¶
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 ¶
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 ¶
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"`
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 Window ¶
type Window = application.WebviewWindowOptions
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 ¶
func (m *WindowStateManager) ApplyState(opts application.WebviewWindowOptions) application.WebviewWindowOptions
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" )