From 9624e1e737ed7562068d2350272693864f08b7f2 Mon Sep 17 00:00:00 2001 From: Yorick van Pelt Date: Wed, 13 Apr 2022 10:34:49 +0200 Subject: [PATCH] Add support for emoji(playerName) using font-awesome-5-free icons --- playerctl/playerctl-formatter.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/playerctl/playerctl-formatter.c b/playerctl/playerctl-formatter.c index caeb853..b580bf6 100644 --- a/playerctl/playerctl-formatter.c +++ b/playerctl/playerctl-formatter.c @@ -613,6 +613,17 @@ static GVariant *helperfn_emoji(struct token *token, GVariant **args, int nargs, } else { return g_variant_new("s", "🔊"); } + } else if (g_strcmp0(key, "playerName") == 0 && g_variant_is_of_type(value, G_VARIANT_TYPE_STRING)) { + const gchar *playerName_str = g_variant_get_string(value, NULL); + if (g_strcmp0(playerName_str, "spotify") == 0) { + return g_variant_new("s", ""); + } else if (g_strcmp0(playerName_str, "firefox") == 0) { + return g_variant_new("s", ""); + } else if (g_strcmp0(playerName_str, "chromium") == 0) { + return g_variant_new("s", ""); + } else if (g_strcmp0(playerName_str, "mpv") == 0) { + return g_variant_new("s", ""); + } } g_variant_ref(value);