diff --git a/README b/README deleted file mode 100644 index 49350a4..0000000 --- a/README +++ /dev/null @@ -1,54 +0,0 @@ -mpdart -====== - -A simple mpd client which only displays the cover art for the current song. - -depends -------- - -libX11 -libmpdclient -libim2 -pkg-config (optional build time dependency) - -building --------- - - ./configure.sh - make - make install # supports PREFIX and DESTDIR - -usage ------ - -There are three flags: - - mpdart -d musicdir -h host -p port - -Though only -d is needed: - - mpdart -d ~/music - -Once mpdart is running you can press the window to toggle mpd's pause/play. - -contributing ------------- - -pull requests -~~~~~~~~~~~~~ -If you like github you can contribute by sending in a pull request at -https://github.com/depsterr/mpdart - -patches -~~~~~~~ -If you don't like github you can contribute by emailing me at -depsterr at protonmail dot com with the output of - - git format-patch - -after you've commited your changes to your local tree. - -credits -------- - -Big thanks to my friend wooosh for helping me debug and develop this :) diff --git a/README.md b/README.md index 72cc146..c53a63d 100644 --- a/README.md +++ b/README.md @@ -1,37 +1,41 @@ mpdart ====== -A simple mpd client which only displays the cover art for the current song. +mpdart is a simple X application that displays the album art of the currently playing mpd song and lets you toggle play pause. It spends almost all of it's time idle and according to top it uses `0.0%` of my CPU and `0.1%` of my ram. -depends +Depends ------- -libX11 -libmpdclient -libim2 -pkg-config (optional build time dependency) + libX11 + libmpdclient + libim2 + pkg-config # optional build time dependency -building +Building -------- ./configure.sh make make install # supports PREFIX and DESTDIR -usage +Usage ----- There are three flags: - mpdart -d musicdir -h host -p port + mpdart -d musicdir -h host -p port -t timeout # timeout is milliseconds Though only -d is needed: mpdart -d ~/music +These options can also be configured in the enviorment variables `MPDART_DIR`, `MPDART_HOST`, `MPDART_PORT`, and `MPDART_TIMEOUT`. + +To make these changes persistent, add them to your `~/.profile`. + Once mpdart is running you can press the window to toggle mpd's pause/play. -contributing +Contributing ------------ ### pull requests @@ -46,7 +50,7 @@ depsterr at protonmail dot com with the output of after you've commited your changes to your local tree. -credits +Credits ------- Big thanks to my friend wooosh for helping me debug and develop this :) diff --git a/mpdart.c b/mpdart.c index c2a2d7a..aacffa1 100644 --- a/mpdart.c +++ b/mpdart.c @@ -14,7 +14,7 @@ #include #include -/* let user define a size on compiler the commandline */ +/* let user define a size on the compiler command line if they want to */ #ifndef DEFAULTSIZE #define DEFAULTSIZE 256 #endif @@ -269,6 +269,12 @@ void mpd_check_error(void) { int main(int argc, char** argv) { + /* get args from environment */ + mpd_db_dir = getenv("MPDART_DIR"); + mpd_host = getenv("MPDART_HOST"); + mpd_port = getenv("MPDART_PORT"); + mpd_timeout = getenv("MPDART_TIMEOUT"); + /* parse args */ while (*++argv) { if (!strcmp(*argv, "-d")) @@ -282,7 +288,7 @@ int main(int argc, char** argv) { } if (!mpd_db_dir) - die("Please specify mpd music directory with -d"); + die("Please specify mpd music directory with -d, or in the MPDART_DIR environment variable"); /* strip all '/'es from the end of mpd_db_dir */ {