mirror of
https://github.com/prashantgupta24/automatic-mouse-mover.git
synced 2024-12-22 08:24:11 +00:00
handle system sleep better
This commit is contained in:
parent
4424b9d5df
commit
bbb4f62a5a
@ -14,7 +14,7 @@ var instance *MouseMover
|
|||||||
const (
|
const (
|
||||||
timeout = 100 //ms
|
timeout = 100 //ms
|
||||||
logDir = "log"
|
logDir = "log"
|
||||||
logFileName = "logFile-amm-3"
|
logFileName = "logFile-amm-5"
|
||||||
)
|
)
|
||||||
|
|
||||||
//Start the main app
|
//Start the main app
|
||||||
@ -62,7 +62,7 @@ func (m *MouseMover) run(heartbeatCh chan *tracker.Heartbeat, activityTracker *t
|
|||||||
case wasMouseMoveSuccess := <-mouseMoveSuccessCh:
|
case wasMouseMoveSuccess := <-mouseMoveSuccessCh:
|
||||||
if wasMouseMoveSuccess {
|
if wasMouseMoveSuccess {
|
||||||
state.updateLastMouseMovedTime(time.Now())
|
state.updateLastMouseMovedTime(time.Now())
|
||||||
logger.Infof("moved mouse at : %v\n\n", state.getLastMouseMovedTime())
|
logger.Infof("Is system sleeping? : %v : moved mouse at : %v\n\n", state.isSystemSleeping(), state.getLastMouseMovedTime())
|
||||||
movePixel *= -1
|
movePixel *= -1
|
||||||
state.updateDidNotMoveCount(0)
|
state.updateDidNotMoveCount(0)
|
||||||
} else {
|
} else {
|
||||||
@ -88,6 +88,8 @@ func (m *MouseMover) run(heartbeatCh chan *tracker.Heartbeat, activityTracker *t
|
|||||||
logger.Infof("activityType : %v times: %v\n", activityType, len(times))
|
logger.Infof("activityType : %v times: %v\n", activityType, len(times))
|
||||||
if activityType == activity.MachineSleep {
|
if activityType == activity.MachineSleep {
|
||||||
state.updateMachineSleepStatus(true)
|
state.updateMachineSleepStatus(true)
|
||||||
|
logger.Infof("system sleep registered. Is system sleeping? : %v", state.isSystemSleeping())
|
||||||
|
break
|
||||||
} else {
|
} else {
|
||||||
state.updateMachineSleepStatus(false)
|
state.updateMachineSleepStatus(false)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user