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

MiddleClick doesn't work because it starts before Magic Mouse #28

Closed
jordiramu opened this issue Nov 30, 2021 · 12 comments
Closed

MiddleClick doesn't work because it starts before Magic Mouse #28

jordiramu opened this issue Nov 30, 2021 · 12 comments

Comments

@jordiramu
Copy link

jordiramu commented Nov 30, 2021

Hello,

First I'd like to thank you for the great app!

I use MiddleClick on a M1 iMac (24", 2021) with MacOS updated to Monterey.

Whenever I restart and then login, MiddleClick seems to start too fast; it is set as a startup item.
It looks like MiddleClick starts just before the default (included in the package) Magic Mouse is initialized and as a result it doesn't work.
So.. the middle click functionality implemented by MiddleClick.app is not present unless I quit MiddleClick application and start it again, manually; but this makes it unusable as a start item.

As a workaround I used Automator to create a new app which runs a very simple Bash command (actually two):
sleep 5 && open -a MiddleClick
and had this Automator generated app set as a startup item instead.

Is there any way to make MiddleClick activate/load/set its functionality after the mouse is initialized?

Thank you

@jordiramu
Copy link
Author

Sorry, I forgot the following:
george@iMac-de-George ~ % brew info middleclick
middleclick: 2.5
https://github.com/artginzburg/MiddleClick-BigSur
/opt/homebrew/Caskroom/middleclick/2.5 (125B)
From: https://github.com/Homebrew/homebrew-cask/blob/HEAD/Casks/middleclick.rb
==> Name
MiddleClick
==> Description
Utility to extend trackpad functionality
==> Artifacts
MiddleClick.app (App)
==> Analytics
install: 476 (30 days), 771 (90 days), 1,760 (365 days)
george@iMac-de-George ~ %

@stealthpro
Copy link

I have the same problem after wake up.

@jordiramu
Copy link
Author

jordiramu commented Dec 7, 2021

After conecting an Apple Trackpad I also needed to restart MiddleClick to make it work with the trackpad.

artginzburg added a commit that referenced this issue Jan 30, 2022
@grishka
Copy link

grishka commented Apr 5, 2022

When the trackpad disconnects by itself (because of course it does, it's wireless for some reason and wireless is a synonym for unreliable) and then reconnects, I also have to restart MiddleClick to make it work again, which is annoying.

@artginzburg
Copy link
Owner

You should try out the new pre-release. I haven't tested it with wireless devices, but it's a much more stable build. Please continue here if the issue persists.

@grishka
Copy link

grishka commented Oct 6, 2022

This issue does persist in the pre-release :(
If you need any help debugging, please ask.

@karlhorky
Copy link

karlhorky commented Oct 9, 2022

I'm having a similar problem with versions 2.5, 2.5.0.1 and the prerelease 2.6 (can't test any other versions since I'm on an M1 machine - running macOS 12.6 Monterey):

When disconnecting / reconnecting a Magic Mouse (eg. just turn the Magic Mouse off and on again - no sleep/wake cycle), MiddleClick no longer registers middle clicks and the app needs to be restarted.

If I understand correctly, the relevant code is this, which appears to call the multitouchDeviceAddedCallback function - for some reason this is not firing:

https://github.com/artginzburg/MiddleClick-BigSur/blob/a9fd092c5dc93944062a533167c12c42daad5986/MiddleClick/Controller.m#L92-L95

I can see this because on the command line, the Restarting app functionality... does not show up when I turn the Magic Mouse off and on:

$ /Applications/MiddleClick.app/Contents/MacOS/MiddleClick
2022-10-09 14:37:27.258 MiddleClick[63555:8582952] Starting all listeners...
*** Recognized (0xb0) family*** (60 cols X  2 rows)
*** Recognized (0x6b) family*** (26 cols X 18 rows)
*** Recognized (0x70) family*** (10 cols X 15 rows)
...nothing else shows up here...

If it would be better that I open a new issue for the problem of reconnecting, happy to do so!

@karlhorky
Copy link

karlhorky commented Oct 9, 2022

Workaround

To quickly restart MiddleClick, use macOS Shortcuts: create a shortcut that quits MiddleClick and opens it again:

Screen Shot 2022-10-09 at 15 27 56

Then right click on the shortcut and select "Add to Dock", for easy access:

Screen Shot 2022-10-09 at 15 32 38

@karlhorky
Copy link

@artginzburg I guess you haven't been able to reproduce the problem I described above?

Do you have an idea why it could be happening?

@karlhorky
Copy link

karlhorky commented Dec 5, 2022

Ok, I think I found the issue. Seems that the commit 5aca15 broke this (the removal of the call to CFRelease(item) for the M1 build).

I've opened a PR for this, to instead call IOObjectRelease(item): #54

Screenshot 2022-12-05 at 16 27 03

kohnish pushed a commit to kohnish/MiddleClick that referenced this issue Dec 28, 2022
@jordiramu
Copy link
Author

Thank you, @karlhorky !
I have tested your patch and it works for me.
Hopefully it will be included with the next release...

@karlhorky
Copy link

karlhorky commented Jan 4, 2023

Great, looks like my patch is included in 2.6.1 (already available in Homebrew), thanks @artginzburg for the release and Homebrew bump!

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

5 participants