Add 'statusbar_time_color' and 'player_state_color' configuration variables
This commit is contained in:
1
NEWS
1
NEWS
@@ -14,6 +14,7 @@ ncmpcpp-0.8 (????-??-??)
|
||||
* Application will now exit if stdin is closed.
|
||||
* Configuration variable 'visualizer_sample_multiplier' was deprecated and will be removed in 0.9.
|
||||
* Wide character version of ncurses is now required.
|
||||
* Added 'statusbar_time_color' and 'player_state_color' configuration variables for further customization of statusbar.
|
||||
|
||||
ncmpcpp-0.7.7 (2016-10-31)
|
||||
* Fixed compilation on 32bit platforms.
|
||||
|
||||
@@ -501,6 +501,7 @@
|
||||
## visualizer_color, color1, color2, empty_tag_color,
|
||||
## volume_color, state_line_color, state_flags_color,
|
||||
## progressbar_color, progressbar_elapsed_color,
|
||||
## player_state_color, statusbar_time_color,
|
||||
## alternative_ui_separator_color.
|
||||
##
|
||||
## Note: due to technical limitations of older ncurses
|
||||
@@ -534,6 +535,10 @@
|
||||
#
|
||||
#statusbar_color = default
|
||||
#
|
||||
#statusbar_time_color = default:b
|
||||
#
|
||||
#player_state_color = default:b
|
||||
#
|
||||
#alternative_ui_separator_color = black:b
|
||||
#
|
||||
#active_column_color = red
|
||||
|
||||
@@ -378,9 +378,15 @@ Color of progressbar.
|
||||
.B progressbar_elapsed_color = COLOR
|
||||
Color of part of progressbar that represents elapsed time.
|
||||
.TP
|
||||
.B player_state_color = COLOR
|
||||
Color of player state shown in statusbar.
|
||||
.TP
|
||||
.B statusbar_color = COLOR
|
||||
Color of statusbar.
|
||||
.TP
|
||||
.B statusbar_time_color = COLOR
|
||||
Color of current track time shown in statusbar.
|
||||
.TP
|
||||
.B alternative_ui_separator_color = COLOR
|
||||
Color of separators used in alternative user interface.
|
||||
.TP
|
||||
|
||||
@@ -2934,7 +2934,6 @@ void seek()
|
||||
else
|
||||
break;
|
||||
|
||||
*wFooter << NC::Format::Bold;
|
||||
std::string tracklength;
|
||||
// FIXME: merge this with the code in status.cpp
|
||||
switch (Config.design)
|
||||
@@ -2951,7 +2950,10 @@ void seek()
|
||||
tracklength += "/";
|
||||
tracklength += MPD::Song::ShowTime(Status::State::totalTime());
|
||||
tracklength += "]";
|
||||
*wFooter << NC::XY(wFooter->getWidth()-tracklength.length(), 1) << tracklength;
|
||||
*wFooter << NC::XY(wFooter->getWidth()-tracklength.length(), 1)
|
||||
<< Config.statusbar_time_color
|
||||
<< tracklength
|
||||
<< NC::FormattedColor::End(Config.statusbar_time_color);
|
||||
break;
|
||||
case Design::Alternative:
|
||||
if (Config.display_remaining_time)
|
||||
@@ -2963,11 +2965,14 @@ void seek()
|
||||
tracklength = MPD::Song::ShowTime(songpos);
|
||||
tracklength += "/";
|
||||
tracklength += MPD::Song::ShowTime(Status::State::totalTime());
|
||||
*wHeader << NC::XY(0, 0) << tracklength << " ";
|
||||
*wHeader << NC::XY(0, 0)
|
||||
<< Config.statusbar_time_color
|
||||
<< tracklength
|
||||
<< NC::FormattedColor::End(Config.statusbar_time_color)
|
||||
<< " ";
|
||||
wHeader->refresh();
|
||||
break;
|
||||
}
|
||||
*wFooter << NC::Format::NoBold;
|
||||
Progressbar::draw(songpos, Status::State::totalTime());
|
||||
wFooter->refresh();
|
||||
}
|
||||
|
||||
@@ -507,7 +507,9 @@ bool Configuration::read(const std::vector<std::string> &config_paths, bool igno
|
||||
p.add("main_window_highlight_color", &main_highlight_color, "yellow");
|
||||
p.add("progressbar_color", &progressbar_color, "black:b");
|
||||
p.add("progressbar_elapsed_color", &progressbar_elapsed_color, "green:b");
|
||||
p.add("player_state_color", &player_state_color, "default:b");
|
||||
p.add("statusbar_color", &statusbar_color, "default");
|
||||
p.add("statusbar_time_color", &statusbar_time_color, "default:b");
|
||||
p.add("alternative_ui_separator_color", &alternative_ui_separator_color, "black:b");
|
||||
p.add("active_column_color", &active_column_color, "red");
|
||||
p.add("window_border_color", &window_border, "green", verbose_lexical_cast<NC::Color>);
|
||||
|
||||
@@ -113,6 +113,8 @@ struct Configuration
|
||||
NC::FormattedColor state_flags_color;
|
||||
NC::FormattedColor progressbar_color;
|
||||
NC::FormattedColor progressbar_elapsed_color;
|
||||
NC::FormattedColor player_state_color;
|
||||
NC::FormattedColor statusbar_time_color;
|
||||
NC::FormattedColor alternative_ui_separator_color;
|
||||
|
||||
std::vector<NC::FormattedColor> visualizer_colors;
|
||||
|
||||
@@ -596,7 +596,8 @@ void Status::Changes::elapsedTime(bool update_elapsed)
|
||||
{
|
||||
// MPD is not playing, clear statusbar and exit.
|
||||
if (Statusbar::isUnlocked() && Config.statusbar_visibility)
|
||||
*wFooter << NC::XY(0, 1) << NC::TermManip::ClearToEOL;
|
||||
*wFooter << NC::XY(0, 1)
|
||||
<< NC::TermManip::ClearToEOL;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -640,9 +641,19 @@ void Status::Changes::elapsedTime(bool update_elapsed)
|
||||
tracklength += "]";
|
||||
NC::WBuffer np_song;
|
||||
Format::print(Config.song_status_wformat, np_song, &np);
|
||||
*wFooter << NC::XY(0, 1) << NC::TermManip::ClearToEOL << NC::Format::Bold << ps << ' ' << NC::Format::NoBold;
|
||||
writeCyclicBuffer(np_song, *wFooter, playing_song_scroll_begin, wFooter->getWidth()-ps.length()-tracklength.length()-2, L" ** ");
|
||||
*wFooter << NC::Format::Bold << NC::XY(wFooter->getWidth()-tracklength.length(), 1) << tracklength << NC::Format::NoBold;
|
||||
*wFooter << NC::XY(0, 1)
|
||||
<< NC::TermManip::ClearToEOL
|
||||
<< Config.player_state_color
|
||||
<< ps
|
||||
<< NC::FormattedColor::End(Config.player_state_color)
|
||||
<< " ";
|
||||
writeCyclicBuffer(
|
||||
np_song, *wFooter, playing_song_scroll_begin,
|
||||
wFooter->getWidth()-ps.length()-tracklength.length()-2, L" ** ");
|
||||
*wFooter << NC::XY(wFooter->getWidth()-tracklength.length(), 1)
|
||||
<< Config.statusbar_time_color
|
||||
<< tracklength
|
||||
<< NC::FormattedColor::End(Config.statusbar_time_color);
|
||||
}
|
||||
break;
|
||||
case Design::Alternative:
|
||||
@@ -671,21 +682,36 @@ void Status::Changes::elapsedTime(bool update_elapsed)
|
||||
Format::print(Config.new_header_second_line, second, &np);
|
||||
|
||||
size_t first_len = wideLength(first.str());
|
||||
size_t first_margin = (std::max(tracklength.length()+1, VolumeState.length()))*2;
|
||||
size_t first_start = first_len < COLS-first_margin ? (COLS-first_len)/2 : tracklength.length()+1;
|
||||
|
||||
size_t first_margin = std::max(tracklength.length()+1, VolumeState.length())*2;
|
||||
size_t first_start = first_len < COLS-first_margin
|
||||
? (COLS-first_len)/2
|
||||
: tracklength.length()+1;
|
||||
size_t second_len = wideLength(second.str());
|
||||
size_t second_margin = (std::max(ps.length(), size_t(8))+1)*2;
|
||||
size_t second_start = second_len < COLS-second_margin ? (COLS-second_len)/2 : ps.length()+1;
|
||||
|
||||
size_t second_start = second_len < COLS-second_margin
|
||||
? (COLS-second_len)/2
|
||||
: ps.length()+1;
|
||||
if (!Global::SeekingInProgress)
|
||||
*wHeader << NC::XY(0, 0) << NC::TermManip::ClearToEOL << tracklength;
|
||||
*wHeader << NC::XY(first_start, 0);
|
||||
writeCyclicBuffer(first, *wHeader, first_line_scroll_begin, COLS-tracklength.length()-VolumeState.length()-1, L" ** ");
|
||||
*wHeader << NC::XY(0, 0)
|
||||
<< NC::TermManip::ClearToEOL
|
||||
<< Config.statusbar_time_color
|
||||
<< tracklength
|
||||
<< NC::FormattedColor::End(Config.statusbar_time_color);
|
||||
|
||||
*wHeader << NC::XY(0, 1) << NC::TermManip::ClearToEOL << NC::Format::Bold << ps << NC::Format::NoBold;
|
||||
*wHeader << NC::XY(second_start, 1);
|
||||
writeCyclicBuffer(second, *wHeader, second_line_scroll_begin, COLS-ps.length()-8-2, L" ** ");
|
||||
*wHeader << NC::XY(first_start, 0);
|
||||
|
||||
writeCyclicBuffer(first, *wHeader, first_line_scroll_begin,
|
||||
COLS-tracklength.length()-VolumeState.length()-1, L" ** ");
|
||||
|
||||
*wHeader << NC::XY(0, 1)
|
||||
<< NC::TermManip::ClearToEOL
|
||||
<< Config.player_state_color
|
||||
<< ps
|
||||
<< NC::FormattedColor::End(Config.player_state_color)
|
||||
<< NC::XY(second_start, 1);
|
||||
|
||||
writeCyclicBuffer(second, *wHeader, second_line_scroll_begin,
|
||||
COLS-ps.length()-8-2, L" ** ");
|
||||
|
||||
*wHeader << NC::XY(wHeader->getWidth()-VolumeState.length(), 0)
|
||||
<< Config.volume_color
|
||||
|
||||
Reference in New Issue
Block a user