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

multiple mouse_modifiers #601

Open
JohnJacobT opened this issue Jul 1, 2020 · 12 comments
Open

multiple mouse_modifiers #601

JohnJacobT opened this issue Jul 1, 2020 · 12 comments
Labels
suggestion Request for new feature or some form of enhancement

Comments

@JohnJacobT
Copy link

JohnJacobT commented Jul 1, 2020

Hi,

I find the mouse_actions using mouse_modifier in yabai is very useful. However utilizing both the actions together is not very convenient when using only the trackpad. I am forced to limit usage only to one action.

Context:
I am using tapping fingers on trackpad for click and sliding fingers for drags. i.e using one finger tap for left click and two finger tap for right click. Doubletap & slide to click and drag and two finger slides for scrolling. Right click drag is not possible by doubletapping with two fingers and draging. It can only be done by pressing down with two fingers on the trackpad and sliding (which is not very friendly as you have to keep up the pressure while sliding the fingers on the trackpad. In most cases you lose the right click drag in between due to lose in pressure or accidently lifting one finger).

Question / Request
It would have been more convenient to use two different modifiers to do different actions (move and resize) using the same mouse button. For example: Hold down fn key and left click drag for moving windows and hold down ctrl key and left click drag to resize windows. Is this currently possible in yabai?

In case it is not, can something like this be implemented?
mouse_modifier1 fn
mouse_modifier2 ctrl
mouse_mod1_action1 move
mouse_mod1_action2 off
mouse_mod2_action1 resize
mouse_mod2_action2 off

Regards,
John

@koekeishiya
Copy link
Owner

This is not currently possible. I think a better option would be to essentially remove the need for mouse_action1/2 in the yabai config and expose them through the command line IPC instead such that they can be bound to whatever through an external application, just as any other action.

@sourtin
Copy link

sourtin commented Jul 1, 2020

I made a proof of concept patch here. Usage is like

yabai -m config mouse_actions 0 fn left move stack
yabai -m config mouse_actions 1 shift ctrl left move swap # uses shift+ctrl as modifier
yabai -m config mouse_actions 2 fn right resize # no drop action

I removed the original mouse_action1, mouse_action2, mouse_drop_action, modifier settings as this would generalise them all.

@koekeishiya If this approach is acceptable, what would I need to do before making a pull request? Also this is a different branch from my earlier pull request with the legacy move action so hopefully it's in keeping with your project direction!

@koekeishiya
Copy link
Owner

koekeishiya commented Jul 1, 2020

I'd rather move them into commands as briefly mentioned in my comment above. I imagine something like yabai -m window --drag move.begin|move.end|resize.begin|resize.end. These can then be bound to whatever key, mouse, gesture using some external hotkey software.

@sourtin
Copy link

sourtin commented Jul 14, 2020

Would skhd support mouse buttons when this lands?

@koekeishiya
Copy link
Owner

Probably, yes, as well as key-release triggers.

@koekeishiya koekeishiya added the suggestion Request for new feature or some form of enhancement label Jul 22, 2020
@robertp
Copy link

robertp commented Sep 21, 2020

I'd like to add one more suggestion - maybe you already plan to include this, maybe not. I use FlexiGlass for move/resize on Mac right now, but I'd rather use yabai :)

Would it be possible to model this behavior? Two modifiers (e.g., ctrl+cmd), and then one finger moves and two fingers resize.

Thanks for chunkwm and yabai, I love them when I'm not in linux!

@kerryj89
Copy link

kerryj89 commented Nov 7, 2020

It would also be nice to change mouse_drop_action based on what modifier key is being held when mouse is released. I was wanting to use the stack mode while holding the shift key and releasing a window on top of another to stack them but it seems like it's either swap or stack for mouse_drop_action.

@DivineDominion
Copy link

@koekeishiya Since you mentioned that you won't have much time for yabai in the forseeable future, I'd like to suggest to merge the backwards-compatible enhancements to the current behavior by @sourtin until the new command set is implemented. That way the recurring requests can be addressed and it doesn't hamper forward progress at all. What do you think?

@sourtin
Copy link

sourtin commented Jan 24, 2021

Unfortunately I've been unable to maintain merge-ability of my fork (there was a big upstream refactor a month or so ago and I didn't have the time to re-integrate the changes). I'm happy of course for someone else to complete the merge if this is wanted (or it may be easier to manually rebase the changes) :)

@qtaped
Copy link

qtaped commented Jan 14, 2024

Just here to say I'd like to have the possibility to use multiple modifiers with mouse too. As I often use modifiers with my mouse in different software, using terminal without title bar and do not have a fn key working on macos with my external keyboard (which is common, fn key is often at a hardware level, it's not passed to OS like other keys).

Thanks for your work btw

@koekeishiya
Copy link
Owner

Copied from #596 (comment)


I've been thinking about how to approach this, and these are my thoughts so far:

The current system may lack in flexibility in terms of customization, but it is well designed and makes sense in my opinion. The features that are there complement each other well. Let's break down why:

  1. The mouse_modifier defines a key which is required to do mouse interactions.
  2. This mouse_modifier amplifies the focus-follows-mouse functionality, acting as a way to temporarily disable it while reaching for the menubar or just otherwise skipping activation while the user moves the mouse for whatever reason.
  3. When mouse_modifier is combined with left or right mouse-buttons, it triggers the action associated through mouse_action1/2.
  4. mouse_drop_action is clearly separate from the "button" actions.

The syntax for achieving the above is simple and clean, in my opinion.
Now I do agree that the functionality supported by this design may be lacking.

I am unable so far to come up with a design that I think is good, that still allows for the interoperability with mouse_modifier and focus-follows-mouse, while still allowing the full flexibility for having multiple modifiers, re-using the same mouse-button with different modifiers, and having the drop_action change based on modifier etc.

I could obviously implement this functionality in code without any problem, but I do care about the design; what the interface looks like, and how each part of the funcitonality complements (or contradicts) other parts.

@qtaped
Copy link

qtaped commented May 30, 2024

for those who wanted to use 2 modifiers to move a window like I was looking for, I've just found an (old) hidden option in macos.
defaults write -g NSWindowShouldDragOnGesture YES
then restart your session.
You can now move a window from anywhere with ctrl+cmd+mouse.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
suggestion Request for new feature or some form of enhancement
Projects
None yet
Development

No branches or pull requests

7 participants