0
$\begingroup$

Running Linux and using a small Python script globally in Xorg to bind left mouse down + up to the caps lock key. I use this because of RSI and the buttons on my trackball are crap.

It just works with everything. But in Blender it only works in some situations.

For instance selecting objects in Object Mode doesn't work, but it of course works using the real left mouse button. Dragging to select works though, although only some areas of the viewport will let caps lock activate the drag region.

I'm using pyautogui.mouseDown() and pyautogui.mouseUp() when caps lock is pressed and released. And using pynput.keyboard.Listener() to listen for events.

Anyone got any ideas to make it work? Script below.

#!/usr/bin/env python3

from pynput import keyboard as keyb


CAPS = keyb.KeyCode(16777215)


def on_press(key):
    if key == CAPS:
        return pyautogui.mouseDown()

    pass


def on_release(key):
    if key == CAPS:
        return pyautogui.mouseUp()

    pass


with keyb.Listener(on_press=on_press, on_release=on_release, suppress=False) as listener:
    listener.join()
```
$\endgroup$
0
0
$\begingroup$

Ah, tried setting it with xmodmap and it works!

xkbset m
xmodmap -e 'keycode 66 = Pointer_Button1 Pointer_Button1'
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.