summaryrefslogtreecommitdiffstats
path: root/mpd-notification.c
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2018-05-28 16:18:39 +0200
committerGravatar Christian Hesse <mail@eworm.de>2018-05-30 11:22:57 +0200
commitdb63b70b5dd04179aabf5119f0d8fc1d51a0edad (patch)
tree3ab4169e56df7216a67c01f6648eb833bc4f9885 /mpd-notification.c
parentf7fd5ad843a8deddc8b61b0ebda2b97942b408c7 (diff)
downloadmpd-notification-db63b70b5dd04179aabf5119f0d8fc1d51a0edad.tar.gz
mpd-notification-db63b70b5dd04179aabf5119f0d8fc1d51a0edad.tar.zst
show a notification without image data first
Diffstat (limited to 'mpd-notification.c')
-rw-r--r--mpd-notification.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/mpd-notification.c b/mpd-notification.c
index 743bf9a..46d471b 100644
--- a/mpd-notification.c
+++ b/mpd-notification.c
@@ -227,7 +227,7 @@ int main(int argc, char ** argv) {
GdkPixbuf * pixbuf = NULL;
GError * error = NULL;
unsigned short int errcount = 0;
- enum mpd_state state = MPD_STATE_UNKNOWN;
+ enum mpd_state state = MPD_STATE_UNKNOWN, last_state = MPD_STATE_UNKNOWN;
const char * mpd_host, * mpd_port_str, * music_dir, * uri = NULL;
unsigned mpd_port = MPD_PORT, mpd_timeout = MPD_TIMEOUT, notification_timeout = NOTIFICATION_TIMEOUT;
struct mpd_song * song = NULL;
@@ -399,6 +399,14 @@ int main(int argc, char ** argv) {
state = mpd_status_get_state(mpd_recv_status(conn));
if (state == MPD_STATE_PLAY) {
+ /* There's a bug in libnotify where the server spec version is fetched
+ * too late, which results in issue with image date. Make sure to
+ * show a notification without image data (just generic icon) first. */
+ if (last_state != MPD_STATE_PLAY) {
+ notify_notification_update(notification, TEXT_TOPIC, "Starting playback...", ICON_AUDIO_X_GENERIC);
+ notify_notification_show(notification, NULL);
+ }
+
mpd_response_next(conn);
song = mpd_recv_song(conn);
@@ -463,6 +471,8 @@ int main(int argc, char ** argv) {
} else
notifystr = strdup(TEXT_UNKNOWN);
+ last_state = state;
+
if (verbose > 0)
printf("%s: %s\n", program, notifystr);