-
-
Save denalena/80b5d0f50840da383c971d2cf89d181e to your computer and use it in GitHub Desktop.
This makes it so that as long as that button is being held, moving the cursors scrolls instead.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
import re | |
import subprocess | |
RE_LOGITECH_ID = rb"Logitech MX Ergo[\s\-\w]+id=(\d+).*pointer" | |
def set_ergo_scroll() -> None: | |
"""Set button scrolling behavior for MX Ergo.""" | |
print("Setting ergo scroll...") | |
inputs = subprocess.run(["xinput", "list"], capture_output=True).stdout | |
ergo_ids = re.findall(RE_LOGITECH_ID, inputs) | |
for ergo_id in ergo_ids: | |
rc = subprocess.run( | |
[ | |
"xinput", | |
"set-prop", | |
ergo_id, | |
"libinput Scroll Method Enabled", | |
"0,", | |
"0,", | |
"1", | |
] | |
).rc | |
assert rc == 0 | |
rc = subprocess.run( | |
[ | |
"xinput", | |
"set-prop", | |
ergo_id, | |
"libinput Button Scrolling Button", | |
"8", | |
] | |
) | |
assert rc == 0 | |
print("Ergo scroll set.") | |
if __name__ == "__main__": | |
set_ergo_scroll() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment