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