1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-12-27 04:32:55 +00:00

Merge pull request #72 from steelman/xdg-config-path

Read configuration from ~/.config/conky/conky.conf
This commit is contained in:
Brenden Matthews 2014-11-21 15:08:14 -08:00
commit c35c8520ba
7 changed files with 21 additions and 11 deletions

View File

@ -58,6 +58,7 @@ set(SYSTEM_CONFIG_FILE "/etc/conky/conky.conf" CACHE STRING "Default system-wide
# use FORCE below to make sure this changes when CMAKE_INSTALL_PREFIX is modified
set(PACKAGE_LIBRARY_DIR "${CMAKE_INSTALL_PREFIX}/lib/conky" CACHE STRING "Package library path (where Lua bindings are installed" FORCE)
set(DEFAULTNETDEV "eth0" CACHE STRING "Default networkdevice")
set(XDG_CONFIG_FILE "$HOME/.config/conky/conky.conf" CACHE STRING "Configfile of the user (XDG)")
set(CONFIG_FILE "$HOME/.conkyrc" CACHE STRING "Configfile of the user")
set(MAX_USER_TEXT_DEFAULT "16384" CACHE STRING "Default maximum size of config TEXT buffer, i.e. below TEXT line.")
set(DEFAULT_TEXT_BUFFER_SIZE "256" CACHE STRING "Default size used for temporary, static text buffers")

View File

@ -14,6 +14,7 @@
#define SYSTEM_CONFIG_FILE "@SYSTEM_CONFIG_FILE@"
#define PACKAGE_LIBDIR "@PACKAGE_LIBRARY_DIR@"
#define DEFAULTNETDEV "@DEFAULTNETDEV@"
#define XDG_CONFIG_FILE "@XDG_CONFIG_FILE@"
#define CONFIG_FILE "@CONFIG_FILE@"
#define LOCALE_DIR "@LOCALE_DIR@"
#define MAX_USER_TEXT_DEFAULT @MAX_USER_TEXT_DEFAULT@

View File

@ -56,7 +56,7 @@
</command>
<option>FILE</option>
</term>
<listitem>Config file to load instead of $HOME/.conkyrc
<listitem>Config file to load instead of $HOME/.config/conky/conky.conf
<para></para></listitem>
</varlistentry>
<varlistentry>

View File

@ -7,7 +7,7 @@
<xsl:template match="/">
<html>
<head>
<title>~/.conkyrc settings</title>
<title>~/.config/conky/conky.conf settings</title>
</head>
<body bgcolor="#FFFFFF">
<xsl:apply-templates />

View File

@ -94,11 +94,12 @@ Once you have an idea of how Conky looks, you can now move on to configuring it!
<body>
<p>
By default, Conky will look for a configuration file in the users home directory located at <path>~/.conkyrc</path> This file contains all the configuration options, and the static text, colors and other variables which control what data is shown to the user. Conky also provides a great sample configuration, located at <path>/usr/share/doc/conky-version/Conkyrc.sample.gz</path> Make sure to replace "version" with the specific version of Conky you have installed.
By default, Conky will look for a configuration file in the users home directory located at <path>~/.config/conky/conky.conf</path> This file contains all the configuration options, and the static text, colors and other variables which control what data is shown to the user. Conky also provides a great sample configuration, located at <path>/usr/share/doc/conky-version/Conkyrc.sample.gz</path> Make sure to replace "version" with the specific version of Conky you have installed.
</p>
<pre caption="Copying the sample configuration to your home directory">
$ <i>zcat /usr/share/conky-1.6.0/conkyrc.sample.gz >> ~/.conkyrc</i>
$ <i>mkdir -p ~/.config/conky</i>
$ <i>zcat /usr/share/conky-1.6.0/conkyrc.sample.gz >> ~/.config/conky/conky.conf</i>
</pre>
<note>

View File

@ -144,7 +144,7 @@
the more you try to make Conky do, the more resources it is
going to consume.
</para>
<para>An easy way to force Conky to reload your ~/.conkyrc:
<para>An easy way to force Conky to reload your ~/.config/conky/conky.conf:
"killall -SIGUSR1 conky". Saves you the trouble of having
to kill and then restart. You can now also do the same with
SIGHUP.
@ -159,12 +159,12 @@
</refsect1>
<refsect1>
<title>Configuration Settings</title>
<para>Default configuration file location is $HOME/.conkyrc or
<para>Default configuration file location is $HOME/.config/conky/conky.conf or
${sysconfdir}/conky/conky.conf. On most systems, sysconfdir is
/etc, and you can find the sample config file there
(/etc/conky/conky.conf).
</para>
<para>You might want to copy it to $HOME/.conkyrc and then
<para>You might want to copy it to $HOME/.config/conky/conky.conf and then
start modifying it. Other configs can be found at
http://conky.sf.net/
</para>
@ -241,11 +241,11 @@
<varlistentry>
<term>
<varname>conky</varname>
<option>-C &gt; ~/.conkyrc</option>
<option>-C &gt; ~/.config/conky/conky.conf</option>
</term>
<listitem>Do not start Conky, but have it output
the builtin default config file to ~/.conkyrc for
later customising.</listitem>
the builtin default config file to
~/.config/conky/conky.conf for later customising.</listitem>
</varlistentry>
</variablelist>
</refsect1>
@ -263,7 +263,7 @@
</varlistentry>
<varlistentry>
<term>
<filename>~/.conkyrc</filename>
<filename>~/.config/conky/rc</filename>
</term>
<listitem>Default personal configuration
file.</listitem>

View File

@ -2826,6 +2826,13 @@ void set_current_config() {
/* load current_config, CONFIG_FILE or SYSTEM_CONFIG_FILE */
struct stat s;
if (current_config.empty()) {
/* Try to use personal config file first */
std::string buf = to_real_path(XDG_CONFIG_FILE);
if (stat(buf.c_str(), &s) == 0)
current_config = buf;
}
if (current_config.empty()) {
/* Try to use personal config file first */
std::string buf = to_real_path(CONFIG_FILE);