Skip to content

Commit 9107d0e

Browse files
committed
Player: try avoiding too Linux-specific names
1 parent ee876c5 commit 9107d0e

File tree

6 files changed

+11
-11
lines changed

6 files changed

+11
-11
lines changed

src/detection/media/media.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const FFMediaResult* ffDetectMedia(const FFinstance* instance)
77
{
88
FF_DETECTION_INTERNAL_GUARD(FFMediaResult,
99
ffStrbufInitA(&result.error, 0);
10-
ffStrbufInit(&result.busNameShort);
10+
ffStrbufInit(&result.playerId);
1111
ffStrbufInit(&result.player);
1212
ffStrbufInit(&result.song);
1313
ffStrbufInit(&result.artist);

src/detection/media/media.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
typedef struct FFMediaResult
99
{
1010
FFstrbuf error;
11-
FFstrbuf busNameShort; //e.g. plasma-browser-integration
11+
FFstrbuf playerId; // Bus name on Linux, app bundle name on macOS. e.g. plasma-browser-integration
1212
FFstrbuf player; // e.g. Google Chrome
1313
FFstrbuf song;
1414
FFstrbuf artist;

src/detection/media/media_apple.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,17 @@
5757
if (identifier == nil)
5858
identifier = MRNowPlayingClientGetParentAppBundleIdentifier(clientObj);
5959
if (identifier != nil)
60-
ffCfStrGetString(identifier, &result->busNameShort);
60+
ffCfStrGetString(identifier, &result->playerId);
6161
}
6262
dispatch_group_leave(group);
6363
});
6464

6565
dispatch_group_wait(group, DISPATCH_TIME_FOREVER);
6666

67-
if(result->busNameShort.length > 0)
67+
if(result->playerId.length > 0)
6868
{
6969
char buf[128];
70-
snprintf(buf, sizeof(buf), "name of app id \"%s\"", result->busNameShort.chars);
70+
snprintf(buf, sizeof(buf), "name of app id \"%s\"", result->playerId.chars);
7171
ffOsascript(buf, &result->player);
7272
}
7373

src/detection/media/media_linux.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,14 @@ static bool getBusProperties(FFDBusData* data, const char* busName, FFMediaResul
8787
}
8888

8989
//Set short bus name
90-
ffStrbufAppendS(&result->busNameShort, busName + sizeof(FF_DBUS_MPRIS_PREFIX) - 1);
90+
ffStrbufAppendS(&result->playerId, busName + sizeof(FF_DBUS_MPRIS_PREFIX) - 1);
9191

9292
//We found a song, get the player name
9393
ffDBusGetPropertyString(data, busName, "/org/mpris/MediaPlayer2", "org.mpris.MediaPlayer2", "Identity", &result->player);
9494
if(result->player.length == 0)
9595
ffDBusGetPropertyString(data, busName, "/org/mpris/MediaPlayer2", "org.mpris.MediaPlayer2", "DesktopEntry", &result->player);
9696
if(result->player.length == 0)
97-
ffStrbufAppend(&result->player, &result->busNameShort);
97+
ffStrbufAppend(&result->player, &result->playerId);
9898

9999
return true;
100100
}

src/fastfetch.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ static inline void printCommandHelp(const char* command)
381381
constructAndPrintCommandHelpFormat("player", "{}", 4,
382382
"Pretty player name",
383383
"Player name",
384-
"DBus bus name",
384+
"Player Identifier",
385385
"URL name"
386386
);
387387
}

src/modules/player.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ void ffPrintPlayer(FFinstance* instance)
2222

2323
//If we are on a website, prepend the website name
2424
if(
25-
ffStrbufIgnCaseCompS(&media->busNameShort, "spotify") == 0 ||
26-
ffStrbufIgnCaseCompS(&media->busNameShort, "vlc") == 0
25+
ffStrbufIgnCaseCompS(&media->playerId, "spotify") == 0 ||
26+
ffStrbufIgnCaseCompS(&media->playerId, "vlc") == 0
2727
) {} // do noting, surely not a website, even if the url is set
2828
else if(ffStrbufStartsWithS(&media->url, "https://www."))
2929
ffStrbufAppendS(&playerPretty, media->url.chars + 12);
@@ -66,7 +66,7 @@ void ffPrintPlayer(FFinstance* instance)
6666
ffPrintFormat(instance, FF_PLAYER_MODULE_NAME, 0, &instance->config.player, FF_PLAYER_NUM_FORMAT_ARGS, (FFformatarg[]){
6767
{FF_FORMAT_ARG_TYPE_STRBUF, &playerPretty},
6868
{FF_FORMAT_ARG_TYPE_STRBUF, &media->player},
69-
{FF_FORMAT_ARG_TYPE_STRBUF, &media->busNameShort},
69+
{FF_FORMAT_ARG_TYPE_STRBUF, &media->playerId},
7070
{FF_FORMAT_ARG_TYPE_STRBUF, &media->url}
7171
});
7272
}

0 commit comments

Comments
 (0)