Compare commits
1 Commits
master
...
9172cced29
| Author | SHA1 | Date | |
|---|---|---|---|
|
9172cced29
|
41
flake.lock
generated
41
flake.lock
generated
@@ -1,41 +0,0 @@
|
||||
{
|
||||
"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
14
flake.nix
@@ -1,14 +0,0 @@
|
||||
{
|
||||
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; };
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -166,6 +166,10 @@ def on_button(callback, args=(), buttons=(LEFT, MIDDLE, RIGHT, X, X2), types=(UP
|
||||
callback(*args)
|
||||
_listener.add_handler(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=()):
|
||||
""" Invokes `callback` with `args` when the left button is clicked. """
|
||||
|
||||
BIN
mouse/__init__.pyc
Normal file
BIN
mouse/__init__.pyc
Normal file
Binary file not shown.
BIN
mouse/__pycache__/__init__.cpython-38.pyc
Normal file
BIN
mouse/__pycache__/__init__.cpython-38.pyc
Normal file
Binary file not shown.
BIN
mouse/__pycache__/_generic.cpython-38.pyc
Normal file
BIN
mouse/__pycache__/_generic.cpython-38.pyc
Normal file
Binary file not shown.
BIN
mouse/__pycache__/_mouse_event.cpython-38.pyc
Normal file
BIN
mouse/__pycache__/_mouse_event.cpython-38.pyc
Normal file
Binary file not shown.
BIN
mouse/__pycache__/_nixcommon.cpython-38.pyc
Normal file
BIN
mouse/__pycache__/_nixcommon.cpython-38.pyc
Normal file
Binary file not shown.
BIN
mouse/__pycache__/_nixmouse.cpython-38.pyc
Normal file
BIN
mouse/__pycache__/_nixmouse.cpython-38.pyc
Normal file
Binary file not shown.
BIN
mouse/_generic.pyc
Normal file
BIN
mouse/_generic.pyc
Normal file
Binary file not shown.
BIN
mouse/_mouse_event.pyc
Normal file
BIN
mouse/_mouse_event.pyc
Normal file
Binary file not shown.
@@ -20,6 +20,8 @@ EV_REL = 0x02
|
||||
EV_ABS = 0x03
|
||||
EV_MSC = 0x04
|
||||
|
||||
INVALID_ARGUMENT_ERRNO = 22
|
||||
|
||||
def make_uinput():
|
||||
import fcntl, struct
|
||||
|
||||
@@ -29,8 +31,12 @@ def make_uinput():
|
||||
fcntl.ioctl(uinput, UI_SET_EVBIT, EV_KEY)
|
||||
|
||||
UI_SET_KEYBIT = 0x40045565
|
||||
for i in range(256):
|
||||
fcntl.ioctl(uinput, UI_SET_KEYBIT, i)
|
||||
try:
|
||||
for i in range(0x300):
|
||||
fcntl.ioctl(uinput, UI_SET_KEYBIT, i)
|
||||
except OSError as e:
|
||||
if e.errno != INVALID_ARGUMENT_ERRNO:
|
||||
raise e
|
||||
|
||||
BUS_USB = 0x03
|
||||
uinput_user_dev = "80sHHHHi64i64i64i64i"
|
||||
|
||||
BIN
mouse/_nixcommon.pyc
Normal file
BIN
mouse/_nixcommon.pyc
Normal file
Binary file not shown.
BIN
mouse/_nixmouse.pyc
Normal file
BIN
mouse/_nixmouse.pyc
Normal file
Binary file not shown.
15
proarbeit.py
15
proarbeit.py
@@ -3,22 +3,25 @@ from secrets import randbelow
|
||||
from time import sleep
|
||||
|
||||
|
||||
def erratic_movement(screen_width=800, screen_height=600):
|
||||
def erratic_movement(screen_width, screen_height):
|
||||
"""
|
||||
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(
|
||||
randbelow(screen_width),
|
||||
randbelow(screen_height),
|
||||
randbelow(screen_width), randbelow(screen_height),
|
||||
)
|
||||
|
||||
|
||||
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:
|
||||
erratic_movement()
|
||||
erratic_movement(screen_width, screen_height)
|
||||
sleep(randbelow(90))
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user