Prefer `$XDG_CONFIG_HOME/ncmpcpp` as a folder with configuration

master
Andrzej Rybczak 5 years ago
parent 451856afd3
commit 31798fd1c7
  1. 1
      CHANGELOG.md
  2. 4
      doc/bindings
  3. 11
      doc/config
  4. 13
      doc/ncmpcpp.1
  5. 8
      src/configuration.cpp
  6. 2
      src/ncmpcpp.cpp
  7. 2
      src/settings.cpp

@ -29,6 +29,7 @@
* Deprecate `visualizer_sync_interval` configuration option.
* Deprecate `noop` value of `browser_sort_mode` in favor of `none`.
* Add `type` value of `browser_sort_mode` (set by default).
* Prefer `$XDG_CONFIG_HOME/ncmpcpp` as a folder with configuration.
# ncmpcpp-0.8.2 (2018-04-11)
* Help screen: fixed display of EoF keycode

@ -1,7 +1,7 @@
##############################################################
## This is the example bindings file. Copy it to ##
## ~/.ncmpcpp/bindings or $XDG_CONFIG_HOME/ncmpcpp/bindings ##
## and set up your preferences ##
## $XDG_CONFIG_HOME/ncmpcpp/bindings or ~/.ncmpcpp/bindings ##
## and set up your preferences. ##
##############################################################
##
##### General rules #####

@ -1,7 +1,8 @@
##############################################################################
## This is the example configuration file. Copy it to $HOME/.ncmpcpp/config ##
## or $XDG_CONFIG_HOME/ncmpcpp/config and set up your preferences. ##
##############################################################################
##############################################################
## This is an example configuration file. Copy it to ##
## $XDG_CONFIG_HOME/ncmpcpp/config or $HOME/.ncmpcpp/config ##
## and set up your preferences. ##
##############################################################
#
##### directories ######
##
@ -11,7 +12,7 @@
## ncmpcpp.
##
#
#ncmpcpp_directory = ~/.ncmpcpp
#ncmpcpp_directory = ~/.config/ncmpcpp
#
##
## Directory for storing downloaded lyrics. It defaults to ~/.lyrics since other

@ -45,7 +45,12 @@ Display help.
Display version information.
.SH "CONFIGURATION"
When ncmpcpp starts, it tries to read user's settings from $HOME/.ncmpcpp/config and $XDG_CONFIG_HOME/ncmpcpp/config files. If no configuration is found, ncmpcpp uses its default configuration. An example configuration file containing all default values is provided with ncmpcpp and can be usually found in /usr/share/doc/ncmpcpp (exact location may depend on used distribution or configure prefix).
When ncmpcpp starts, it tries to read settings from
$XDG_CONFIG_HOME/ncmpcpp/config and $HOME/.ncmpcpp/config files. If no
configuration is found, ncmpcpp uses its default configuration. An example
configuration file containing all default values is provided with ncmpcpp and
can be usually found in /usr/share/doc/ncmpcpp (the exact location may depend on
your operating system or configure prefix).
Note: Configuration option values can either be enclosed in quotation marks or not.
- If they are enclosed, the leftmost and the rightmost quotation marks are treated as delimiters, therefore it is not necessary to escape quotation marks you use within the value itself.
@ -442,7 +447,11 @@ Border color of pop-up windows. If set to 'none', no border will be shown.
Color of active window's border.
.TP
.SH "BINDINGS"
When ncmpcpp starts, it tries to read user's bindings from ~/.ncmpcpp/bindings and $XDG_CONFIG_HOME/ncmpcpp/bindings files. If no bindings file is found, ncmpcpp uses the defaults. An example bindings file with the default values can be found usually in /usr/share/doc/ncmpcpp (exact location may depend on used distribution or configure prefix).
When ncmpcpp starts, it tries to read bindings from
$XDG_CONFIG_HOME/ncmpcpp/bindings and ~/.ncmpcpp/bindings files. If no bindings
file is found, ncmpcpp uses the defaults. An example bindings file with default
values can be found usually in /usr/share/doc/ncmpcpp (the exact location may
depend on your operating system or configure prefix).
You can view current keybindings by pressing F1.
.SH "SONG FORMAT"

@ -74,13 +74,13 @@ void expand_home(std::string &path)
bool configure(int argc, char **argv)
{
const std::vector<std::string> default_config_paths = {
"~/.ncmpcpp/config",
xdg_config_home() + "ncmpcpp/config"
xdg_config_home() + "ncmpcpp/config",
"~/.ncmpcpp/config"
};
const std::vector<std::string> default_bindings_paths = {
"~/.ncmpcpp/bindings",
xdg_config_home() + "ncmpcpp/bindings"
xdg_config_home() + "ncmpcpp/bindings",
"~/.ncmpcpp/bindings"
};
std::vector<std::string> bindings_paths;

@ -103,7 +103,7 @@ int main(int argc, char **argv)
// always execute these commands, even if ncmpcpp use exit function
atexit(do_at_exit);
// redirect std::cerr output to ~/.ncmpcpp/error.log file
// redirect std::cerr output to the error.log file
errorlog.open((Config.ncmpcpp_directory + "error.log").c_str(), std::ios::app);
cerr_buffer = std::cerr.rdbuf();
std::cerr.rdbuf(errorlog.rdbuf());

@ -235,7 +235,7 @@ bool Configuration::read(const std::vector<std::string> &config_paths, bool igno
});
// keep the same order of variables as in configuration file
p.add("ncmpcpp_directory", &ncmpcpp_directory, "~/.ncmpcpp/", adjust_directory);
p.add("ncmpcpp_directory", &ncmpcpp_directory, "~/.config/ncmpcpp/", adjust_directory);
p.add("lyrics_directory", &lyrics_directory, "~/.lyrics/", adjust_directory);
p.add<void>("mpd_host", nullptr, "localhost", [](std::string host) {
expand_home(host);

Loading…
Cancel
Save