WhspBrd/pkg/systray/systray.go
2025-05-28 10:32:46 +02:00

40 lines
818 B
Go

package systray
import (
"os"
"os/exec"
"whspbrd/pkg/icons"
"github.com/getlantern/systray"
)
func Systray() {
systray.Run(onReady, onExit)
}
func onReady() {
systray.SetIcon(icon.Data)
systray.SetTitle("whspbrd")
systray.SetTooltip("chat with your friends")
mOpen := systray.AddMenuItem("Open", "Open the app")
go func() {
<-mOpen.ClickedCh
// Open the app (e.g., open a terminal or a GUI window)
// This is a placeholder; replace with actual code to open your app
// For example, you could use exec.Command to run a terminal command
// exec.Command("gnome-terminal", "--", "your_app_command").Run()
exec.Command("kitty").Run()
}()
mQuitOrig := systray.AddMenuItem("Quit", "Quit the whole app")
go func() {
<-mQuitOrig.ClickedCh
systray.Quit()
}()
}
func onExit() {
os.Exit(0)
}