mirror of
https://github.com/erjiang/huion-keys.git
synced 2026-03-23 21:54:53 +03:00
Hard-coded press/release for Ctrl key
Experimental changes to hopefully support holding down a tablet button to hold down a key.
This commit is contained in:
parent
cba98d852c
commit
44511474e2
@ -16,6 +16,7 @@ def main():
|
|||||||
create_default_config(CONFIG_FILE_PATH)
|
create_default_config(CONFIG_FILE_PATH)
|
||||||
print("Created an example config file at " + CONFIG_FILE_PATH)
|
print("Created an example config file at " + CONFIG_FILE_PATH)
|
||||||
return 1
|
return 1
|
||||||
|
prev_button = None
|
||||||
while True:
|
while True:
|
||||||
hidraw_path = get_tablet_hidraw('256c', '006e')
|
hidraw_path = get_tablet_hidraw('256c', '006e')
|
||||||
if hidraw_path is None:
|
if hidraw_path is None:
|
||||||
@ -38,10 +39,16 @@ def main():
|
|||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
break
|
break
|
||||||
print("Got button %s" % (btn,))
|
print("Got button %s" % (btn,))
|
||||||
if btn in BUTTON_BINDINGS:
|
if btn == 3:
|
||||||
|
print("Pressing ctrl")
|
||||||
|
lib.xdo_send_keysequence_window_down(xdo, lib.CURRENTWINDOW, b'ctrl', 12000)
|
||||||
|
get_button_release(hidraw)
|
||||||
|
print("Releasing ctrl")
|
||||||
|
lib.xdo_send_keysequence_window_up(xdo, lib.CURRENTWINDOW, b'ctrl', 12000)
|
||||||
|
elif btn in BUTTON_BINDINGS:
|
||||||
print("Sending %s" % (BUTTON_BINDINGS[btn],))
|
print("Sending %s" % (BUTTON_BINDINGS[btn],))
|
||||||
lib.xdo_send_keysequence_window(
|
lib.xdo_send_keysequence_window(
|
||||||
xdo, lib.CURRENTWINDOW, BUTTON_BINDINGS[btn], 10)
|
xdo, lib.CURRENTWINDOW, BUTTON_BINDINGS[btn], 1000)
|
||||||
|
|
||||||
|
|
||||||
def get_tablet_hidraw(vendor_id, product_id):
|
def get_tablet_hidraw(vendor_id, product_id):
|
||||||
@ -147,6 +154,12 @@ def get_button_press(hidraw):
|
|||||||
SCROLL_STATE = scroll_pos
|
SCROLL_STATE = scroll_pos
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
def get_button_release(hidraw):
|
||||||
|
while True:
|
||||||
|
sequence = hidraw.read(12)
|
||||||
|
if sequence[1] == 0xe0 and sequence[4] == 0 and sequence[5] == 0:
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user