Support for mouse button in hotkey

Use case or problem

Today, a lot of mouse (and gaming mouse) have more than 3 button.
For the moment, Obsidian doesn’t support these extra key, so we lost the possibility to have command on mouse.

Proposed solution

Add the support and recognize mouse button when clicked.

Current workaround (optional)

  • Using X Mouse Button control mapped on Obsidian you can set hotkey from obsidian.
  • If your mouse have special software (they must have it if you have more than 5 button), create a special (if you can) mapping for some obsidian hotkey.

Problem with these method : the hotkey you create can be used for another hotkey and you don’t have “more” hotkey. You can’t too use it to create “button 3 + K” for example.

Adding the support for mouse button can help to create more hotkey.

7 Likes

Im missing that SO MUCH. Even on a 5 button mouse it would improve the possibilities A LOT

1 Like

I just tried to set this up. Glad there’s a post already. Sad it’s not had much movement.

I feel like being able to configure how our mouse works in obsidian should be such a simple thing. Every single video game lets you bind things to all the mouse buttons. It’s a little frustrating that I haven’t seen any official responses on any of the related feature requests. If there’s a technical reason to not add this feature, then let us know. If it’s ‘not worth the dev time’, let us know. On a platform where basically everything else is customizable, why limit this?

With the new update that introduced Tabs, I would also like to see this feature added.

I don’t mind Tabs, they will be useful in some situations, but in my case when I want to open two or more notes simultaneously most of the time I want to open them side-by-side. It’s much more useful for me than Tabs. Previously I was able to quickly do that using MMB (middle mouse button).

Now I need to use the newly introduced hotkey for “opening to the right” - it’s not a big issue, but using MMB was just a little bit quicker, convenient and just in general felt more natural to me. I would love an option of choosing the default action of MMB.

And why is “opening to the right” more useful to me? I often have multiple notes with various info etc. that I open side-by-side and use as reference when creating a new note that combines the information from the other notes.

This feature request is also kind of similar to this one which talks about default behaviour of mouse clicks in general.

2 Likes

Yeah I have the same workflow. I’ve seen a bunch of various posts with essentially the same request. I’m not a coding expert but it seems like it should be a pretty quick thing to implement, so if there’s an actual reason why they aren’t implementing it would be nice to know.

This really sounds like something that would be better to handle with a dedicated app. (Edit: I’m referring specifically to supporting arbitrary mouse buttons from gaming mice, for instance.)

For example, in MacOS, you have Karabiner Elements, Hammerspoon, Better Touch Tool. These tools (and more I’m sure) can handle mouse events for creating your own customization.

I don’t know, but it seems to be that supporting this in a cross-platform app would be harder than just letting power-users create their own setups with their own hardware and customization tools. I can’t imagine Obsidian taking on this kind of niche support. Maybe these things could be exposed in the plugin API.

But can you list some examples of productivity apps which do this? Games are their own self-contained design-world. Apps - and especially cross-platform apps - usually have to be more generic and respect the rules of OS conventions, as far as I can imagine as a non-designer.

1 Like

Hey! I appreciate the response! I guess I hadn’t really considered the cross platform aspect of it, so for sure that probably complicates things. And for supporting the ‘extra’ mouse buttons I can see how that’s a much larger can of worms and (thanks to your reply) can see why that would be harder and perhaps less needed for non-power users.

But, in the previous version, middle click opened a note in a new pane and now it opens a note in a new tab. That seems to indicate that Obsidian has some code somewhere telling it how to respond to the middle click, presumably across platforms. If middle click already has an Obsidian specific action that has changed across versions, it seems like that shouldn’t be an issue to open up in a menu and let users pick from the built in Obsidian commands.

And again, I appreciate your insight on this topic. We don’t know what we don’t know, and at the very least if there’s a reason for these decisions, like the possible one you mentioned, it makes it easier to accept than ‘that’s just how it is’.

1 Like

I can’t bind hotkeys to additional mouse buttons.

(Additional being Mouse 4, 5 etc., button codes after left, right and middle click).

Navigate back and Navigate forward are apparently already bound to Mouse 4/5 (which seems to have been an issue), the same way its done in browsers and IDEs I know, but this is not noted in the hotkey settings and trying to bind anything to these keys just navigates notes in the background.

1 Like

You could try the following:

Current (potential) workaround:

I do not know how these buttons are supposed to be named in config file.
So I would do the following:
In AutoHotkey:

#IfWinActive ahk_exe Obsidian.exe
XButton1::F13
XButton2::F14
#IfWinActive

Then you can assign F13 and F14 to Obsidian using the workaround described in Unable to set a hotkey to F1 - #3 by malecjan (post #3).

Note: I do not have multibutton mouse to test with so I actually remapped another key to F13 and it worked. Let me now if it works also with real mouse buttons.

Related feature requests:

Use case or problem

I have muscle-memory for certain modifier key + mouse click combinations. It would be good to be able to customise these so that Obsidian matches what I’m used to. For example, from pre 1.0 Obsidian I’m used to ctrl + click opening a new pane. From IntelliJ Idea I’m used to alt + click bringing up a tool tip with documentation (similar to Ctrl + hover in Obsidian)

Proposed solution

Allow mouse events + modifier key shortcuts to be specified in the hotkeys settings page, in the same way that keyboard only key combinations can be specified there. Include the current behaviour as the default shortcuts.

Related feature requests (optional)

Disable Tabs Altogether This feature would allow users to revert the tab-based mouse events to the previous behaviour.

IDEs/Code editors tend to allow you to customise mouse click actions. E.g Configure keyboard shortcuts | IntelliJ IDEA. I only have a three button mouse to test with, but it collects the setting by the user performing the desired mouse + modifier key press inside a dialog box, and can detect left/right/middle that I have. Up to five mouse buttons are supported cross-platform in browser mouse events MouseEvent.button - Web APIs | MDN

There is must exist some functionality in Obsidian mapping mouse events to actions. This feature would make that mapping customisable + expandable through the existing hotkeys interface. It seems feasible in general that looking up a mouse event handler could work in the same way the existing keypress event handler does for hotkeys to work. As long as the default settings match the OS conventions, if a user deliberately changes the behaviour to break convention then that is their choice.

1 Like