mirror of
https://github.com/yattee/yattee.git
synced 2024-12-22 21:43:41 +00:00
Merge pull request #802 from stonerl/buttons-interfere-with-search
macOS: only apply player shortcuts when window is active
This commit is contained in:
commit
cd24a0322f
@ -1286,7 +1286,10 @@ final class PlayerModel: ObservableObject {
|
|||||||
|
|
||||||
#if os(macOS)
|
#if os(macOS)
|
||||||
private func assignKeyPressMonitor() {
|
private func assignKeyPressMonitor() {
|
||||||
keyPressMonitor = NSEvent.addLocalMonitorForEvents(matching: .keyDown) { keyEvent -> NSEvent? in
|
keyPressMonitor = NSEvent.addLocalMonitorForEvents(matching: .keyDown) { [weak self] keyEvent -> NSEvent? in
|
||||||
|
// Check if the player window is the key window
|
||||||
|
guard let self, let window = Windows.playerWindow, window.isKeyWindow else { return keyEvent }
|
||||||
|
|
||||||
switch keyEvent.keyCode {
|
switch keyEvent.keyCode {
|
||||||
case 124:
|
case 124:
|
||||||
if !self.liveStreamInAVPlayer {
|
if !self.liveStreamInAVPlayer {
|
||||||
|
Loading…
Reference in New Issue
Block a user