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

How to trigger individual button action while maintaining combination of others? #2470

Open
ctrngk opened this issue May 8, 2024 · 5 comments

Comments

@ctrngk
Copy link

ctrngk commented May 8, 2024

I used to hold the back button together with scrolling up/down to control page's zoom in/out, which works perfectly.
Now I would like to click the back button individually to trigger back to normal size, i.e. control + 0, but I don't know how.

Screenshot from 2024-05-08 12-59-48

---
- KeyIsDown: Back Button
- And:
  - Test: [hires_wheel_up, 0x1]
- KeyPress:
  - [Control_L, Shift_L, equal]
  - click
...
---
- KeyIsDown: Back Button
- And:
  - Test: [hires_wheel_down, 0x1]
- KeyPress:
  - [Control_L, minus]
  - click
...
--- []
...
---
- Test: [hires_wheel_down, 0x5]
- MouseScroll: [0x0, 0x0]
- MouseScroll: [0x0, 0x1]
...
---
- Test: [hires_wheel_up, 0x5]
- MouseScroll: [0x0, 0x0]
- MouseScroll: [0x0, -0x1]
...
--- []
...
@pfps
Copy link
Collaborator

pfps commented May 8, 2024

From https://pwr-solaar.github.io/Solaar/rules:

Key conditions are true if the Logitech name of the current diverted key or button being pressed is their string argument. Alternatively, if the argument is a list [name, action] where action is either 'pressed' or 'released', the key down or key up events of name argument are matched, respectively. Logitech key and button names are shown in the Key/Button Diversion setting. These names are also shown in the output of solaar show in the ‘reprogrammable keys’ section. Only keys or buttons that have ‘divertable’ in their report can be diverted. Some keyboards have Gn, Mn, or MR keys, which are diverted using the ‘Divert G Keys’ setting.

But maybe you want the rule to trigger only if the button is held down and nothing happens while it is down. That's beyond the capabilities of Solaar rules unless you write some external program that keeps track of what buttons were pressed.

@ctrngk
Copy link
Author

ctrngk commented May 8, 2024

Ok. let me try to be more specific. Here is what I did
Screenshot from 2024-05-08 17-56-56

When the back button is pressed and released, the XF86_AudioRaiseVolume function works as planned. Additionally, holding down the back button while scrolling up or down activates the zoom function. However, during this process, the XF86_AudioRaiseVolume function unexpectedly triggers as well. What measures can be implemented to avoid this?

@pfps
Copy link
Collaborator

pfps commented May 8, 2024

Solaar doesn't remember what it previously did. (There are some very small exceptions.) So the audio rule is unconditionally triggered when the back button is released, as expected.

You could write programs (or shell scripts) that are called. These programs could arrange to keep track of whether the wheel was turned while the back button was down and only do the volume change under the correct circumstances.

@El-Barto89
Copy link

Can I ask why I can't obtain your same result in zooming in and out? I've copied exactly what you wrote...no action at all.

@ctrngk
Copy link
Author

ctrngk commented Jun 2, 2024

Can I ask why I can't obtain your same result in zooming in and out? I've copied exactly what you wrote...no action at all.

I left out the specific settings because I wasn't sure if they applied directly to our current topic. But, if you're interested, here are the extra steps that might be helpful. (By the way, I'm still unsure why this solution requires using two mouse scrolls. I arrived at it through trial and error. Just a heads-up, I use 'natural scroll' or 'inverted scroll' settings. Feel free to adjust them back to the standard direction if you prefer )

Screenshot from 2024-06-02 17-11-21

Screenshot from 2024-06-02 17-01-52

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants