nhurden / mediakeytap Goto Github PK
View Code? Open in Web Editor NEWAccess media key events from Swift.
License: MIT License
Access media key events from Swift.
License: MIT License
Trying to use this library in my current Xcode project and I'm seeing this warning appear in the console when a media key is pressed. It does seem to be working just fine apart from that, but the warning is concerning.
pid(87021)/euid(501) is calling TIS/TSM in non-main thread environment,
ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!
Hi,
As I know this framework not work in macOS Sonoma any update soon?
See : MonitorControl/MonitorControl#100 (comment)
F14 and F15 should not be intercepted for these keyboards as Brightness keys.
For these Apple keyboards with F13-F19 keys available (eg. 'Magic Keyboard with Numeric Keypad'), the native brightness controls (media keys) are on the F1+F2 key positions, not the intercepted :
Key Down
Characters:
Unicode: 63249 / 0xf711
Keys: F14
Key Code: 107 / 0x6b
Modifiers: 8388864 / 0x800100 ⓘ
Key Down
Characters:
Unicode: 63250 / 0xf712
Keys: F15
Key Code: 113 / 0x71
Modifiers: 8388864 / 0x800100 ⓘ
Error at following line in MediaKeyTapInternals.swift:
let refcon = unsafeBitCast(callback, to: UnsafeMutableRawPointer.self)
private func keyCaptureEventTapPort(callback: EventTapCallback) -> CFMachPort? {
let cCallback: CGEventTapCallBack = { proxy, type, event, refcon in
let innerBlock = unsafeBitCast(refcon, to: EventTapCallback.self)
return innerBlock(type, event).map(Unmanaged.passUnretained)
}
let refcon = unsafeBitCast(callback, to: UnsafeMutableRawPointer.self)
return CGEvent.tapCreate(
tap: .cgSessionEventTap,
place: .headInsertEventTap,
options: .defaultTap,
eventsOfInterest: CGEventMask(1 << NX_SYSDEFINED),
callback: cCallback,
userInfo: refcon)
}
Hi, I am using AVPlayerView in my app, I am able to start video with media key, is there any way to disable it? I really need it. I want to disable media keys in my macOS app.
Hi,
How can I customize the hardcoded isMediaKeyEvent
function in MediaKeyTap/NSEventExtensions.swift
? I want to add NX_KEYTYPE_SOUND_UP
and NX_KEYTYPE_SOUND_DOWN
constants. Is there a way to customize this? Thanks!
I've noticed that MediaKeyTap seems to respond only to actual keyboard media keys, and not the buttons on headsets plugged into the audio port, or bluetooth headsets.
I've used BeardedSpice, and noticed that it supports these buttons, so I looked under the hood. It seems, while it uses SPMediaKeyTap, it also uses DDHidLib to somehow capture these additional "AppleMikey" button presses.
Is that something you'd consider adding as additional triggers for play/pause, forward/next, back/previous?
MACOSX_DEPLOYMENT_TARGET = 10.11;
now in MediaKeyTap/MediaKeyTap.xcodeproj/project.pbxproj
Compiling the project on Xcode 10 gives the error Converting non-escaping value to 'T' may allow it to escape at this line:
let refcon = unsafeBitCast(callback, to: UnsafeMutableRawPointer.self)
in the function: keyCaptureEventTapPort in the file: MediaKeyTapInternals.swift
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.