Package: ncmpc
Version: 0.12-1
Tags: patch

I already have a clock, and I don't need ncmpc showing me another one.

This patch adds command line options and a config file item to allow the
user to flexibly enable or disable the clock.

diff --git a/src/conf.c b/src/conf.c
index 5b3ebb3..b43078c 100644
--- a/src/conf.c
+++ b/src/conf.c
@@ -71,6 +71,7 @@
 #define CONF_SCROLL_SEP "scroll-sep"
 #define CONF_VISIBLE_BITRATE "visible-bitrate"
 #define CONF_WELCOME_SCREEN_LIST "welcome-screen-list"
+#define CONF_DISPLAY_TIME "display-time"
 
 typedef enum {
        KEY_PARSER_UNKNOWN,
@@ -534,7 +535,9 @@ read_rc_file(char *filename)
                                else if (!strcasecmp(CONF_SCROLL_SEP, name)) {
                                        g_free(options.scroll_sep);
                                        options.scroll_sep = get_format(value);
-                               } else
+                               } else if (!strcasecmp(CONF_DISPLAY_TIME, name))
+                                       options.display_time = str2bool(value);
+                               else
                                        match_found = 0;
 
                                if (!match_found)
diff --git a/src/options.c b/src/options.c
index b6a49e3..9d8ce93 100644
--- a/src/options.c
+++ b/src/options.c
@@ -77,6 +77,8 @@ static const arg_opt_t option_table[] = {
        { 'f', "config", "FILE", "Read configuration from file" },
        { 'k', "key-file","FILE", "Read configuration from file" },
        { 'S', "no-splash", NULL, "Don't show the splash screen" },
+       { 't', "display-time", NULL, "Display the time when idle" },
+       { 'T', "no-display-time", NULL, "Do not display the time when idle" },
 #ifndef NDEBUG
        { 'K', "dump-keys", NULL, "Dump key bindings to stdout" },
 #endif
@@ -232,6 +234,12 @@ handle_option(int c, const char *arg)
        case 'S': /* --key-file */
                /* the splash screen was removed */
                break;
+       case 't': /* --display-time */
+               options.display_time = 1;
+               break;
+       case 'T': /* --no-display-time */
+               options.display_time = 0;
+               break;
 #ifndef NDEBUG
        case 'K': /* --dump-keys */
                read_configuration();
@@ -358,4 +366,5 @@ options_init(void)
 #ifndef NCMPC_MINI
        options.scroll_sep = g_strdup(DEFAULT_SCROLL_SEP);
 #endif
+       options.display_time = 1;
 }
diff --git a/src/options.h b/src/options.h
index 98ad315..cce36a5 100644
--- a/src/options.h
+++ b/src/options.h
@@ -51,6 +51,7 @@ typedef struct {
        bool visible_bitrate;
        bool welcome_screen_list;
 #endif
+       int display_time;
 } options_t;
 
 extern options_t options;
diff --git a/src/screen.c b/src/screen.c
index 1a68b41..05d1e83 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -331,10 +331,12 @@ paint_status_window(mpdclient_t *c)
                }
 #ifndef NCMPC_MINI
        } else {
-               time_t timep;
+               if (options.display_time) {
+                       time_t timep;
 
-               time(&timep);
-               strftime(screen.buf, screen.buf_size, "%X ",localtime(&timep));
+                       time(&timep);
+                       strftime(screen.buf, screen.buf_size, "%X 
",localtime(&timep));
+               }
 #endif
        }
 


-- 
Paul Collins
Wellington, New Zealand

Dag vijandelijk luchtschip de huismeester is dood



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to