-
Notifications
You must be signed in to change notification settings - Fork 9
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
Media keys work; but action immediately reveresed #27
Comments
Never encountered that one before 😬. from AppKit import NSApplication, NSApplicationActivationPolicyProhibited
from AppKit import NSSystemDefined
from AppKit import NSKeyUp
from PyObjCTools import AppHelper
class KeySocketApp(NSApplication):
def sendEvent_(self, event):
if event.type() is NSSystemDefined and event.subtype() == 8:
data = event.data1()
key_code = (data & 0xFFFF0000) >> 16
key_flags = (data & 0x0000FFFF)
key_state = (key_flags & 0xFF00) >> 8
if key_state is NSKeyUp:
print("Key up detected.")
elif key_code == 20 or key_code == 18:
print("Previous key detected")
elif key_code == 16:
print("Play/pause key detected")
elif key_code == 19 or key_code == 17:
print("Next key detected.")
else:
print(f"Unknown key code: {key_code}")
app = KeySocketApp.sharedApplication()
app.setActivationPolicy_(NSApplicationActivationPolicyProhibited)
AppHelper.runEventLoop() |
Here is the output. Not very helpful, so I made a video too.
|
I introduced a config variable named Please upgrade to the most recent version (v3.0.4 at the time of writing), delete your config file and set an appropriate interval. rm $(EDITOR=echo cmus-osx config)
cmus-osx config |
This partially fixed the issue. Pressing play plays the music, however pausing pauses for a few seconds and plays again. Things I done/things I noticed: 1- I changed a bit in the |
When using the media keys both on the my Mac and an external keyboard, they register but the action is immediately reversed. So if I press play I hear the music playing for a fraction of a second then stops. And if I press pause the music stops for a fraction of a second and plays again.
In both cases notifications are triggered.
The text was updated successfully, but these errors were encountered: