trayapp

package
v0.0.0-...-71e6050 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2026 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DisableStartup

func DisableStartup() error

DisableStartup disables the tray icon systemd service

func EnableStartup

func EnableStartup() error

EnableStartup enables the tray icon systemd service

func IsDarkTheme

func IsDarkTheme() bool

func IsStartupEnabled

func IsStartupEnabled() bool

IsStartupEnabled checks if the tray icon systemd service is enabled

func OnReady

func OnReady()

OnReady initializes the system tray and its menu items.

func SetTemplateIcon

func SetTemplateIcon(icon []byte, badge IconBadge)

func SubscribeToThemeChanges

func SubscribeToThemeChanges(themeChangeChan chan<- bool)

Types

type BrowserOpener

type BrowserOpener interface {
	OpenURL(url string) error
}

BrowserOpener interface for opening URLs in browser

type CommandRunner

type CommandRunner interface {
	RunCommand(cmd string, args ...string) (string, error)
}

CommandRunner interface for running external commands

type FileWatcher

type FileWatcher interface {
	NewWatcher() (Watcher, error)
}

FileWatcher interface for file system watching

type IconBadge

type IconBadge string

SetTemplateIcon sets the system tray icon based on the operating system.

const (
	BadgeNone    IconBadge = "none"
	BadgeOrange  IconBadge = "orange"
	BadgeGreen   IconBadge = "green"
	BadgeRunning IconBadge = "running" // New badge type for running state
)

type IconProvider

type IconProvider interface {
	SetIcon()
	WorkingIcon()
	IconBlack() []byte
	IconWhite() []byte
}

IconProvider interface for icon management

type MenuItem interface {
	Enable()
	Disable()
	SetTitle(title string)
	AddSubMenuItem(title, tooltip string) MenuItem
	AddSubMenuItemCheckbox(title, tooltip string, checked bool) MenuItem
	Check()
	Uncheck()
	ClickedCh() <-chan struct{}
}

MenuItem interface for system tray menu items

type Notifier

type Notifier interface {
	Toast(message string)
}

Notifier interface for notifications

type RealBrowserOpener

type RealBrowserOpener struct{}

func (*RealBrowserOpener) OpenURL

func (r *RealBrowserOpener) OpenURL(url string) error

type RealCommandRunner

type RealCommandRunner struct{}

func (*RealCommandRunner) RunCommand

func (r *RealCommandRunner) RunCommand(cmd string, args ...string) (string, error)

type RealFileWatcher

type RealFileWatcher struct{}

func (*RealFileWatcher) NewWatcher

func (r *RealFileWatcher) NewWatcher() (Watcher, error)

type RealIconProvider

type RealIconProvider struct{}

func (*RealIconProvider) IconBlack

func (r *RealIconProvider) IconBlack() []byte

func (*RealIconProvider) IconWhite

func (r *RealIconProvider) IconWhite() []byte

func (*RealIconProvider) SetIcon

func (r *RealIconProvider) SetIcon()

func (*RealIconProvider) WorkingIcon

func (r *RealIconProvider) WorkingIcon()

type RealMenuItem

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

func (*RealMenuItem) AddSubMenuItem

func (r *RealMenuItem) AddSubMenuItem(title, tooltip string) MenuItem

func (*RealMenuItem) AddSubMenuItemCheckbox

func (r *RealMenuItem) AddSubMenuItemCheckbox(title, tooltip string, checked bool) MenuItem

func (*RealMenuItem) Check

func (r *RealMenuItem) Check()

func (*RealMenuItem) ClickedCh

func (r *RealMenuItem) ClickedCh() <-chan struct{}

func (*RealMenuItem) Disable

func (r *RealMenuItem) Disable()

func (*RealMenuItem) Enable

func (r *RealMenuItem) Enable()

func (*RealMenuItem) SetTitle

func (r *RealMenuItem) SetTitle(title string)

func (*RealMenuItem) Uncheck

func (r *RealMenuItem) Uncheck()

type RealNotifier

type RealNotifier struct{}

func (*RealNotifier) Toast

func (r *RealNotifier) Toast(message string)

type RealStartupManager

type RealStartupManager struct{}

func (*RealStartupManager) DisableStartup

func (r *RealStartupManager) DisableStartup() error

func (*RealStartupManager) EnableStartup

func (r *RealStartupManager) EnableStartup() error

func (*RealStartupManager) IsStartupEnabled

func (r *RealStartupManager) IsStartupEnabled() bool

type RealStateManager

type RealStateManager struct{}

func (*RealStateManager) GetLastState

func (r *RealStateManager) GetLastState(uuid string) (shared.LastState, bool, error)

func (*RealStateManager) GetModifiedTime

func (r *RealStateManager) GetModifiedTime() time.Time

func (*RealStateManager) IsLinked

func (r *RealStateManager) IsLinked() bool

func (*RealStateManager) SelfExe

func (r *RealStateManager) SelfExe() string

func (*RealStateManager) StatePath

func (r *RealStateManager) StatePath() string

type RealSystemTray

type RealSystemTray struct{}

func (*RealSystemTray) AddMenuItem

func (r *RealSystemTray) AddMenuItem(title, tooltip string) MenuItem

func (*RealSystemTray) AddSeparator

func (r *RealSystemTray) AddSeparator()

func (*RealSystemTray) Quit

func (r *RealSystemTray) Quit()

func (*RealSystemTray) SetTemplateIcon

func (r *RealSystemTray) SetTemplateIcon(icon, tooltip []byte)

func (*RealSystemTray) SetTitle

func (r *RealSystemTray) SetTitle(title string)

func (*RealSystemTray) TrayOpenedCh

func (r *RealSystemTray) TrayOpenedCh() <-chan struct{}

type RealSystemdManager

type RealSystemdManager struct{}

func (*RealSystemdManager) DisableTimer

func (r *RealSystemdManager) DisableTimer() error

func (*RealSystemdManager) DisableTrayIcon

func (r *RealSystemdManager) DisableTrayIcon() error

func (*RealSystemdManager) EnableTimer

func (r *RealSystemdManager) EnableTimer() error

func (*RealSystemdManager) EnableTrayIcon

func (r *RealSystemdManager) EnableTrayIcon() error

func (*RealSystemdManager) IsTimerEnabled

func (r *RealSystemdManager) IsTimerEnabled() bool

func (*RealSystemdManager) IsTrayIconEnabled

func (r *RealSystemdManager) IsTrayIconEnabled() bool

type RealThemeSubscriber

type RealThemeSubscriber struct{}

func (*RealThemeSubscriber) SubscribeToThemeChanges

func (r *RealThemeSubscriber) SubscribeToThemeChanges(ch chan<- bool)

type RealWatcher

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

func (*RealWatcher) Add

func (r *RealWatcher) Add(path string) error

func (*RealWatcher) Close

func (r *RealWatcher) Close() error

func (*RealWatcher) Errors

func (r *RealWatcher) Errors() <-chan error

func (*RealWatcher) Events

func (r *RealWatcher) Events() <-chan fsnotify.Event

type StartupManager

type StartupManager interface {
	IsStartupEnabled() bool
	EnableStartup() error
	DisableStartup() error
}

StartupManager interface for startup management

type StateManager

type StateManager interface {
	GetLastState(uuid string) (shared.LastState, bool, error)
	IsLinked() bool
	StatePath() string
	GetModifiedTime() time.Time
	SelfExe() string
}

StateManager interface for managing application state

type SystemTray

type SystemTray interface {
	SetTitle(title string)
	SetTemplateIcon(icon, tooltip []byte)
	AddMenuItem(title, tooltip string) MenuItem
	AddSeparator()
	Quit()
	TrayOpenedCh() <-chan struct{}
}

SystemTray interface for system tray operations

type SystemdManager

type SystemdManager interface {
	IsTimerEnabled() bool
	EnableTimer() error
	DisableTimer() error
	IsTrayIconEnabled() bool
	EnableTrayIcon() error
	DisableTrayIcon() error
}

SystemdManager interface for systemd operations

type ThemeSubscriber

type ThemeSubscriber interface {
	SubscribeToThemeChanges(ch chan<- bool)
}

ThemeSubscriber interface for theme changes

type TrayApp

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

TrayApp represents the system tray application with testable dependencies

func NewTrayApp

func NewTrayApp() *TrayApp

NewTrayApp creates a new TrayApp with production dependencies

func NewTrayAppWithDependencies

func NewTrayAppWithDependencies(
	commandRunner CommandRunner,
	stateManager StateManager,
	browserOpener BrowserOpener,
	systemTray SystemTray,
	fileWatcher FileWatcher,
	systemdManager SystemdManager,
	notifier Notifier,
	themeSubscriber ThemeSubscriber,
	iconProvider IconProvider,
	startupManager StartupManager,
	broadcaster *shared.Broadcaster,
) *TrayApp

NewTrayAppWithDependencies creates a new TrayApp with custom dependencies for testing

func (*TrayApp) OnReady

func (t *TrayApp) OnReady()

OnReady initializes the system tray and its menu items

type Watcher

type Watcher interface {
	Add(path string) error
	Close() error
	Events() <-chan fsnotify.Event
	Errors() <-chan error
}

Watcher interface for file system watcher

Jump to

Keyboard shortcuts

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