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

Rules help #2639

Open
scarlion1 opened this issue Oct 17, 2024 · 1 comment
Open

Rules help #2639

scarlion1 opened this issue Oct 17, 2024 · 1 comment

Comments

@scarlion1
Copy link

Hi sorry if this is not the place for help let me know if there is a forum or something, but...

I'd like to manipulate the middle button on my M705.  I've had some minor success with the rules but not exactly what I wanted, but then I realized there are some things the middle button did that I took for granted, like opening links in new tabs and closing tabs.

What I would like is for the middle button, when clicked, presses the Super_L key, so I can manipulate a window with left click (move) or right-click (resize).  Then, when middle button clicked again, releases Super_L.  I guess that's pretty complicated because I realized there needs to be conditions to check if Super_L is already pressed or not.  Currently, I was able to make rules so that middle button pressed presses Super_L and when released releases Super_L.  In this way I can move a window around by pressing middle button and left button and then dragging the window.  This is awkward with pressing both middle and left mouse buttons, since I usually use my index finger for both and they are so close, but it works (these are actually sub-rules but the YAML just says "Rule"):

---
- Rule:
  - Key: [Middle Button, pressed]
  - KeyPress:
    - Super_L
    - depress
- Rule:
  - Key: [Middle Button, released]
  - KeyPress:
    - Super_L
    - release
...

Secondly, since I still want the original middle click function, I thought I could make a rule that, for example, when I hold Shift_L and use the middle button, it does the normal middle function.  I tried the following rule (again with sub-rules) but it has no effect:

---
- Rule:
  - And:
    - KeyIsDown: Left Shift
    - Key: [Middle Button, pressed]
  - MouseClick: [middle, depress]
- Rule:
  - And:
    - KeyIsDown: Left Shift
    - Key: [Middle Button, released]
  - MouseClick: [middle, release]
...

So how's it possible to achieve what I'd like?
Thanks

@pfps
Copy link
Collaborator

pfps commented Oct 17, 2024

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

Key is down

KeyIsDown conditions are true if the diverted key or button that is their string argument is currently down. Note that this only works for diverted keys or buttons, including diverted Gn, Mn, and MR keys.

So unless you can divert Left Shift, this rule will not work.

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

Key modifiers

Modifiers conditions take either a string or a sequence of strings, which can only be Shift, Control, Alt, and Super. Modifiers conditions are true if their argument is the current keyboard modifiers.

But this only works on X11 due to the stringent security characteristics of Wayland.

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

No branches or pull requests

2 participants