Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send BTN_LEFT with sendkey for mouse buttons #36

Merged
merged 2 commits into from
Sep 26, 2024

Conversation

iberianpig
Copy link
Owner

@iberianpig iberianpig commented Sep 24, 2024

Overview

This pull request adds mouse button operations to the sendkey command. With this change, operating mouse buttons will be similar to operating keyboard keys.

Details of Changes

  • Mouse button operations (e.g., BTN_LEFT, BTN_RIGHT, BTN_MIDDLE) have been added to fusuma-sendkey.
  • The functionalities in the Keyboard class have been extended to handle mouse button operations.
  • Test cases for keyboard and mouse button operations have been added.

Notes

  • Mouse button operations are available only when mouse buttons are implemented on the keyboard.
  • Available mouse buttons can be checked with the command fusuma-sendkey -l | grep BTN_.
  • A virtual keyboard using uinput (e.g., fusuma-plugin-remap) will likely be needed.

Usage Example

It is important to note that you need to specify the mouse button with the prefix BTN_ as shown below.

---
context:
  thumbsense: true

remap:
  F: BTN_LEFT # <- remaps to left click using fusuma-plugin-remap
              # fusuma-plugin-remap already supports mouse button operations.

  E: 
    sendkey: LEFTCTRL+BTN_LEFT # <- sends left click with left control key using fusuma-plugin-sendkey
                               # This PR adds mouse button operations to the `sendkey` command.

In command line, following command can be executed to test the feature.

$ fusuma-sendkey BTN_RIGHT
$ fusuma-sendkey -l | grep -i BTN_
BTN_0
BTN_1
BTN_2
BTN_3
BTN_4
BTN_5
BTN_6
BTN_7
BTN_8
BTN_9
BTN_LEFT
BTN_RIGHT
BTN_MIDDLE
BTN_SIDE
BTN_EXTRA
BTN_FORWARD
BTN_BACK
BTN_TASK

@iberianpig iberianpig added the enhancement New feature or request label Sep 24, 2024
- Get Capabilities from the device and convert it to a list of keys to display
  - Get Capabilities with EVIOCGBIT ioctl
  - Filter out the keys from the capabilities
- Consider BTN_ and KEY_ prefixes for display
  - Display BTN_ as it is
  - Remove the prefix for KEY_ and display it
@iberianpig iberianpig merged commit 46912a5 into main Sep 26, 2024
4 checks passed
@iberianpig iberianpig self-assigned this Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant