summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLouis Burda <quent.burda@gmail.com>2022-03-01 13:47:34 +0100
committerLouis Burda <quent.burda@gmail.com>2022-03-01 13:47:34 +0100
commit28faa6d200deee6b39d08e539ab0051ed421e283 (patch)
tree5f9ec7ef5aea5011a13ffc19f118ec297f86e2d9
parent97a39667e0802ddd9ee0f5ee165c614299bc8fd1 (diff)
downloadtmus-28faa6d200deee6b39d08e539ab0051ed421e283.tar.gz
tmus-28faa6d200deee6b39d08e539ab0051ed421e283.zip
Add display timer to cmd status
-rw-r--r--src/tui.c30
-rw-r--r--src/tui.h2
2 files changed, 25 insertions, 7 deletions
diff --git a/src/tui.c b/src/tui.c
index dc8be17..c5009c9 100644
--- a/src/tui.c
+++ b/src/tui.c
@@ -107,7 +107,9 @@ struct list *tracks_vis;
int track_show_playlist;
struct listnav tag_nav;
struct listnav track_nav;
+
char *cmd_status;
+int cmd_status_uptime;
const char imode_prefix[IMODE_COUNT] = {
[IMODE_EXECUTE] = ':',
@@ -802,12 +804,21 @@ cmd_pane_vis(struct pane *pane, int sel)
}
/* status bits on right of status line */
- if (player.loaded) ATTR_ON(pane->win, A_REVERSE);
- mvwaddstr(pane->win, 1, pane->w - 5, "[ ]");
- if (track_show_playlist) mvwaddstr(pane->win, 1, pane->w - 4, "P");
- if (player.autoplay) mvwaddstr(pane->win, 1, pane->w - 3, "A");
- if (player.shuffle) mvwaddstr(pane->win, 1, pane->w - 2, "S");
- if (player.loaded) ATTR_OFF(pane->win, A_REVERSE);
+ if (player.loaded)
+ ATTR_ON(pane->win, A_REVERSE);
+
+ mvwaddstr(pane->win, 1, pane->w - 6, "[ ]");
+ if (list_empty(&player.history))
+ mvwaddstr(pane->win, 1, pane->w - 5, "H");
+ if (track_show_playlist)
+ mvwaddstr(pane->win, 1, pane->w - 4, "P");
+ if (player.autoplay)
+ mvwaddstr(pane->win, 1, pane->w - 3, "A");
+ if (player.shuffle)
+ mvwaddstr(pane->win, 1, pane->w - 2, "S");
+
+ if (player.loaded)
+ ATTR_OFF(pane->win, A_REVERSE);
if (sel || cmd_show) {
/* cmd and search input */
@@ -841,10 +852,14 @@ cmd_pane_vis(struct pane *pane, int sel)
? cmd->buf[cmd->cur] : L' ');
ATTR_OFF(pane->win, A_REVERSE);
}
- } else if (cmd_status) {
+ } else if (cmd_status && cmd_status_uptime) {
+ cmd_status_uptime--;
strbuf_clear(&line);
strbuf_append(&line, " %s", cmd_status);
pane_writeln(pane, 2, line.buf);
+ } else {
+ free(cmd_status);
+ cmd_status = NULL;
}
}
@@ -1082,6 +1097,7 @@ tui_init(void)
cmd_input_mode = IMODE_TRACK_SELECT;
cmd_status = NULL;
+ cmd_status_uptime = 0;
inputln_init(&completion_query);
completion_reset = 1;
diff --git a/src/tui.h b/src/tui.h
index 1b735aa..71572ed 100644
--- a/src/tui.h
+++ b/src/tui.h
@@ -8,6 +8,7 @@
#define CMD_SET_STATUS(...) do { \
free(cmd_status); \
+ cmd_status_uptime = 10; \
cmd_status = aprintf(__VA_ARGS__); \
} while (0)
@@ -27,4 +28,5 @@ extern struct listnav tag_nav;
extern struct listnav track_nav;
extern char *cmd_status;
+extern int cmd_status_uptime;