bleh
This commit is contained in:
parent
4ea6801df2
commit
a743cdabe5
9 changed files with 32 additions and 70 deletions
|
@ -1,6 +1,5 @@
|
|||
#ifdef __linux__
|
||||
|
||||
#include <fmt/core.h>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <sdbus-c++/sdbus-c++.h>
|
||||
|
@ -70,8 +69,7 @@ std::vector<std::string> GetMprisPlayers(sdbus::IConnection& connection) {
|
|||
}
|
||||
|
||||
std::string GetActivePlayer(const std::vector<std::string>& mprisPlayers) {
|
||||
if (!mprisPlayers.empty())
|
||||
return mprisPlayers.front();
|
||||
if (!mprisPlayers.empty()) return mprisPlayers.front();
|
||||
|
||||
return "";
|
||||
}
|
||||
|
@ -83,13 +81,11 @@ std::string GetNowPlaying() {
|
|||
|
||||
std::vector<std::string> mprisPlayers = GetMprisPlayers(*connection);
|
||||
|
||||
if (mprisPlayers.empty())
|
||||
return "";
|
||||
if (mprisPlayers.empty()) return "";
|
||||
|
||||
std::string activePlayer = GetActivePlayer(mprisPlayers);
|
||||
|
||||
if (activePlayer.empty())
|
||||
return "";
|
||||
if (activePlayer.empty()) return "";
|
||||
|
||||
std::unique_ptr<sdbus::IProxy> playerProxy =
|
||||
sdbus::createProxy(*connection, activePlayer, PLAYER_OBJECT_PATH);
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
#ifdef __APPLE__
|
||||
|
||||
#include <string>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
#include "macos/NowPlayingBridge.h"
|
||||
#include "macos/now_playing_bridge.h"
|
||||
#include "os.h"
|
||||
|
||||
u64 GetMemInfo() {
|
||||
uint64_t mem = 0;
|
||||
size_t size = sizeof(mem);
|
||||
u64 mem = 0;
|
||||
usize size = sizeof(mem);
|
||||
|
||||
sysctlbyname("hw.memsize", &mem, &size, nullptr, 0);
|
||||
|
||||
|
@ -16,8 +15,9 @@ u64 GetMemInfo() {
|
|||
}
|
||||
|
||||
std::string GetNowPlaying() {
|
||||
if (const char* title = GetCurrentPlayingTitle())
|
||||
return title;
|
||||
if (const char* title = GetCurrentPlayingTitle();
|
||||
const char* artist = GetCurrentPlayingArtist())
|
||||
return "Now Playing: " + std::string(artist) + " - " + std::string(title);
|
||||
|
||||
return "No song playing";
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#ifdef __APPLE__
|
||||
|
||||
#import "NowPlayingBridge.h"
|
||||
#import "now_playing_bridge.h"
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <dispatch/dispatch.h>
|
||||
#import <objc/runtime.h>
|
Loading…
Add table
Add a link
Reference in a new issue