diff --git a/NEWS b/NEWS index 219c609b..727c1131 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,7 @@ ncmpc 0.50 - not yet released * build: require Meson 0.60 * require libfmt 9 * draw progress bar as Unicode double line +* add option to hide the title bar * add color style "text" for input text controls * remove option "text-editor-ask" * fix lyrics editor crash diff --git a/doc/config.sample b/doc/config.sample index 2764a625..ea130d0a 100644 --- a/doc/config.sample +++ b/doc/config.sample @@ -66,6 +66,9 @@ #lyrics-timeout = 60 ############## Display ###################### +## Show a title bar at the top of the screen +#show-title-bar = yes + ## Show a list of the screens in the top line. #welcome-screen-list = yes diff --git a/doc/index.rst b/doc/index.rst index a6997b65..a81abd41 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -107,6 +107,8 @@ is 5 seconds. Interface ^^^^^^^^^ +:command:`show-title-bar = yes|no` - "no" allows hiding the title bar. + :command:`enable-mouse = yes|no` - Enable mouse support (if enabled at compile time). :command:`screen-list = SCREEN1 SCREEN2...` - A list of screens to diff --git a/src/ConfigParser.cxx b/src/ConfigParser.cxx index 6e529a6d..8abde7e1 100644 --- a/src/ConfigParser.cxx +++ b/src/ConfigParser.cxx @@ -592,6 +592,8 @@ parse_line(char *line) /* key definition */ if (StringIsEqualIgnoreCase(CONF_KEY_DEFINITION, name)) parse_key_definition(value); + else if (StringIsEqualIgnoreCase("show-title-bar", name)) + options.show_title_bar = str2bool(value); /* enable colors */ else if(StringIsEqualIgnoreCase(CONF_ENABLE_COLORS, name)) #ifdef ENABLE_COLORS diff --git a/src/Options.hxx b/src/Options.hxx index f1bcb31d..55b7d8d1 100644 --- a/src/Options.hxx +++ b/src/Options.hxx @@ -57,6 +57,8 @@ struct Options { bool lyrics_show_plugin = false; #endif + bool show_title_bar = true; + bool auto_center = false; #ifndef NCMPC_MINI diff --git a/src/screen.cxx b/src/screen.cxx index ca874188..2b544de8 100644 --- a/src/screen.cxx +++ b/src/screen.cxx @@ -189,7 +189,8 @@ ScreenManager::Update(struct mpdclient &c, const DelayedSeek &seek) noexcept was_connected = now_connected; #endif - title_bar.Update(c.status); + if (options.show_title_bar) + title_bar.Update(c.status); unsigned elapsed; if (c.status == nullptr) diff --git a/src/screen_init.cxx b/src/screen_init.cxx index cc495bec..5faa0cc9 100644 --- a/src/screen_init.cxx +++ b/src/screen_init.cxx @@ -5,6 +5,7 @@ #include "QueuePage.hxx" #include "config.h" #include "Styles.hxx" +#include "Options.hxx" #include "page/Page.hxx" #include "dialogs/ModalDialog.hxx" #include "ui/Options.hxx" @@ -25,14 +26,18 @@ GetCorrectedScreenSize() noexcept struct ScreenManager::Layout { Size size; + Point main{0, 0}; static constexpr Point title{0, 0}; - static constexpr Point main{0, (int)TitleBar::GetHeight()}; static constexpr int progress_x = 0; static constexpr int status_x = 0; - constexpr explicit Layout(Size _size) noexcept - :size(_size) {} + explicit Layout(Size _size) noexcept + :size(_size) + { + if (options.show_title_bar) + main.y = TitleBar::GetHeight(); + } constexpr unsigned GetMainRows() const noexcept { return GetProgress().y - main.y; @@ -108,7 +113,8 @@ ScreenManager::OnResize() noexcept resizeterm(layout.size.height, layout.size.width); #endif - title_bar.OnResize(layout.size.width); + if (options.show_title_bar) + title_bar.OnResize(layout.size.width); /* main window */ main_window.Resize(layout.GetMainSize()); diff --git a/src/screen_paint.cxx b/src/screen_paint.cxx index 49705ed4..162ff55c 100644 --- a/src/screen_paint.cxx +++ b/src/screen_paint.cxx @@ -2,13 +2,16 @@ // Copyright The Music Player Daemon Project #include "screen.hxx" +#include "Options.hxx" #include "page/Page.hxx" #include "dialogs/ModalDialog.hxx" #include "ui/Options.hxx" -void +inline void ScreenManager::PaintTopWindow() noexcept { + assert(options.show_title_bar); + const auto title = GetCurrentPage().GetTitle({buf, buf_size}); title_bar.Paint(GetCurrentPageMeta(), title); } @@ -17,7 +20,8 @@ void ScreenManager::Paint() noexcept { /* update title/header window */ - PaintTopWindow(); + if (options.show_title_bar) + PaintTopWindow(); /* paint the bottom window */