Skip to content

Should work for trackpads connected after starting the app #124

@filippo-orru

Description

@filippo-orru

Describe the bug
Currently, when MiddleDrag starts, it applies the three-finger gesture for all connected devices. When connecting a new trackpad (Magic Trackpad) while MiddleDrag is already running, thre-finger taps don't work on the new device.

To Reproduce
Steps to reproduce the behavior:

  1. Connect Magic Trackpad
  2. Start Middle Drag
    -> the three finger tap works as expected
  3. Disconnect and reconnect Magic Trackpad
    -> the three finger tap does not work

Expected behavior
The app should also work when disconnecting or reconnecting devices.

Screenshots
N/A

Desktop (please complete the following information):

  • OS: MacOS 26.3.1
  • Middle Drag version v1.4.3

Additional context
I looked into fixing this myself, see my commit here: filippo-orru@0f15313

I modified DeviceManager.swift to regularly check for new devices. This does work but it logs "Registered 3 newly connected multitouch device(s)" every 2 seconds. Pointers returned by MTDeviceCreateList() change with every invocation, so I wasn't able to check if a callback was already registered for this device's pointer. Maybe you're able to figure it out, I don't know enough about MacOS private framework internals 🙂

While researching this, I also stumbled upon https://github.com/artginzburg/MiddleClick. It's written in Obj-c and only handles middle click (not drag) but that's all I need. It does support reconnecting devices, so maybe you can check it out and see how they query multi touch devices.
Another related repo (written in Swift, might be easier to digest): https://github.com/ris58h/Touch-Tab

Metadata

Metadata

Labels

bugSomething isn't working

Projects

Status

In review

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions