forked from getlantern/systray
-
Notifications
You must be signed in to change notification settings - Fork 61
Open
Labels
OS:WindowsOnly occurs on the Windows operating systemOnly occurs on the Windows operating system
Description
Set the title of a menu to a longer character, then restore it. The width of the menu will not be restored.
minimal reproducible example:
package main
import (
"fmt"
"time"
"fyne.io/systray"
"fyne.io/systray/example/icon"
)
func main() {
onExit := func() {
now := time.Now()
fmt.Println("Exit at", now.String())
}
systray.Run(onReady, onExit)
}
func addQuitItem() {
mQuit := systray.AddMenuItem("Quit", "Quit the whole app")
mQuit.Enable()
go func() {
<-mQuit.ClickedCh
fmt.Println("Requesting quit")
systray.Quit()
fmt.Println("Finished quitting")
}()
systray.AddSeparator()
}
func onReady() {
systray.SetTemplateIcon(icon.Data, icon.Data)
systray.SetTitle("Awesome App")
systray.SetTooltip("Lantern")
addQuitItem()
// We can manipulate the systray in other goroutines
go func() {
systray.SetTitle("Awesome App")
systray.SetTooltip("Pretty awesome棒棒嗒")
mChange := systray.AddMenuItem("Change Me", "Change Me")
mRestore := systray.AddMenuItem("Restore Me", "Restore Me")
systray.AddMenuItem("Ignored", "Ignored")
for {
select {
case <-mChange.ClickedCh:
mChange.SetTitle("I've Changed, hahahahahaha")
case <-mRestore.ClickedCh:
mChange.SetTitle("Change Me")
}
}
}()
}Metadata
Metadata
Assignees
Labels
OS:WindowsOnly occurs on the Windows operating systemOnly occurs on the Windows operating system