johndbritton / teleport

Virtual KVM for macOS
GNU General Public License v2.0
797 stars 134 forks source link

Media keys from bluetooth keyboard on primary machine to secondary machine with touchpad-ribbon #117

Open erikkemperman opened 2 years ago

erikkemperman commented 2 years ago

First of all, I just wanted to say how happy I am having discovered this great little tool -- much appreciated, thanks!!

Bug report

What you were trying to do (and why)

I've got (a) 2021 M1 macbook pro, (b) 2016 macbook pro, and (c) 2012 macbook pro. Both (a) and (b) are on 12.2, (c) is on the latest supported version 10.15.7. Let's disregard (c) for the moment.

(a) is the primary machine, and is where bluetooth keyboard and mouse are paired with. The laptop's own keyboard as well as the BT one have physical keys for brightness, volume, media playback.

(b) is the secondary machine, and has one of those touchpad ribbon things for brightness and so on.

Regular typing and mousing work flawlessly.

What happened (include any debug output)

I would like to control the brightness, volume and and playback functions on (b) when it has focus, from the BT keyboard paired with (a) -- but this does not work.

What you expected to happen

It would be great (even greater than it already is) if Teleport would support this!

Step-by-step reproduction instructions

Without teleport running anywhere, the BT keyboard media keys work fine with whatever machine it's paired with, including (b).

With teleport running the BT keyboard media keys work for whatever the machine it is paired with, even (b).

With Teleport in my desired setup, the BT keyboard paired with primary (a) and wanting to remote control (b) and (c), the media keys on the BT keyboard don't work on (b) when that has focus but they do work on (c) when it has focus.

Interestingly, in this configuration, the media keys on (a)'s builtin keyboard do work on (b) when the latter has focus.

So I guess it's somehow a combination of using a BT (or at least external) keyboard on the primary machine and the fact that the secondary machine has that ribbon thingy?

I imaginge it might be hard to reproduce this, so please let me know if I can be helpful at all with providing extra information, logs, and so on.

Environment information

Server (Mac with keyboard and pointing device)

Client (Mac being remotely controlled)

johndbritton commented 2 years ago

Thanks for the detailed issue.

If this isn't currently supported by Teleport, I don't think I'll have the time to add it. If someone submits a pull request I will review and merge so long as it doesn't cause issues for others.

As a potential solution, I'd recommend you check out Karabiner Elements. You could map a key combo on the target machine to control brightness from the function keys when the target machine is being controlled.

I think it should be relatively straightforward to make this work without making changes to Teleport.

https://karabiner-elements.pqrs.org

johndbritton commented 2 years ago

Triaged this as an accepted feature request if someone wants to work on it.

erikkemperman commented 2 years ago

Hi, thanks for the very quick response. That's fair enough, of course. I guess I'd hoped that the apparently quite particular circumstances might provide a decent clue as to where to look. I might have a stab at it myself; I am a developer but no experience in objective C... I found another issue where you explained how to turn on debugging output, I will try that when I find some time. And if you'd perhaps have a suggestion or two as to roughly where in the code I might commence my search, that would be much appreciated!

johndbritton commented 2 years ago

@erikkemperman as I'm not the original author of the app, I don't really know how to implement the feature.

I'd recommend reading up on event taps in the Apple developer documentation and see if those special function keys trigger keyboard events that can be captured by an event tap and if they can be forwarded.

I think the simplest solution will be to use karabiner elements. It's an awesome piece of software and you might also find some other really nice uses for it.