aboutsummaryrefslogtreecommitdiff
path: root/mpc-bar.m
diff options
context:
space:
mode:
Diffstat (limited to 'mpc-bar.m')
-rw-r--r--mpc-bar.m8
1 files changed, 7 insertions, 1 deletions
diff --git a/mpc-bar.m b/mpc-bar.m
index 90ff0e3..beff51f 100644
--- a/mpc-bar.m
+++ b/mpc-bar.m
@@ -50,6 +50,7 @@ static NSString *formatTime(unsigned int t) {
struct config {
char *host;
char *host, *format;
+ char *host, *format, *idle_message;
unsigned port;
};
@@ -63,6 +64,8 @@ static int handler(void *userdata, const char *section, const char *name,
c->port = atoi(value);
} else if (MATCH("display", "format")) {
c->format = strdup(value);
+ } else if (MATCH("display", "idle_message")) {
+ c->idle_message = strdup(value);
} else {
return 0;
}
@@ -93,6 +96,7 @@ static int handler(void *userdata, const char *section, const char *name,
config.host = NULL;
config.port = 0;
config.format = "[%name%: &[[%artist%|%performer%|%composer%|%albumartist%] - ]%title%]|%name%|[[%artist%|%performer%|%composer%|%albumartist%] - ]%title%|%file%";
+ config.idle_message = "No song playing";
}
- (void)readConfigFile {
const char *path = [[NSHomeDirectory()
@@ -211,7 +215,9 @@ static int handler(void *userdata, const char *section, const char *name,
[output appendString:utf8String(s)];
free(s);
} else {
- [output setString:@"No song playing"];
+ // FIXME: There's no point calling utf8String more than once, as
+ // idle_message never changes.
+ [output setString:utf8String(config.idle_message)];
[menuButton setImage:nil];
}