1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-10-02 15:09:07 +00:00
Commit Graph

460 Commits

Author SHA1 Message Date
Phil Sutter
3cd87aadf8 fix for building with --disable-x11 2009-02-22 03:08:28 +01:00
Phil Sutter
90a3e8de80 merge tail and head into a single source file
This allows having the same init-function for both objects. Code size
could be further reduced, as the print-functions share some code, too.
2009-02-22 03:00:35 +01:00
Phil Sutter
20809f3198 put tail and head code into separate files
In fact these two objects share a lot of code, so the bigger plan is to
merge them into a single file to share equal code.

This should not change anything to the code flow, besides making conky
startup a bit more robust due to less use of CRIT_ERR.
2009-02-22 03:00:26 +01:00
Phil Sutter
77c59b260d merge ibm-acpi and smapi together
Well, not really. I don't dare putting it all together into a single
source file, as that would just not make sense. Instead, this patch
eliminates the --enable-smapi configure option and all related checks,
replacing them with the equivalents from --enable-ibm.
2009-02-22 02:58:42 +01:00
Phil Sutter
d500f1005a outsource ibm-acpi stuff into it's own source file
Despite this is actually not much code and could stay inside linux.c as
well, this makes sense as I want to combine smapi and ibm-acpi
functionality. Virtually every user of a notebook made by IBM/Lenovo
will want both, so this should be a feature not a bug.

Besides making the ibm-acpi objects being built optionally, this should
not change anything to the code flow.
2009-02-22 02:58:29 +01:00
Phil Sutter
65c27816c4 fix coding style of the last few patches
Also, note that free() does not zero the passed pointer. So conditional
freeing always needs to look like this:
| if (var) {
|     free(var);
|     var = 0;
| }
2009-02-22 02:54:44 +01:00
Brenden Matthews
f92978c5e5 No space between number and units please. 2009-02-17 22:50:43 -07:00
Nicolas Sierro
cf77d3f1f9 Extended support for local Maildir patch sf.net id #2561323 (thanks Nicolas). 2009-02-17 22:26:15 -07:00
Alexander Monakov
966a05a984 Fix diskio_read/write patch sf.net id #2493084 (thanks Alexander). 2009-02-17 22:04:38 -07:00
Kim Holviala
27bb931e41 Patch by Kim Holviala sf.net id #2484548.
* change the height of execbar and execibar to be the same as other
		bars have by default (6 pixels)
		* treat mixer values as percentages as they're usually 0-100 (switch
		to spaced_print() with pad_percents)
		* change temp_print() from snprintf() to spaced_print()
		* remove decimals from temp_print() as none of the current sources can
		supply values smaller than 1 degree (C or F, doesn't matter)
		* add a space between number and the unit in human_readable()
		* fix number printing in human_readable()
		* network $upspeed and $downspeed now use human_readable()
2009-02-17 22:00:23 -07:00
Swoög
b516e19440 Patch to add $battery_short variable. 2009-02-17 21:49:45 -07:00
Brenden Matthews
b4cd98868f Misc compilation fixes. 2009-02-17 21:45:06 -07:00
Nikolas Garofil
1085d2b27e out_to_x can now be turned off 2009-02-15 18:58:03 +01:00
Nikolas Garofil
65bae86ca7 append_file output method 2009-02-12 22:45:18 +01:00
Nikolas Garofil
3a11f1469f overwrite_file output method 2009-02-12 22:35:00 +01:00
Nikolas Garofil
4c25a9680e Added output_to_stderr 2009-02-10 09:43:20 +01:00
Brenden Matthews
c3003dc1a3 Fix my last 'fix'. 2009-02-09 12:36:10 -07:00
Brenden Matthews
850f7dfbc1 Fix warning on older versions of gcc. 2009-02-08 10:29:49 -07:00
Brenden Matthews
5b9d47c039 Couple fixes for the top_time stuff. 2009-02-08 10:13:54 -07:00
Alexander Graf
9da5648d2a better combine top, top_mem and top_time handlers 2009-02-08 17:19:10 +01:00
Alexander Graf
e6c9ff751c Also free process list when ${top_time} is used 2009-02-08 16:16:12 +01:00
Alexander Graf
9c679bf33f Add ${top_time} sorting processes by CPU time 2009-02-07 15:01:50 +01:00
mipas
cd49afbd19 Build fix patch
This patch fixes build errors on some platforms due to missing includes.
2008-12-22 20:59:42 -07:00
Phil Sutter
c54b96fb24 simplify declaration of ifblock objects
Like OBJ_THREAD, OBJ_IF automatically calls obj_be_ifblock_if() when the
object matches.
2008-12-22 19:43:12 +01:00
Phil Sutter
dd31cc77eb use a global struct moc_s
Since there is no choice of which moc player to get information from,
all moc objects' data source can be identical. Also hide some internal
data (the thread e.g.). Since from now on there can only be one moc
thread (not highlander ;), we don't need to treat the thread object
specially.

While here, fix indenting.
2008-12-22 19:36:24 +01:00
Phil Sutter
2f3fb23ff7 separate parsing and interpreting text objects for certain objects
All objects parsing text into objects formerly parsed and evaluated
their arguments each update interval. This does only make sense when the
parsed text could change between updates, which is the case for execp
and execpi objects, but none of the others. So have them parse the text
when creating them, so each update interval only the output has to be
re-extracted.

In fact, this should give a performance boost when using any of the
affected objects, as parsing the input text is quite expensive since
we're evaluating templates.
2008-12-22 18:36:44 +01:00
Phil Sutter
2de1840b39 move and add function prototypes to src/conky.c 2008-12-22 17:55:21 +01:00
Phil Sutter
da7bc63996 do not use a global ifblock stack
Using a global ifblock stack for all parsed ifblock objects causes
problems when doing sub-parsing in objects taking other objects as
parameters, because the possibly non-empty stack at startup leads to
false alarm when checking for stack emptiness after parsing the objects.

Use a void ** as the object to pass around, so callers don't need to
know struct ifblock_stack_obj.
2008-12-22 17:49:38 +01:00
Phil Sutter
05624868e3 treat mpd opjects as non-threaded
In fact, they are. But we don't want to treat them as those, because
the rewrite made the only situation when threaded objects matter
uncritical, i.e. when an object calls calling parse_conky_vars().
2008-12-20 16:17:22 +01:00
Phil Sutter
b31af01d91 add if_match object comparing strings, floats and ints
In general, argument types should match, but for combined long and
double usage the long is being converted to double before evaluation.

A few examples:
${if_match ${cpu} < 30}
${if_match "asdf" != "qwer"}
${if_match 0.5 < 0.50001}
${if_match 49.999 < 50}
2008-12-20 16:14:57 +01:00
Phil Sutter
1a35a68bca fix segfault for diskiograph
The crux is to split args between those for scan_graph() on one hand and
prepare_diskio_stat() on the other hand. To make the code working with
minimal changes, move the yet optional devicename to the end.

General note on graphs:
- for all graphs there exist the optional arguments for scan_graph()
  which come first and are optional (intended duplicate)
- all other args are object specific, and may be optional as well
2008-12-18 15:18:53 +01:00
Phil Sutter
757983ab56 internal rewrite of mpd support
Handle mpd internal information inside mpd.c. Use a refcounter to check
if the mpd-information can be freed (maybe useless). Remove the now
useless "full" flag of free_text_objects.
2008-12-18 13:40:21 +01:00
Itai Zukerman
bb817b2cf7 Patch to allow escaping newlines in the config. 2008-12-15 21:17:56 -07:00
Phil Sutter
d321573c2d simplify human_readable
The only change of behaviour occurs when adjusting the unit of positive
values. For some reason 1000LL was used, which has now been replaced by
1024LL. Usage of abs() and MAX() might be OS dependent, but it should
not be too hard to implement them by hand if they're missing somewhere.
2008-12-16 03:21:30 +01:00
Phil Sutter
d744f9bfbb make use_spacer an enum
It was a static int before, holding the (already defined) enum's value,
which doesn't make sense. Also it's used only inside conky.c. Since
enums can't be assigned other values than what are defined, we can skip
checking for illegal spacer value at each invocation of spaced_print,
and then also drop the function name argument, which apparently didn't
make sense at all, because use_spacer is a global option.
2008-12-16 02:56:26 +01:00
Phil Sutter
0720a4fbc9 simplify diskio stats
Instead of splitting information, use diskio_stats[0] in diskio.c for
the totals. This saves a few branches, and frees some data from struct
information.
2008-12-16 02:32:30 +01:00
Phil Sutter
9a85812e06 here comes the big header include rewrite
Some statics are now defined by configure.ac.in, conky.h got a lot
smaller, which I see as a positive sign.

This patch should not change any functionality, just change what's
defined where. Some features I did/could not test are probably broken,
also compiling for any other OS surely won't complete now. Though I
think fixing these problems is as easy as including some missing
headers.

I've done compile checks with the following configure options:
./configure --enable-eve --enable-rss --enable-smapi
	--enable-wlan --enable-debug --enable-testing

So what needs to be tested is:
- audacious
- BMPx
- xmms2
- nvidia
2008-12-15 23:12:33 +01:00
Phil Sutter
ec174bedf2 outsource ifblock and text_object helpers 2008-12-15 23:03:39 +01:00
Phil Sutter
ca66a26813 put text_object stuff into an own header
For now this is only the object type enum and struct text_object, but it
will do to prepare further outsourcing from both conky.c and conky.h.
2008-12-15 23:03:39 +01:00
Phil Sutter
fb4b8fd005 organise text objects in a linked list
In fact, this eases code a lot. Even the ifblock handling, which was the
biggest problem of the rewrite, could be cleaned up a lot.
2008-12-15 23:03:39 +01:00
Phil Sutter
62a6c0cbac have a maximum width for all variable length mpd vars
Thanks to FreakGuard (IRC) preparing this one.
2008-12-15 19:40:54 +01:00
Phil Sutter
0f7ac0f5af simplify free_text_objects a bit 2008-12-15 19:40:45 +01:00
Phil Sutter
a98d6e06ac simplify if_existing evaluation 2008-12-15 19:40:37 +01:00
Phil Sutter
334447308f enable DEV_NAME to handle symlinks
Using a macro is not possible anymore, so have a function dev_name() do
the job. Functionality is the same as the old DEV_NAME, unless the
specified path is a symlink in which case it's being dereferenced first.

To save callers from having to free the returned string, a static local
buffer is used (effectively rendering the function non-reentrant).
2008-12-14 17:53:31 +01:00
Phil Sutter
1ddb6a88b9 use the builtin config also as a default one
This depends on fopencookie, which is linux-specific. For BSD, there is
a similar function called funopen, which can be used as a drop-in
replacement.
2008-12-14 15:45:30 +01:00
Brenden Matthews
0a5942a94b Move imap/pop3 stuff into mail.c 2008-12-14 04:22:36 +01:00
Phil Sutter
7a6ce89226 implement sample config printing support
This patch makes Conky print a sample config when being called with the
'-C' flag.

A short test showed an increase of ~10kbytes of the conky binary's size.
2008-12-12 15:38:01 +01:00
Phil Sutter
19a6e7c925 rewrite tcp-portmon hooks
Global variables belonging to tcp-portmon are now separated from
conky.c, cleaning up struct information and struct text_object a bit.
2008-12-11 15:28:21 +01:00
Phil Sutter
f96e77c91b rewrite template engine completely
Two things that pissed me off about the old one:
* only limited support for nesting templates
* totally broken output when using conditionals inside a template

The later one was the hard one to fix. ;)
It requires to already have the full text substituted before the text
objects are being created from it. Generating only the contained objects
broke, because the conditionals got wrong offsets to jump to.

After that was fixed, full nesting support is realised by simply
repeating the replacement until no more template objects are found.
2008-12-11 15:28:21 +01:00
Brenden Matthews
dc3ed8df13 Removing old svn keywords. 2008-12-09 16:35:49 -07:00