about + enable default

This commit is contained in:
Prashant Gupta 2021-08-19 12:01:27 -07:00
parent 42b7aea859
commit b7b8ed2ecd

View File

@ -1,6 +1,7 @@
package main package main
import ( import (
"github.com/go-vgo/robotgo"
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
"github.com/getlantern/systray" "github.com/getlantern/systray"
@ -15,6 +16,8 @@ func main() {
func onReady() { func onReady() {
go func() { go func() {
systray.SetIcon(icon.Data) systray.SetIcon(icon.Data)
about := systray.AddMenuItem("About AMM", "Information about the app")
systray.AddSeparator()
ammStart := systray.AddMenuItem("Start", "start the app") ammStart := systray.AddMenuItem("Start", "start the app")
ammStop := systray.AddMenuItem("Stop", "stop the app") ammStop := systray.AddMenuItem("Stop", "stop the app")
ammStop.Disable() ammStop.Disable()
@ -23,6 +26,9 @@ func onReady() {
// Sets the icon of a menu item. Only available on Mac. // Sets the icon of a menu item. Only available on Mac.
//mQuit.SetIcon(icon.Data) //mQuit.SetIcon(icon.Data)
mouseMover := mousemover.GetInstance() mouseMover := mousemover.GetInstance()
mouseMover.Start()
ammStart.Disable()
ammStop.Enable()
for { for {
select { select {
case <-ammStart.ClickedCh: case <-ammStart.ClickedCh:
@ -43,6 +49,10 @@ func onReady() {
mouseMover.Quit() mouseMover.Quit()
systray.Quit() systray.Quit()
return return
case <-about.ClickedCh:
log.Infof("Requesting about")
robotgo.ShowAlert("Automatic-mouse-mover app", "Developed by Prashant Gupta. \n\nMore info at: https://github.com/prashantgupta24/automatic-mouse-mover")
} }
} }