Full Syncthing tray wrapper with: - System tray with 5 icon states (idle/syncing/paused/error/disconnected) - Syncthing REST API client with auto-discovered API key - Long-polling event listener for real-time status - Transfer rate monitoring, folder tracking, recent files, conflict counting - Full context menu with folders, recent files, settings toggles - Embedded admin panel binary (webview, requires CGO) - OS notifications via beeep (per-event configurable) - Syncthing process management with auto-restart - Cross-platform installer with autostart - CI pipeline for Linux (.deb + .tar.gz) and Windows (.zip) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
41
internal/notify/notify.go
Normal file
41
internal/notify/notify.go
Normal file
@@ -0,0 +1,41 @@
|
||||
package notify
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"github.com/gen2brain/beeep"
|
||||
)
|
||||
|
||||
const appName = "SyncWarden"
|
||||
|
||||
// Send sends an OS notification.
|
||||
func Send(title, message string) {
|
||||
if err := beeep.Notify(title, message, ""); err != nil {
|
||||
log.Printf("notification error: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// SyncComplete notifies that a folder finished syncing.
|
||||
func SyncComplete(folder string) {
|
||||
Send(appName, folder+" finished syncing")
|
||||
}
|
||||
|
||||
// DeviceConnected notifies that a device connected.
|
||||
func DeviceConnected(name string) {
|
||||
Send(appName, name+" connected")
|
||||
}
|
||||
|
||||
// DeviceDisconnected notifies that a device disconnected.
|
||||
func DeviceDisconnected(name string) {
|
||||
Send(appName, name+" disconnected")
|
||||
}
|
||||
|
||||
// NewDevice notifies about a new device request.
|
||||
func NewDevice(name string) {
|
||||
Send(appName, "New device wants to connect: "+name)
|
||||
}
|
||||
|
||||
// Conflict notifies about a sync conflict.
|
||||
func Conflict(file, folder string) {
|
||||
Send(appName, "Conflict: "+file+" in "+folder)
|
||||
}
|
||||
Reference in New Issue
Block a user