From 74260bf5a9aed28217985f2cbc5258f2cb1082c2 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 1 Jan 2025 20:55:49 +0100 Subject: [PATCH] add option "show-server-address", disabled by default Closes https://github.com/MusicPlayerDaemon/ncmpc/issues/151 --- NEWS | 1 + doc/config.sample | 3 +++ doc/index.rst | 4 ++++ src/ConfigParser.cxx | 2 ++ src/Options.hxx | 1 + src/QueuePage.cxx | 2 +- 6 files changed, 12 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 0d253558..9bfe95ed 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,7 @@ ncmpc 0.52 - not yet released * fix searching on Help and Song page * fix scroll bug after resizing window * do not overwrite time/bitrate with song text in status bar +* add option "show-server-address", disabled by default * build: require Meson 1.0 ncmpc 0.51 - (2024-09-23) diff --git a/doc/config.sample b/doc/config.sample index ea130d0a..bf8d4ee4 100644 --- a/doc/config.sample +++ b/doc/config.sample @@ -69,6 +69,9 @@ ## Show a title bar at the top of the screen #show-title-bar = yes +## Show the server address at the top +#show-server-address = no + ## 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 a81abd41..b9584237 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -109,6 +109,10 @@ Interface :command:`show-title-bar = yes|no` - "no" allows hiding the title bar. +:command:`show-server-address = yes|no` - "yes" shows the server +address in the title bar. This is disabled by default because most +people use only one MPD instance. + :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 8abde7e1..dca870e4 100644 --- a/src/ConfigParser.cxx +++ b/src/ConfigParser.cxx @@ -594,6 +594,8 @@ parse_line(char *line) parse_key_definition(value); else if (StringIsEqualIgnoreCase("show-title-bar", name)) options.show_title_bar = str2bool(value); + else if (StringIsEqualIgnoreCase("show-server-address", name)) + options.show_server_address = 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 55b7d8d1..14acf70c 100644 --- a/src/Options.hxx +++ b/src/Options.hxx @@ -58,6 +58,7 @@ struct Options { #endif bool show_title_bar = true; + bool show_server_address = false; bool auto_center = false; diff --git a/src/QueuePage.cxx b/src/QueuePage.cxx index 86d3fb22..cd6494ea 100644 --- a/src/QueuePage.cxx +++ b/src/QueuePage.cxx @@ -368,7 +368,7 @@ QueuePage::OnClose() noexcept std::string_view QueuePage::GetTitle(std::span buffer) const noexcept { - if (connection_name.empty()) + if (connection_name.empty() || !options.show_server_address) return _("Queue"); return SPrintf(buffer, _("Queue on %s"), connection_name.c_str());