1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-11-17 18:45:10 +00:00
Commit Graph

2315 Commits

Author SHA1 Message Date
mxmlnkn
8ccadeb7bb solve double counting at start issue 2016-02-21 10:34:46 +01:00
Brenden Matthews
fdb8523d26 Merge pull request #198 from marius/master
Use the canonical source for the number of CPUs.
2016-01-10 14:05:37 -08:00
Marius Nuennerich
98c4100b66 Use the canonical source for the number of CPUs.
Counting cpu\d lines from /proc/stat can give the wrong number if CPUs
are present but offline.
2016-01-10 16:13:50 +00:00
Marc Payne
57d9fdd0e0 Comment some of the callback-related code
Some of the code dealing with callbacks and updates was a little
obscure. A few extra comments should help clarify the meaning.
2016-01-09 10:23:36 -07:00
Marc Payne
adae1f6293 Refactor the exec callback system
The main purpose of this commit is to ensure that exec callbacks are
registered at startup (or config reload), so that they have a chance to
run on the first update interval. Much of the code in exec.cc got
consolidated, making it easier to follow. Several checks for NULL
pointers should eliminate some obscure segfaults I noticed, as well.

During the refactoring, I implemented height and width arguments for
execbar and execgauge. The functionality was already there, but wasn't
being used. All this is accompanied by updates to the man page and
plenty of code comments.
2016-01-09 10:19:48 -07:00
Brenden Matthews
2fab2d3820 Merge pull request #185 from mxmlnkn/issue-128
Fix BUILD_MATH flag not working, partial #128
2015-12-11 12:56:58 -08:00
Brenden Matthews
39e0c1db13 Merge pull request #181 from fonic/patch-1
Rewrite/enhancement of nvidia module
2015-12-11 12:55:17 -08:00
mxmlnkn
e7cdccd964 Border cases of scale < 1 would lead to negative lengths, crashing conky
e.g. in the beginning the scale is always 0, leading to NaN and a crash
fixes the "show_graph_scale" not working bug, not yet reported (even though I actually noticed that before, didn't seem to bother me)
also cpugauge works again because fo this BUILD_MATH MATH problem
2015-12-11 11:10:23 +01:00
mxmlnkn
a85ffd5d0d logscale not working was caused by using MATH instead of BUILD_MATH 2015-12-11 01:39:59 +01:00
mxmlnkn
d8f75860b2 Fix for initial spike on program start plus documentation as much as needed to implement that fix
Also some end of line white spaces were automatically removed by SciTE.
2015-12-10 21:46:44 +01:00
fonic
22fe3b1ea4 Rewrite/enhancement of nvidia module
Rewritten nvidia module with new features (refer to Showcase comment). Still work in progress, but could already use some testing by others.
2015-12-09 18:38:20 +01:00
Franc[e]sco
162d9d13b7 added support for multiple xinerama heads (fixes issue #172) 2015-12-01 13:53:43 +01:00
Brian De Wolf
01301f31a3 lock mpd result before modifying it
Add a lock to the mpd work callback to prevent another thread from reading the
struct while we're writing to it.
2015-11-08 21:29:29 -08:00
Brenden Matthews
7ae6b00f30 Merge pull request #160 from bldewolf/cppcheck-fix
Expand several buffers identified by cppcheck
2015-11-07 09:32:07 -08:00
Brenden Matthews
966b744349 Merge pull request #141 from marcpayne/template-segfault
Avoid segfault if template arg number is zero
2015-11-07 09:28:52 -08:00
Brian De Wolf
1dd6a47c24 Expand several buffers identified by cppcheck
I ran cppcheck on a whim while trying to debug #103 and it found these possible
memory corruptions. They all seem to be buffers that were made one byte too
small (leaving out the byte for the C-string null terminator).
2015-11-01 19:37:24 -08:00
Marc Payne
c7108d8261 Avoid segfault if template arg number is zero
If the user enters \0 as a template argument, print a warning and exit
gracefully. Fixes an issue mentioned in #118.
2015-08-29 14:15:52 -06:00
Marc Payne
8f88961c74 Do not try to remove kdeinit: from process name
When we parse /proc/<pid>/* in order to populate the process struct, it isn't
necessary to try to remove any instance of "kdeinit: " anymore (IMO). Here is
why:

* If the user chooses to display full command lines (top_name_verbose = true),
  then we should show full command lines without stripping useful info.

* The new basename entry already has a stripped down command. For example, if
  the command line is "kdeinit4: kded4 [kdeinit]", then basename is "kded4".

* The code does not account for "kdeinit{4,5}: ", resulting in undesired
  behavior, e.g. "kdeinit4: kded4 [kdeinit]" becomes "kdeinit4:".

* The code does not account for NUL separated arguments.

* The code opens /proc/<pid>/cmdline a second time, so this commit is a minor
  optimization.

I think it is best to remove this code altogether. If anyone disagrees, please
comment or send me some hate mail with reasons why we should keep it. The commit
is easy enough to revert. :)
2015-08-26 18:25:39 -06:00
Marc Payne
03a5cc5047 Add basename support to top
The new top_name_verbose option works in most cases, but it will fail if the
executable name contains spaces. Trying to parse command lines from
/proc/<pid>/* turned out to be quite complex due to the many edge cases. My
solution, once again, is to fall back to 1.9.x behavior. If top_name_verbose is
true, use the full command line. Otherwise, use basename.

Fixes #131.
2015-08-26 11:59:26 -06:00
Marc Payne
99ffe6a0d6 Add basename support to if_running
Currently, in order to match a running process with ${if_running}, a user needs
to specify the full command line plus arguments in conky.conf. This commit keeps
that behavior and adds a fallback that is equivalent to the 1.9.x bevahior,
namely matching against the executable name contained in /proc/<pid>/stat.

This completes the fix for #121.
2015-08-26 11:57:38 -06:00
Marc Payne
d8ff24a6f0 Add support for basenames (short executable names)
Since we now store a full command line for each process, a few problems are
apparent. For example, the names displayed by ${top ...} are verbose. This has
been partially addressed by the top_name_verbose option, but it is broken
whenever an executable name contains spaces. Another example is ${if_running},
which only matches the input if it exactly matches the entire command line.

This commit adds a basename (i.e. executable filename) entry to the process
struct. The intention is to store the executable filename from /proc/<pid>/stat,
which was the old 1.9.x behavior. This way, we have the best of both worlds.
Those who like the full command line can have it, and those who prefer the old
way can be satisfied too.
2015-08-26 11:16:20 -06:00
Marc Payne
2a778374a5 Do not add trailing whitespace to proc cmdline
According to proc(5), /proc/<pid>/cmdline is supposed to have a NUL between each
argument, plus an additional NUL at the end. Instead of replacing each NUL with
a space, just replace the ones between arguments and ignore the rest.

Partial fix for #121.
2015-08-26 00:50:08 -06:00
Marc Payne
a061bcff3e Minor code formatting and whitespace cleanup 2015-08-26 00:03:43 -06:00
Brenden Matthews
b3c95959bc Merge pull request #137 from marcpayne/lua53-compile-fix
Fix compile error with Lua 5.3
2015-08-24 08:09:00 -07:00
Marc Payne
acd1c05d74 Fix compile error with Lua 5.3
lua_gettable returns an int instead of void in Lua 5.3, so provide a
backwards-compatible overload of safe_misc_trampoline to account for this.
Tested with Lua 5.2 and 5.3.

This change does not address other compilation issues related to Lua bindings
for cairo, imlib2, and rsvg.

Fixes #90 and part of #100.
2015-08-21 01:56:37 -06:00
Nelis Oostens
0ab7d5fa33 Fixed Curl header issue
Note: This may not be the correct solution, it depends on the author's intention. Maybe he wanted to keep the headers from the previous call (in other words if there are no new headers use the old ones) and didn't realize they weren't copied in the handle, in which case he'll have to save the headers instead of above.
2015-08-19 22:04:42 +02:00
Nelis Oostens
fc6888eee3 Added sanity check to avoid making 0x0 window 2015-07-31 08:22:20 +02:00
Brenden Matthews
89c7da5654 Merge pull request #122 from Nooby4Ever/master
Added missing build flags to the print_version function
2015-07-30 16:01:35 -07:00
Brenden Matthews
7044c5296d Merge pull request #120 from ncopa/master
Compatibility improvements
2015-07-30 16:00:51 -07:00
Brenden Matthews
98d3491ddb Merge pull request #119 from marcpayne/getglobal-fix
Ensure getglobal pushes only one value onto stack
2015-07-30 16:00:01 -07:00
Brenden Matthews
9f6d727831 Merge pull request #115 from marcpayne/top-name-verbose
Add top_name_verbose option
2015-07-30 15:59:16 -07:00
Nelis Oostens
8bf8859c73 Added missing build flags to the print_version function
Added:
BUILD_ICAL
BUILD_ICONV
BUILD_MYSQL
BUILD_LUA_RSVG
BUILD_XSHAPE
2015-07-24 16:42:47 +00:00
Natanael Copa
0956b689ec Fix thread local on pre C++11 compilers 2015-07-23 16:36:00 +02:00
Natanael Copa
476f84cf59 Use portable version of strerror_r
There are 2 variants of strerror_r, GNU extension and a POSIX variant.
Use the more portable POSIX variant.

Also fix a potensial stack-use-after-return bug, instead of relying on
undefined behavoir in GNU libc implementation. The strerror_r manpage
says:

> This may be either a pointer to a string that the function stores in
> buf, or a pointer to some (immutable) static string (in which case buf
> is unused).

So it does not guarantee that it returns a pointer to some (immutable)
static string. It might return a pointer to "buf", in which case we get
a stack-use-after-return bug.

We fix this by declaring a thread local static buffer which we always
return.
2015-07-23 16:07:34 +02:00
Natanael Copa
98b063866f Remove use of sysctl.h
The sysctl.h is not specified in POSIX. This fixes building with musl
libc.
2015-07-23 16:06:42 +02:00
Marc Payne
11ec010561 Ensure getglobal pushes only one value onto stack
Currently, state::getglobal pushes two values onto the stack: the global
environment and the requested global. For example, if you call
getglobal("conky"), the stack ends up with the following:

| ... global, conky |

The function config_setting_base::lua_set in setting.cc does not take this
behavior into account, resulting in #97.

To correct this, call replace(-2) at the end of state::getglobal where
LUA_VERSION_NUM >= 502.
2015-07-22 17:16:26 -06:00
Marc Payne
06722e4a2a Add top_name_verbose option
Since commit 749083a, the output of ${top name <num>} contains the full
command line of each process, including arguments. While this feature can
be very useful, it changes the default behavior of Conky.

The present commit adds a new top_name_verbose option that allows the user
to toggle between basenames with no arguments (the old behavior) and full
command lines with arguments. To remain consistent with past versions of
Conky, the default value of top_name_verbose is false.

Fixes #113 (https://github.com/brndnmtthws/conky/issues/113).
2015-07-20 17:27:45 -06:00
rtoijala
f1a3542734 call get_cpu_count() when needed
get_cpu_count() is not called before trying to use cpus so conky exits with

conky: obj->data.i 1 info.cpu_count 0
conky: attempting to use more CPUs than you have!

Fixes issue #93.
2015-07-10 12:22:18 +03:00
Brenden Matthews
9ac60dcc15 Merge pull request #108 from marcpayne/noipv6-segfault-fix
Close file only if it was successfully opened
2015-07-07 15:59:10 -07:00
Marc Payne
ee08a9e1b0 Close file only if it was successfully opened
If BUILD_IPV6=ON (default), but the user has disabled ipv6 support
in the kernel using the parameter ipv6.disable=1, then conky fails
to open /proc/net/if_inet6. This leads to a segfault when conky
calls fclose(file) regardless. This fix simply moves the fclose call
into the preceding if statement.
2015-07-06 02:51:43 -06:00
Steven Allen
0aa790baac Correctly shorten unknown. 2015-07-02 11:09:50 -04:00
Steven Allen
54a5cb8cbb If we're on AC, there is no battery.
Again, no point in having two ways to say the same thing.
2015-07-02 11:09:24 -04:00
Steven Allen
8852c0083c No point in having two ways to say charged.
replace full with charged.
2015-07-02 11:02:30 -04:00
Troy C
9fd4090a07 Fix segfault on invalid label 2015-02-28 23:03:37 -06:00
Troy C
345d62a555 Search device labels for diskio 2015-02-19 13:42:50 -06:00
Łukasz Stelmach
00481ee9a9 Read configuration from ~/.config/conky/conky.conf
Try to load configuration from ~/.config/conky/conky.conf before
falling back to ~/.conkyrc and /etc/conky/conky.conf.
2014-11-17 22:06:27 +01:00
Andrew Deason
b9dba46fb3 Enable X11 backing store
In our XCreateWindow call, we always set the backing_store attribute
to 'Always'. But since we never add the CWBackingStore to our value
mask, the backing_store setting always gets set to the default
NotUseful. This means that the backing store is never turned on, and
so when unobscuring the conky window, portions of the display will not
be drawn immediately if conky is blocked doing something else (e.g.
network, disk, the process is stopped), which is really annoying.

To fix this, specify the CWBackingStore flag in our value mask, so the
conky data is always visible, even if conky is blocking on some other
operation.
2014-10-25 19:34:25 -05:00
Andrew Deason
cd95b659c7 Consolidate common X11 XSetWindowAttributes flags
We always specify CWOverrideRedirect. So just assign that to flags
once, instead of assigning it to flags in four different cases.
2014-10-25 19:33:19 -05:00
Denis Gorodnichev
442f78119c add support for x11 shape extension
x11 shape extension (version >= 1.1) provide ability to set up input region
set up empty input region for undecorated window to create transparent window for mouse events
2014-09-09 11:12:44 +04:00
CTK
3e85698458 Fix size of the reported "buffers/cache" memory.
It now reports only reclaimable memory, by excluding shared memory,
and including the reclaimable part of the SLAB cache.

So '$mem' with 'no_buffers yes' is now the "really used" (unreclaimable) memory.
And when reaching OOM conditions, conky will always report high memory usage.

Related post:
http://calimeroteknik.free.fr/blag/?article20/really-used-memory-on-gnu-linux
2014-06-19 23:24:19 +02:00