mirror of
https://github.com/prashantgupta24/automatic-mouse-mover.git
synced 2024-12-22 16:34:11 +00:00
Merge pull request #27 from prashantgupta24/enhancements1
Enhancements1
This commit is contained in:
commit
3a9acd3666
10
cmd/main.go
10
cmd/main.go
@ -1,6 +1,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/go-vgo/robotgo"
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/getlantern/systray"
|
||||
@ -15,6 +16,8 @@ func main() {
|
||||
func onReady() {
|
||||
go func() {
|
||||
systray.SetIcon(icon.Data)
|
||||
about := systray.AddMenuItem("About AMM", "Information about the app")
|
||||
systray.AddSeparator()
|
||||
ammStart := systray.AddMenuItem("Start", "start the app")
|
||||
ammStop := systray.AddMenuItem("Stop", "stop the app")
|
||||
ammStop.Disable()
|
||||
@ -23,6 +26,9 @@ func onReady() {
|
||||
// Sets the icon of a menu item. Only available on Mac.
|
||||
//mQuit.SetIcon(icon.Data)
|
||||
mouseMover := mousemover.GetInstance()
|
||||
mouseMover.Start()
|
||||
ammStart.Disable()
|
||||
ammStop.Enable()
|
||||
for {
|
||||
select {
|
||||
case <-ammStart.ClickedCh:
|
||||
@ -43,6 +49,10 @@ func onReady() {
|
||||
mouseMover.Quit()
|
||||
systray.Quit()
|
||||
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")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@ func (m *MouseMover) Start() {
|
||||
activityTracker := &tracker.Instance{
|
||||
HeartbeatInterval: heartbeatInterval,
|
||||
WorkerInterval: workerInterval,
|
||||
//LogLevel: "debug", //if we want verbose logging
|
||||
// LogLevel: "debug", //if we want verbose logging
|
||||
}
|
||||
|
||||
heartbeatCh := activityTracker.Start()
|
||||
@ -71,7 +71,7 @@ func (m *MouseMover) run(heartbeatCh chan *tracker.Heartbeat, activityTracker *t
|
||||
msg := fmt.Sprintf("Mouse pointer cannot be moved at %v. Last moved at %v. Happened %v times. See README for details.",
|
||||
time.Now(), state.getLastMouseMovedTime(), state.getDidNotMoveCount())
|
||||
logger.Errorf(msg)
|
||||
if state.getDidNotMoveCount() >= 3 {
|
||||
if state.getDidNotMoveCount() >= 10 {
|
||||
go func() {
|
||||
robotgo.ShowAlert("Error with Automatic Mouse Mover", msg)
|
||||
}()
|
||||
|
Loading…
Reference in New Issue
Block a user