1
0
mirror of https://github.com/yattee/yattee.git synced 2024-12-12 21:30:32 +05:30

macOS only apply player shortcuts when window is active

This commit is contained in:
Toni Förster 2024-09-05 18:08:31 +02:00
parent 9bf3df1a29
commit d525a22215
No known key found for this signature in database
GPG Key ID: 292F3E5086C83FC7

View File

@ -1286,7 +1286,10 @@ final class PlayerModel: ObservableObject {
#if os(macOS)
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 {
case 124:
if !self.liveStreamInAVPlayer {