From c9f28744c2d251e7fa36f00b1729dc7533614bac Mon Sep 17 00:00:00 2001 From: EinTim23 Date: Tue, 5 Nov 2024 11:29:02 +0100 Subject: [PATCH] removed unused include and added MRMediaRemoteGetNowPlayingApplicationPID --- src/backends/darwin.mm | 9 +++++++++ src/main.cpp | 2 -- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/backends/darwin.mm b/src/backends/darwin.mm index 93a6802..fc8f1ec 100644 --- a/src/backends/darwin.mm +++ b/src/backends/darwin.mm @@ -1,9 +1,18 @@ #ifdef __APPLE__ #include +#include #include "../MediaRemote.hpp" #include "../backend.hpp" std::shared_ptr backend::getMediaInformation() { + MRMediaRemoteGetNowPlayingApplicationPID(dispatch_get_main_queue(), ^(pid_t pid) { + if (pid > 0) { + NSRunningApplication *app = [NSRunningApplication runningApplicationWithProcessIdentifier:pid]; + if (app) { + NSLog(@"%@", app.bundleIdentifier); + } + } + }); MRMediaRemoteGetNowPlayingInfo(dispatch_get_main_queue(), ^(CFDictionaryRef result) { if (result) { NSDictionary *playingInfo = (__bridge NSDictionary *)(result); diff --git a/src/main.cpp b/src/main.cpp index af84b1d..e632ae5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -6,8 +6,6 @@ #include #include -#include -#include #include #include "backend.hpp"