Compare commits
3 Commits
d62667a652
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
9a7246442c
|
|||
|
234069ba85
|
|||
|
ad319e19af
|
41
flake.lock
generated
Normal file
41
flake.lock
generated
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"flake-utils": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1653893745,
|
||||||
|
"narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1654845941,
|
||||||
|
"narHash": "sha256-uXulXu4BQ9ch1ItV0FlL2Ns8X83m6unT5h/0X//VRLQ=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "7b3e907a6fef935794b5049c2c57c519853deb90",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"id": "nixpkgs",
|
||||||
|
"type": "indirect"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-utils": "flake-utils",
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
||||||
14
flake.nix
Normal file
14
flake.nix
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
description = "";
|
||||||
|
|
||||||
|
inputs.flake-utils.url = "github:numtide/flake-utils";
|
||||||
|
|
||||||
|
outputs = { self, nixpkgs, flake-utils }:
|
||||||
|
flake-utils.lib.eachDefaultSystem
|
||||||
|
(system:
|
||||||
|
let pkgs = nixpkgs.legacyPackages.${system}; in
|
||||||
|
{
|
||||||
|
devShell = import ./shell.nix { inherit pkgs; };
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -167,10 +167,6 @@ def on_button(callback, args=(), buttons=(LEFT, MIDDLE, RIGHT, X, X2), types=(UP
|
|||||||
_listener.add_handler(handler)
|
_listener.add_handler(handler)
|
||||||
return handler
|
return handler
|
||||||
|
|
||||||
def on_pressed(callback, args=()):
|
|
||||||
""" Invokes `callback` with `args` when the left button is pressed. """
|
|
||||||
return on_button(callback, args, [LEFT], [DOWN])
|
|
||||||
|
|
||||||
def on_click(callback, args=()):
|
def on_click(callback, args=()):
|
||||||
""" Invokes `callback` with `args` when the left button is clicked. """
|
""" Invokes `callback` with `args` when the left button is clicked. """
|
||||||
return on_button(callback, args, [LEFT], [UP])
|
return on_button(callback, args, [LEFT], [UP])
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -20,8 +20,6 @@ EV_REL = 0x02
|
|||||||
EV_ABS = 0x03
|
EV_ABS = 0x03
|
||||||
EV_MSC = 0x04
|
EV_MSC = 0x04
|
||||||
|
|
||||||
INVALID_ARGUMENT_ERRNO = 22
|
|
||||||
|
|
||||||
def make_uinput():
|
def make_uinput():
|
||||||
import fcntl, struct
|
import fcntl, struct
|
||||||
|
|
||||||
@@ -31,12 +29,8 @@ def make_uinput():
|
|||||||
fcntl.ioctl(uinput, UI_SET_EVBIT, EV_KEY)
|
fcntl.ioctl(uinput, UI_SET_EVBIT, EV_KEY)
|
||||||
|
|
||||||
UI_SET_KEYBIT = 0x40045565
|
UI_SET_KEYBIT = 0x40045565
|
||||||
try:
|
for i in range(256):
|
||||||
for i in range(0x300):
|
fcntl.ioctl(uinput, UI_SET_KEYBIT, i)
|
||||||
fcntl.ioctl(uinput, UI_SET_KEYBIT, i)
|
|
||||||
except OSError as e:
|
|
||||||
if e.errno != INVALID_ARGUMENT_ERRNO:
|
|
||||||
raise e
|
|
||||||
|
|
||||||
BUS_USB = 0x03
|
BUS_USB = 0x03
|
||||||
uinput_user_dev = "80sHHHHi64i64i64i64i"
|
uinput_user_dev = "80sHHHHi64i64i64i64i"
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -3,12 +3,13 @@ from secrets import randbelow
|
|||||||
from time import sleep
|
from time import sleep
|
||||||
|
|
||||||
|
|
||||||
def erratic_movement(screen_width, screen_height):
|
def erratic_movement(screen_width=800, screen_height=600):
|
||||||
"""
|
"""
|
||||||
Moves the cursor to a random position with the screen's width and height as an upper bound
|
Moves the cursor to a random position with the screen's width and height as an upper bound
|
||||||
"""
|
"""
|
||||||
move(
|
move(
|
||||||
randbelow(screen_width), randbelow(screen_height),
|
randbelow(screen_width),
|
||||||
|
randbelow(screen_height),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -16,10 +17,8 @@ def main():
|
|||||||
"""
|
"""
|
||||||
Calls the movement function in an infinite loop, with a random delay between each call
|
Calls the movement function in an infinite loop, with a random delay between each call
|
||||||
"""
|
"""
|
||||||
screen_width = 800
|
|
||||||
screen_height = 600
|
|
||||||
while True:
|
while True:
|
||||||
erratic_movement(screen_width, screen_height)
|
erratic_movement()
|
||||||
sleep(randbelow(90))
|
sleep(randbelow(90))
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user