diff options
Diffstat (limited to '')
-rw-r--r-- | src/conf.c | 5 | ||||
-rw-r--r-- | src/list_window.c | 11 | ||||
-rw-r--r-- | src/options.h | 1 | ||||
-rw-r--r-- | src/screen_play.c | 13 |
4 files changed, 23 insertions, 7 deletions
diff --git a/src/conf.c b/src/conf.c index 11dba9993..9222ed18e 100644 --- a/src/conf.c +++ b/src/conf.c @@ -60,6 +60,7 @@ #define CONF_ENABLE_MOUSE "enable-mouse" #define CONF_CROSSFADE_TIME "crossfade-time" #define CONF_SEARCH_MODE "search-mode" +#define CONF_HIDE_CURSOR "hide-cursor" typedef enum { KEY_PARSER_UNKNOWN, @@ -477,6 +478,10 @@ read_rc_file(char *filename, options_t *options) { options->search_mode = atoi(value); } + else if( !strcasecmp(CONF_HIDE_CURSOR, name) ) + { + options->hide_cursor = atoi(value); + } else { match_found = 0; diff --git a/src/list_window.c b/src/list_window.c index c6f5375a1..7bbc6e193 100644 --- a/src/list_window.c +++ b/src/list_window.c @@ -165,12 +165,9 @@ list_window_paint(list_window_t *lw, { int i; int fill = options.wide_cursor; + int show_cursor = !(lw->flags & LW_HIDE_CURSOR); - if( lw->flags & LW_HIDE_CURSOR ) - { - lw->selected = -1; - } - else + if( show_cursor ) { while( lw->selected < lw->start ) { @@ -183,7 +180,7 @@ list_window_paint(list_window_t *lw, lw->clear=1; } } - + for(i=0; i<lw->rows; i++) { int highlight = 0; @@ -203,7 +200,7 @@ list_window_paint(list_window_t *lw, else colors_use(lw->w, COLOR_LIST); - if( selected ) + if( show_cursor && selected ) wattron(lw->w, A_REVERSE); waddnstr(lw->w, label, lw->cols); diff --git a/src/options.h b/src/options.h index d264dd1fa..c3395bbc4 100644 --- a/src/options.h +++ b/src/options.h @@ -15,6 +15,7 @@ typedef struct int port; int crossfade_time; int search_mode; + int hide_cursor; gboolean reconnect; gboolean debug; gboolean find_wrap; diff --git a/src/screen_play.c b/src/screen_play.c index b86c876de..51c722df5 100644 --- a/src/screen_play.c +++ b/src/screen_play.c @@ -21,6 +21,7 @@ #include <ctype.h> #include <stdlib.h> #include <string.h> +#include <time.h> #include <glib.h> #include <ncurses.h> #include <panel.h> @@ -341,6 +342,18 @@ play_paint(screen_t *screen, mpdclient_t *c) static void play_update(screen_t *screen, mpdclient_t *c) { + /* hide the cursor when mpd are playing and the user are inactive */ + if( options.hide_cursor>0 && c->status->state == MPD_STATUS_STATE_PLAY && + time(NULL)-screen->input_timestamp >= options.hide_cursor ) + { + lw->flags |= LW_HIDE_CURSOR; + } + else + { + lw->flags &= ~LW_HIDE_CURSOR; + } + + /* center the cursor */ if( options.auto_center ) { static int prev_song_id = 0; |