Mercurial > code > home > repos > wheel
changeset 0:63a872056503 default tip
start
author | drewp@bigasterisk.com |
---|---|
date | Sat, 25 Feb 2023 15:29:18 -0800 |
parents | |
children | |
files | .hgignore pdm.lock pyproject.toml usb_wheel_to_scroll.py |
diffstat | 4 files changed, 129 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.hgignore Sat Feb 25 15:29:18 2023 -0800 @@ -0,0 +1,1 @@ +__pypackages__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pdm.lock Sat Feb 25 15:29:18 2023 -0800 @@ -0,0 +1,81 @@ +[[package]] +name = "evdev" +version = "1.6.1" +summary = "Bindings to the Linux input handling subsystem" + +[[package]] +name = "pynput" +version = "1.7.6" +summary = "Monitor and control user input devices" +dependencies = [ + "evdev>=1.3; \"linux\" in sys_platform", + "pyobjc-framework-ApplicationServices>=8.0; sys_platform == \"darwin\"", + "pyobjc-framework-Quartz>=8.0; sys_platform == \"darwin\"", + "python-xlib>=0.17; \"linux\" in sys_platform", + "six", +] + +[[package]] +name = "pyobjc-framework-applicationservices" +version = "9.0.1" +requires_python = ">=3.7" +summary = "" + +[[package]] +name = "pyobjc-framework-quartz" +version = "9.0.1" +requires_python = ">=3.7" +summary = "" + +[[package]] +name = "python-xlib" +version = "0.33" +summary = "Python X Library" +dependencies = [ + "six>=1.10.0", +] + +[[package]] +name = "six" +version = "1.16.0" +requires_python = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" +summary = "Python 2 and 3 compatibility utilities" + +[metadata] +lock_version = "4.0" +content_hash = "sha256:bd608852ba49caeeeeb17b1bd507c337fa0ec4200253c0d97c9bba24739c6ad3" + +[metadata.files] +"evdev 1.6.1" = [ + {url = "https://files.pythonhosted.org/packages/05/50/629b011a7f61cb2fca754ea8631575784bf8605a1ec4d6970a010bc54e2b/evdev-1.6.1.tar.gz", hash = "sha256:299db8628cc73b237fc1cc57d3c2948faa0756e2a58b6194b5bf81dc2081f1e3"}, +] +"pynput 1.7.6" = [ + {url = "https://files.pythonhosted.org/packages/02/27/4de87850ff87c8dcecaaf8d27f28cec89ef17eeb6938f250449cb2635e06/pynput-1.7.6-py2.py3-none-any.whl", hash = "sha256:19861b2a0c430d646489852f89500e0c9332e295f2c020e7c2775e7046aa2e2f"}, + {url = "https://files.pythonhosted.org/packages/d7/74/a231bca942b1cd9c4bb707788be325a61d26c7998bd25e88dc510d4b55c7/pynput-1.7.6.tar.gz", hash = "sha256:3a5726546da54116b687785d38b1db56997ce1d28e53e8d22fc656d8b92e533c"}, +] +"pyobjc-framework-applicationservices 9.0.1" = [ + {url = "https://files.pythonhosted.org/packages/04/8d/7413bb658fae85ac99fc11ddc351678ab477edf4cdf1e13007e28e12c065/pyobjc-framework-ApplicationServices-9.0.1.tar.gz", hash = "sha256:e3a350781fdcab6c1da4343dfc54ae3c0523e59e61147432f61dcfb365752fde"}, + {url = "https://files.pythonhosted.org/packages/3e/07/44eb87482ac42dc884fe712b106dd48f6907048d9da1b7a90f461c027f86/pyobjc_framework_ApplicationServices-9.0.1-cp38-cp38-macosx_11_0_universal2.whl", hash = "sha256:724da9dfae6ab0505b90340231a685720288caecfcca335b08903102e97a93dc"}, + {url = "https://files.pythonhosted.org/packages/4a/7b/076ff8225d93e528214a2f2c2a25c7e4d814d122138ec0ef391dc48d17f9/pyobjc_framework_ApplicationServices-9.0.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:5af5d12871499c429dd68c5ec4be56c631ec8439aa953c266eed9afdffb5ec2b"}, + {url = "https://files.pythonhosted.org/packages/65/6e/d91e1e5e042e6434a6ead262cd4380d30f099b71a6b96f31b1b0600d3280/pyobjc_framework_ApplicationServices-9.0.1-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:8e1dbfc8f482c433ce642724d4bed0c527c7f2f2f8b9ba1ac3f778a68cf1538d"}, + {url = "https://files.pythonhosted.org/packages/6b/b2/ae805ff6d9a36b51764eb1bdc75b7a849fb5dc89182dff527fed5be81ca5/pyobjc_framework_ApplicationServices-9.0.1-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:c62693e01ba272fbadcd66677881311d2d63fda84b9662533fcc883c54be76d7"}, + {url = "https://files.pythonhosted.org/packages/b4/1d/5efa4e17f6f867b37ed2943918ae582ec23cca750aa534f5744ccef359f3/pyobjc_framework_ApplicationServices-9.0.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:c4214febf3cc2e417ae15d45b6502e5c20f1097cd042b025760d019fe69b07b6"}, + {url = "https://files.pythonhosted.org/packages/bb/57/8f853f636c27489dc3fc743e8c9191772fbc082fd441822438e729c83cac/pyobjc_framework_ApplicationServices-9.0.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:6829df4dc4cf012bdc221d4e0296d6699b33ca89741569df153989a0c18aa40e"}, +] +"pyobjc-framework-quartz 9.0.1" = [ + {url = "https://files.pythonhosted.org/packages/1e/d9/c07cbc6291d2a60946cb3bd1e1aaacba7a4446d0b3d9efe16cbc789bfe8b/pyobjc_framework_Quartz-9.0.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:13a546a2af7c1c5c2bbf88cce6891896a449e92466415ad14d9a5ee93fba6ef3"}, + {url = "https://files.pythonhosted.org/packages/4d/ac/01fa756604687c87033928061261aa6b03fe91fe686f57235d3753e34a81/pyobjc_framework_Quartz-9.0.1-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:93ee6e339ab6928115a92188a0162ec80bf62cd0bd908d54695c1b9f9381ea45"}, + {url = "https://files.pythonhosted.org/packages/5f/e4/6c6608de4c03b900357d7a33a6bca18e57d660aea1318effaca6615f87a5/pyobjc_framework_Quartz-9.0.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:0c9b553be6ef672e0886b0d2c77d1841b1a942c7b1dc9a67f6e1376dc5493513"}, + {url = "https://files.pythonhosted.org/packages/84/10/58292ef1a58f1269fbd2b6e842b8835e2ba34c05c399b62d322f1aed4a9e/pyobjc_framework_Quartz-9.0.1-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:0bedb6e1b7789d5b24fd5c790f0d53e4c62930313c97a891068bfa0e966ccc0b"}, + {url = "https://files.pythonhosted.org/packages/8f/c9/b8a380738e7b35ed08adf69203526b4abcc7e143460745229c5480926735/pyobjc_framework_Quartz-9.0.1-cp38-cp38-macosx_11_0_universal2.whl", hash = "sha256:7b39f85d0b747b0a13a11d0d538001b757c82d05e656eab437167b5b118307df"}, + {url = "https://files.pythonhosted.org/packages/94/ff/5a18a2baa445cd22fa062f87c7a0f110b45febd6095552d01ee57a021f13/pyobjc_framework_Quartz-9.0.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:066ffbe26de1456f79a6d9467dabd6a3b9ef228318a0ba3f3fedbdbc0e2d3444"}, + {url = "https://files.pythonhosted.org/packages/ca/6f/64331d1ed37358d71d39423710724c34e943e6da4acaf9f0e73629b34a5d/pyobjc-framework-Quartz-9.0.1.tar.gz", hash = "sha256:7e2e37fc5c01bbdc37c1355d886e6184d1977043d5a05d1d956573fa8503dac3"}, +] +"python-xlib 0.33" = [ + {url = "https://files.pythonhosted.org/packages/86/f5/8c0653e5bb54e0cbdfe27bf32d41f27bc4e12faa8742778c17f2a71be2c0/python-xlib-0.33.tar.gz", hash = "sha256:55af7906a2c75ce6cb280a584776080602444f75815a7aff4d287bb2d7018b32"}, + {url = "https://files.pythonhosted.org/packages/fc/b8/ff33610932e0ee81ae7f1269c890f697d56ff74b9f5b2ee5d9b7fa2c5355/python_xlib-0.33-py2.py3-none-any.whl", hash = "sha256:c3534038d42e0df2f1392a1b30a15a4ff5fdc2b86cfa94f072bf11b10a164398"}, +] +"six 1.16.0" = [ + {url = "https://files.pythonhosted.org/packages/71/39/171f1c67cd00715f190ba0b100d606d440a28c93c7714febeca8b79af85e/six-1.16.0.tar.gz", hash = "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926"}, + {url = "https://files.pythonhosted.org/packages/d9/5a/e7c31adbe875f2abbb91bd84cf2dc52d792b5a01506781dbcf25c91daf11/six-1.16.0-py2.py3-none-any.whl", hash = "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"}, +]
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pyproject.toml Sat Feb 25 15:29:18 2023 -0800 @@ -0,0 +1,19 @@ +[project] +name = "" +version = "" +description = "" +authors = [ + {name = "Drew Perttula", email = "drewp@bigasterisk.com"}, +] +dependencies = [ + "evdev>=1.6.1", + "pynput>=1.7.6", +] +requires-python = ">=3.10" +license = {text = "MIT"} + +[tool.pdm] + +[build-system] +requires = ["pdm-pep517>=1.0.0"] +build-backend = "pdm.pep517.api"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usb_wheel_to_scroll.py Sat Feb 25 15:29:18 2023 -0800 @@ -0,0 +1,28 @@ +from pynput.mouse import Button, Controller +import evdev + +# to stop knob from setting volume: + +# xinput list +# ↳ HID 8808:660c Keyboard id=17 [slave keyboard (3)] + +# xinput disable 17 + +devices = [evdev.InputDevice(path) for path in evdev.list_devices()] +for device in devices: + if device.name == 'HID 8808:660c Keyboard': + break +else: + raise ValueError('not found') + +device = evdev.InputDevice(device.path) +mouse = Controller() + +scroll_per_step = 2 + +for event in device.read_loop(): + if event.value == 1: + if event.code == 114: + mouse.scroll(0, 1 * scroll_per_step) + elif event.code == 115: + mouse.scroll(0, -1 * scroll_per_step)