Documentation
¶
Index ¶
- type AllowlistSource
- type Application
- type Config
- type DisplayConfig
- type Geometry
- type Manager
- func (m *Manager) AddAllowlistedApp(appClass string) error
- func (m *Manager) AddBrowserWindowClass(windowClass string) error
- func (m *Manager) AddPattern(pattern string) error
- func (m *Manager) AddPlaceholderImage(path string) error
- func (m *Manager) AddTitlePattern(pattern string) error
- func (m *Manager) AddURLRule(rule UrlRule) error
- func (m *Manager) CleanupBrokenPlaceholderPaths() (int, error)
- func (m *Manager) ClearAllPlaceholderImages() error
- func (m *Manager) ClearPlaceholderImage() error
- func (m *Manager) CreateProfile(name string) (*Profile, error)
- func (m *Manager) DeleteProfile(profileID string) error
- func (m *Manager) DuplicateProfile(profileID, newName string) (*Profile, error)
- func (m *Manager) EnsureProfileDirectory(profileID string) error
- func (m *Manager) Get() *Config
- func (m *Manager) GetActiveProfile() *Profile
- func (m *Manager) GetActiveProfileID() string
- func (m *Manager) GetConfigDir() string
- func (m *Manager) GetConfigPath() string
- func (m *Manager) GetLogLevel() string
- func (m *Manager) GetPlaceholderImagePath() string
- func (m *Manager) GetPlaceholderImagePaths() []string
- func (m *Manager) GetPort() int
- func (m *Manager) GetProfile(profileID string) (*Profile, error)
- func (m *Manager) GetProfilePlaceholderDir(profileID string) string
- func (m *Manager) IsAllowlisted(appClass string) bool
- func (m *Manager) IsBrowserBlocked(windowClass string) bool
- func (m *Manager) IsBrowserWindowClass(windowClass string) bool
- func (m *Manager) IsPlaceholderImageUsedByOtherProfiles(path string) bool
- func (m *Manager) ListProfiles() []Profile
- func (m *Manager) RemoveAllowlistedApp(appClass string) error
- func (m *Manager) RemovePattern(pattern string) error
- func (m *Manager) RemovePlaceholderImage(path string) error
- func (m *Manager) RemoveTitlePattern(pattern string) error
- func (m *Manager) RemoveURLRule(ruleID string) error
- func (m *Manager) Save() error
- func (m *Manager) SetActiveProfile(profileID string) error
- func (m *Manager) SetBrowserBlocked(windowClass string, blocked bool) error
- func (m *Manager) SetLogLevel(level string) error
- func (m *Manager) SetPlaceholderImage(path string) error
- func (m *Manager) SetPort(port int) error
- func (m *Manager) Update(cfg *Config) error
- func (m *Manager) UpdateProfile(profile *Profile) error
- type OverlayConfig
- type Profile
- type UrlRule
- type UrlRuleType
- type WindowInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AllowlistSource ¶
type AllowlistSource string
AllowlistSource indicates how an application was allowlisted
const ( AllowlistSourceNone AllowlistSource = "" // Not allowlisted AllowlistSourceExplicit AllowlistSource = "explicit" // Explicitly added to allowlist AllowlistSourcePattern AllowlistSource = "pattern" // Matched by a pattern AllowlistSourceURL AllowlistSource = "url" // Matched by URL rule )
type Application ¶
type Application struct {
ID string `json:"id" mapstructure:"id"`
Name string `json:"name" mapstructure:"name"`
WindowClass string `json:"window_class" mapstructure:"window_class"`
PID int `json:"pid" mapstructure:"pid"`
Allowlisted bool `json:"allowlisted" mapstructure:"allowlisted"`
AllowlistSource AllowlistSource `json:"allowlist_source" mapstructure:"allowlist_source"`
}
Application represents a running application
type Config ¶
type Config struct {
// Global settings (not per-profile)
VirtualDisplay DisplayConfig `json:"virtual_display" yaml:"virtual_display"`
Overlay OverlayConfig `json:"overlay" yaml:"overlay"`
ServerPort int `json:"server_port" yaml:"server_port"`
LogLevel string `json:"log_level" yaml:"log_level"`
// Profile management
ActiveProfileID string `json:"active_profile_id" yaml:"active_profile_id"`
Profiles []Profile `json:"profiles" yaml:"profiles"`
// Legacy fields - populated by Get() from active profile for backwards compat
// These are included in JSON API responses but not serialized to YAML config files
AllowlistPatterns []string `json:"allowlist_patterns,omitempty" yaml:"allowlist_patterns,omitempty"`
AllowlistTitlePatterns []string `json:"allowlist_title_patterns,omitempty" yaml:"allowlist_title_patterns,omitempty"`
AllowlistedApps []string `json:"allowed_apps,omitempty" yaml:"allowed_apps,omitempty"`
AllowlistURLRules []UrlRule `json:"allowlist_url_rules,omitempty" yaml:"allowlist_url_rules,omitempty"`
BrowserWindowClasses []string `json:"browser_window_classes,omitempty" yaml:"browser_window_classes,omitempty"`
BrowserBlockedClasses []string `json:"browser_blocked_classes,omitempty" yaml:"browser_blocked_classes,omitempty"`
PlaceholderImagePath string `json:"placeholder_image_path,omitempty" yaml:"placeholder_image_path,omitempty"`
PlaceholderImagePaths []string `json:"placeholder_image_paths,omitempty" yaml:"placeholder_image_paths,omitempty"`
}
Config represents the application configuration
type DisplayConfig ¶
type DisplayConfig struct {
Width int `json:"width" yaml:"width"`
Height int `json:"height" yaml:"height"`
RefreshHz int `json:"refresh_hz" yaml:"refresh_hz"`
FPS int `json:"fps" yaml:"fps"`
Enabled bool `json:"enabled" yaml:"enabled"`
}
DisplayConfig represents virtual display configuration
type Geometry ¶
type Geometry struct {
X int `json:"x" mapstructure:"x"`
Y int `json:"y" mapstructure:"y"`
Width int `json:"width" mapstructure:"width"`
Height int `json:"height" mapstructure:"height"`
}
Geometry represents window geometry
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager handles configuration
func NewManager ¶
NewManager creates a new configuration manager
func (*Manager) AddAllowlistedApp ¶
AddAllowlistedApp adds an application to the allowlist of the active profile
func (*Manager) AddBrowserWindowClass ¶
AddBrowserWindowClass stores a browser window class for URL-based allowlisting in the active profile
func (*Manager) AddPattern ¶
AddPattern adds an allowlist pattern to the active profile
func (*Manager) AddPlaceholderImage ¶
AddPlaceholderImage adds a placeholder image path to the active profile
func (*Manager) AddTitlePattern ¶
AddTitlePattern adds a title-only allowlist pattern to the active profile
func (*Manager) AddURLRule ¶
AddURLRule adds a URL allowlist rule to the active profile
func (*Manager) CleanupBrokenPlaceholderPaths ¶
CleanupBrokenPlaceholderPaths removes placeholder image paths that point to non-existent files from all profiles. Returns the number of paths removed.
func (*Manager) ClearAllPlaceholderImages ¶
ClearAllPlaceholderImages removes all placeholder image paths from the active profile
func (*Manager) ClearPlaceholderImage ¶
ClearPlaceholderImage clears all placeholder images from the active profile
func (*Manager) CreateProfile ¶
CreateProfile creates a new profile with the given name
func (*Manager) DeleteProfile ¶
DeleteProfile deletes a profile by ID
func (*Manager) DuplicateProfile ¶
DuplicateProfile creates a copy of an existing profile with a new name
func (*Manager) EnsureProfileDirectory ¶
EnsureProfileDirectory creates the profile directory structure if it doesn't exist
func (*Manager) Get ¶
Get returns the current configuration with legacy fields populated from active profile
func (*Manager) GetActiveProfile ¶
GetActiveProfile returns a copy of the active profile
func (*Manager) GetActiveProfileID ¶
GetActiveProfileID returns the active profile ID
func (*Manager) GetConfigDir ¶
GetConfigDir returns the config directory path
func (*Manager) GetConfigPath ¶
GetConfigPath returns the path to the config file
func (*Manager) GetPlaceholderImagePath ¶
GetPlaceholderImagePath returns the first placeholder image path Deprecated: Use GetPlaceholderImagePaths instead
func (*Manager) GetPlaceholderImagePaths ¶
GetPlaceholderImagePaths returns all placeholder image paths from the active profile
func (*Manager) GetProfile ¶
GetProfile returns a profile by ID
func (*Manager) GetProfilePlaceholderDir ¶
GetProfilePlaceholderDir returns the placeholder directory for a profile
func (*Manager) IsAllowlisted ¶
IsAllowlisted checks if an application is allowlisted in the active profile
func (*Manager) IsBrowserBlocked ¶
IsBrowserBlocked checks if a browser window class is blocked in the active profile
func (*Manager) IsBrowserWindowClass ¶
IsBrowserWindowClass checks if a window class is recognized as a browser in the active profile
func (*Manager) IsPlaceholderImageUsedByOtherProfiles ¶
IsPlaceholderImageUsedByOtherProfiles checks if the given image path is used by any profile other than the active profile
func (*Manager) ListProfiles ¶
ListProfiles returns all profiles
func (*Manager) RemoveAllowlistedApp ¶
RemoveAllowlistedApp removes an application from the allowlist of the active profile
func (*Manager) RemovePattern ¶
RemovePattern removes an allowlist pattern from the active profile
func (*Manager) RemovePlaceholderImage ¶
RemovePlaceholderImage removes a placeholder image path from the active profile
func (*Manager) RemoveTitlePattern ¶
RemoveTitlePattern removes a title-only allowlist pattern from the active profile
func (*Manager) RemoveURLRule ¶
RemoveURLRule removes a URL allowlist rule by ID from the active profile
func (*Manager) SetActiveProfile ¶
SetActiveProfile switches to a different profile
func (*Manager) SetBrowserBlocked ¶
SetBrowserBlocked sets whether a browser window class is blocked in the active profile
func (*Manager) SetLogLevel ¶
SetLogLevel sets the log level
func (*Manager) SetPlaceholderImage ¶
SetPlaceholderImage sets the custom placeholder image path (legacy, adds to active profile)
func (*Manager) UpdateProfile ¶
UpdateProfile updates an existing profile
type OverlayConfig ¶
type OverlayConfig struct {
Enabled bool `json:"enabled" yaml:"enabled"`
Widgets []map[string]interface{} `json:"widgets" yaml:"widgets"`
}
OverlayConfig represents overlay configuration
type Profile ¶
type Profile struct {
ID string `json:"id" yaml:"id"`
Name string `json:"name" yaml:"name"`
AllowlistPatterns []string `json:"allowlist_patterns" yaml:"allowlist_patterns"`
AllowlistTitlePatterns []string `json:"allowlist_title_patterns" yaml:"allowlist_title_patterns"`
AllowlistedApps []string `json:"allowed_apps" yaml:"allowed_apps"`
AllowlistURLRules []UrlRule `json:"allowlist_url_rules" yaml:"allowlist_url_rules"`
BrowserWindowClasses []string `json:"browser_window_classes" yaml:"browser_window_classes"`
BrowserBlockedClasses []string `json:"browser_blocked_classes" yaml:"browser_blocked_classes"`
PlaceholderImagePaths []string `json:"placeholder_image_paths" yaml:"placeholder_image_paths"`
}
Profile represents a named configuration profile with its own allowlists and placeholders
type UrlRule ¶
type UrlRule struct {
ID string `json:"id" yaml:"id"`
Type UrlRuleType `json:"type" yaml:"type"`
Pattern string `json:"pattern" yaml:"pattern"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
}
UrlRule represents a URL allowlist rule
type UrlRuleType ¶
type UrlRuleType string
UrlRuleType indicates the type of URL allowlist rule
const ( UrlRuleTypePage UrlRuleType = "page" UrlRuleTypeDomain UrlRuleType = "domain" UrlRuleTypeSubdomain UrlRuleType = "subdomain" )
type WindowInfo ¶
type WindowInfo struct {
ID uint32 `json:"id" mapstructure:"id"`
Title string `json:"title" mapstructure:"title"`
Class string `json:"class" mapstructure:"class"`
PID int `json:"pid" mapstructure:"pid"`
Focused bool `json:"focused" mapstructure:"focused"`
Geometry Geometry `json:"geometry" mapstructure:"geometry"`
IsNativeWayland bool `json:"is_native_wayland" mapstructure:"is_native_wayland"` // True for native Wayland windows (no X11 ID)
Desktop int `json:"desktop" mapstructure:"desktop"` // Virtual desktop number (-1 means all desktops/sticky)
}
WindowInfo represents information about a window