File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -135,14 +135,17 @@ func runJiggler() {
135135 logger .Debug ().Msgf ("Time since last user input %v" , timeSinceLastInput )
136136 if timeSinceLastInput > time .Duration (inactivitySeconds )* time .Second {
137137 logger .Debug ().Msg ("Jiggling mouse..." )
138- //TODO: change to rel mouse
139- err := rpcAbsMouseReport ( 1 , 1 , 0 )
140- if err != nil {
141- logger . Warn (). Msgf ( "Failed to jiggle mouse: %v" , err )
138+ dx := int8 ( rand . Intn ( 3 ) + 1 )
139+ dy := int8 ( rand . Intn ( 3 ) + 1 )
140+ if rand . Intn ( 2 ) == 0 {
141+ dx = - dx
142142 }
143- err = rpcAbsMouseReport (0 , 0 , 0 )
143+ if rand .Intn (2 ) == 0 {
144+ dy = - dy
145+ }
146+ err := rpcRelMouseReport (dx , dy , 0 )
144147 if err != nil {
145- logger .Warn ().Msgf ("Failed to reset mouse position : %v" , err )
148+ logger .Warn ().Msgf ("Failed to jiggle mouse: %v" , err )
146149 }
147150 }
148151 }
You can’t perform that action at this time.
0 commit comments