Add theme option for time in a status bar

This commit is contained in:
Lukasz Marcinowski
2017-02-15 14:34:57 +01:00
committed by Lukasz Marcinowski
parent f1a5d12950
commit 91bc302acf
4 changed files with 8 additions and 0 deletions

View File

@@ -2224,6 +2224,7 @@ cons_theme_properties(void)
_cons_theme_bar_prop(THEME_STATUS_BRACKET, "statusbar.brackets");
_cons_theme_bar_prop(THEME_STATUS_ACTIVE, "statusbar.active");
_cons_theme_bar_prop(THEME_STATUS_NEW, "statusbar.new");
_cons_theme_bar_prop(THEME_STATUS_TIME, "statusbar.time");
_cons_theme_prop(THEME_TIME, "main.time");
_cons_theme_prop(THEME_TEXT, "main.text");

View File

@@ -459,6 +459,7 @@ _status_bar_draw(void)
last_time = g_date_time_new_now(tz);
int bracket_attrs = theme_attrs(THEME_STATUS_BRACKET);
int time_attrs = theme_attrs(THEME_STATUS_TIME);
char *time_pref = prefs_get_string(PREF_TIME_STATUSBAR);
if (g_strcmp0(time_pref, "off") != 0) {
@@ -468,7 +469,9 @@ _status_bar_draw(void)
wattron(status_bar, bracket_attrs);
mvwaddch(status_bar, 0, 1, '[');
wattroff(status_bar, bracket_attrs);
wattron(status_bar, time_attrs);
mvwprintw(status_bar, 0, 2, date_fmt);
wattroff(status_bar, time_attrs);
wattron(status_bar, bracket_attrs);
mvwaddch(status_bar, 0, 2 + len, ']');
wattroff(status_bar, bracket_attrs);