mpc-bar

macOS menu bar client for the Music Player Daemon
Log | Files | Refs | README | LICENSE

commit 848aeac4a71779094fd3cc32dbeda4f81051913b
parent d1e077458de7fca3753940a7fe21f9ace1f6bb56
Author: Spencer Williams <spnw@plexwave.org>
Date:   Mon, 14 Apr 2025 15:47:26 -0400

Support configs named .mpc-bar.ini

Diffstat:
Mmpc-bar.m | 7++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/mpc-bar.m b/mpc-bar.m @@ -103,10 +103,11 @@ static int handler(void *userdata, const char *section, const char *name, config.show_queue = 1; config.show_queue_idle = -1; } +- (BOOL)tryReadConfigFile:(NSString *)file { + return (0 == ini_parse([[NSHomeDirectory() stringByAppendingPathComponent:file] UTF8String], handler, &config)); +} - (void)readConfigFile { - const char *path = [[NSHomeDirectory() - stringByAppendingPathComponent:@".mpcbar"] UTF8String]; - if (ini_parse(path, handler, &config) < 0) { + if (!([self tryReadConfigFile: @".mpc-bar.ini"] || [self tryReadConfigFile: @".mpcbar"])) { NSLog(@"Failed to read config file"); } if (config.show_queue_idle == -1) {