Skip to content

Instantly share code, notes, and snippets.

@tinylinden
Created April 14, 2022 20:26
Show Gist options
  • Save tinylinden/7f85affca03745a300a6b95e25593e04 to your computer and use it in GitHub Desktop.
Save tinylinden/7f85affca03745a300a6b95e25593e04 to your computer and use it in GitHub Desktop.
import java.awt.*;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
public class Jiggler implements Runnable {
private final Robot robot;
private Jiggler() {
try {
robot = new Robot();
} catch (AWTException e) {
throw new IllegalStateException("Initialization failed", e);
}
}
@Override
public void run() {
final Point p = MouseInfo.getPointerInfo().getLocation();
robot.mouseMove(p.x, p.y);
}
public static void main(String[] args) {
Executors.newSingleThreadScheduledExecutor()
.scheduleAtFixedRate(new Jiggler(), 0, 42, TimeUnit.SECONDS);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment