Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions src/screens/clock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const size_t Clock::Height = 8;
Clock::Clock()
{
Width = Config.clock_display_seconds ? 60 : 40;

m_pane = NC::Window(0, MainStartY, COLS, MainHeight, "", Config.main_color, NC::Border());
w = NC::Window((COLS-Width)/2, (MainHeight-Height)/2+MainStartY, Width, Height-1, "", Config.main_color, Config.main_color);
}
Expand All @@ -65,12 +65,12 @@ void Clock::resize()
{
size_t x_offset, width;
getWindowResizeParams(x_offset, width);

// used for clearing area out of clock window while resizing terminal
m_pane.resize(width, MainHeight);
m_pane.moveTo(x_offset, MainStartY);
m_pane.refresh();

if (Width <= width && Height <= MainHeight)
w.moveTo(x_offset+(width-Width)/2, MainStartY+(MainHeight-Height)/2);
}
Expand Down Expand Up @@ -104,7 +104,7 @@ void Clock::update()
{
using Global::myLockedScreen;
using Global::myInactiveScreen;

if (myLockedScreen)
{
if (myInactiveScreen != myLockedScreen)
Expand All @@ -114,9 +114,9 @@ void Clock::update()
else
myPlaylist->switchTo();
}

auto time = boost::posix_time::to_tm(Global::Timer);

mask = 0;
Set(time.tm_sec % 10, 0);
Set(time.tm_sec / 10, 4);
Expand All @@ -126,14 +126,14 @@ void Clock::update()
Set(time.tm_hour / 10, 24);
Set(10, 7);
Set(10, 17);

char buf[64];
std::strftime(buf, 64, "%x", &time);
std::strftime(buf, 64, Config.clock_time_format.c_str(), &time);
color_set(Config.main_color.pairNumber(), nullptr);
mvprintw(w.getStarty()+w.getHeight(), w.getStartX()+(w.getWidth()-strlen(buf))/2, "%s", buf);
standend();
refresh();

for (int k = 0; k < 6; ++k)
{
newer[k] = (newer[k] & ~mask) | (next[k] & mask);
Expand Down
1 change: 1 addition & 0 deletions src/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,7 @@ bool Configuration::read(const std::vector<std::string> &config_paths, bool igno
p.add("ask_before_shuffling_playlists", &ask_before_shuffling_playlists,
"yes", yes_no);
p.add("clock_display_seconds", &clock_display_seconds, "no", yes_no);
p.add("clock_time_format", &clock_time_format, "+x");
p.add("display_volume_level", &display_volume_level, "yes", yes_no);
p.add("display_bitrate", &display_bitrate, "no", yes_no);
p.add("display_remaining_time", &display_remaining_time, "no", yes_no);
Expand Down
1 change: 1 addition & 0 deletions src/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ struct Configuration

std::string ncmpcpp_directory;
std::string lyrics_directory;
std::string clock_time_format;

std::string mpd_music_dir;
std::string visualizer_fifo_path;
Expand Down