1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-09-30 05:59:07 +00:00
Commit Graph

2497 Commits

Author SHA1 Message Date
Brenden Matthews
a3b7905df6
Add new text objects to retrieve the currently used keyboard layout and mouse speed in percentage and generate random password of chosen length and get the cpu clock speed from assembly (#550)
* Add new text object to capitalize the first character of each word

* Fix for issue https://github.com/brndnmtthws/conky/issues/46

* Fix for issue https://github.com/brndnmtthws/conky/issues/35

* Fix for issue https://github.com/brndnmtthws/conky/issues/35

* Fix for https://github.com/brndnmtthws/conky/issues/206

* Fix for https://github.com/brndnmtthws/conky/issues/474

* Add new "temp2" variable to print the temperature in floating number

* Make the "temp2" variable static and add some explanation above it

* openbsd.cc: Add one more formal parameter to "temp_print()"

* extras/convert.lua: change url to wiki page (#554)
2018-08-04 15:01:28 -04:00
Brenden Matthews
fb70a9022d
Fix segfault with no update, debug logging. (#551)
* Fix segfault caused by initiliazed deref.

This fixes #117.

* Revert debug logging changes from a9e968956d.

* Replace not with !.
2018-08-03 12:22:11 -04:00
su8
7bca0ca881 Fix issues #439, #303 (#545)
* Fix issues https://github.com/brndnmtthws/conky/issues/439 , https://github.com/brndnmtthws/conky/issues/303

* core.cc: Add missing header file

* core.cc: Check if we build for x11 and add the locks functions

* read_tcpip.cc: Fix for https://github.com/brndnmtthws/conky/issues/306

* read_tcpip.cc: Missing string format specifier for "snprintf()"

* read_tcpip.cc: Wrong signed int format specifier for "snprintf()"

* Missing many string format specifiers to "snprintf()"
2018-08-02 11:15:16 -04:00
Brenden Matthews
71cfbff645
Fix sleep calculation for >1s sleeps. (#543)
The second portion of the time was being discarded, with only the nanos being
respected. This should fix #539.
2018-08-02 11:05:47 -04:00
su8
fa5e56720f conky.cc: Fix for https://github.com/brndnmtthws/conky/issues/352 (#540) 2018-07-30 08:57:42 -04:00
Brenden Matthews
10621e61b1
Conky for mac os master (#532)
* Documentation fixes for macOS

This commit fixes documentation of a macOS specific variable (sip_status) as promised in #480.

Also, fix some identation problems in darwin.cc

* Amend #18 by polling less often! This will help lower CPU usage, too!
2018-07-04 15:32:54 -04:00
Brenden Matthews
623fb83379
Fix for $exec regression introduced by 4b92556f. (#514)
This resolves #510.
2018-05-24 20:24:09 -04:00
Evan
da47868d1e Add cat and catp variables. (#507) 2018-05-19 10:27:10 -04:00
Brenden Matthews
4e2dd6348e
Fix a couple more string functions. (#505) 2018-05-13 18:59:39 -04:00
Brenden Matthews
5b541b4609
Switch to safe versions of string functions. (#504) 2018-05-13 18:46:09 -04:00
Brenden Matthews
76f24cb626
More sonar fixes (#502)
* Replace a bunch of strcpy()s with strncpy().

* Fix uninitialized var.

* Replace more strcpy()s with strncpy().
2018-05-13 14:27:58 -04:00
Brenden Matthews
9aed9c016f
Code smell fixes. 2018-05-13 14:20:39 -04:00
Brenden Matthews
4e48624cdf
Sonar fixes for eve. (#501) 2018-05-13 13:56:52 -04:00
Brenden Matthews
87a0718ca0
More bug fixes from sonar. (#500) 2018-05-13 13:50:46 -04:00
Brenden Matthews
b9121daa89
Build improvements (external libs, enable more options). (#498)
- Enable build options by default if they don't require external libraries.
 - Add as many external libraries to Docker and Travis builds as possible.
2018-05-13 13:33:18 -04:00
su8
8dbb623255 Refactor mysql.cc (#493)
* Refactor mysql.cc

* Comparison of array temp not equal to a null pointer

* Switch and compare to C NULL instead std::nullptr_t to avoid compile error

* Use parentheses around addrs

* Remove parentheses around addrs

* Rebase
2018-05-13 12:25:21 -04:00
Brenden Matthews
e91b91d85a
Apply a bunch of code fixes from sonarcloud. (#492) 2018-05-13 09:58:03 -04:00
Brenden Matthews
42e43435f4
Break if MPD connection fails. (#491) 2018-05-12 22:57:11 -04:00
Brenden Matthews
a9e968956d
Minor code fixes. (#489)
* Minor code fixes.

* Switch logging macros to functions.
2018-05-12 21:09:24 -04:00
Brenden Matthews
4b92556fca
Build improvements: clang-tidy, sonar, Dockerfile. (#488) 2018-05-12 19:26:31 -04:00
Brenden Matthews
eebc8c653b
Add formatting/static analysis (#486)
* Reform source with clang-format.

Rules applied with:
    $ find . -iname *.h -o -iname *.cc | xargs clang-format \
        -style=file -i -fallback-style=google

* Add clang-format and analyze to build.

Based on the excellent work at: https://github.com/ttroy50/cmake-examples

* Clean up CMake stuff on macOS.

* Remove vim/emacs modelines.

* Update copyright dates.

* Build fixes.

* Build fixes.

* Build fixes.

* Build fixes.

* Build fixes.

* Build fixes.
2018-05-12 12:03:00 -04:00
npyl
b20d83b747 Basic macOS support (#480)
* Initial patches for Darwin support

* cmake files ready for building on Sierra. Dont know about other OSX versions

* Added darwin.h which will contain darwin specific headers

* Patches for enablin asprintf support (needs _POSIX_C_SOURCE >= __DARWIN_C_FULL so remove -D_POSIX_C_SOURCE=200809L).  What is more, -D_LARGEFILE64_SOURCE is used by default so not needed on macOS

* Stubs for get_entropy_avail and get_entropy_poolsize

* More progress to getting to build

* More patches

* Now builds, remains fixing linking errors. Also implemented some functions

* Now links

* Now conky runs without sigabrt()'ing... An exception in semaphore.hh caused it to crash immediately upon initialisation

* README changes

* This was based on an old attempt I did with porting conky where I hadn't cloned the repo and thus it showed 3166 commits behind

* Patched a bit the semaphore.hh and now conky runs at 0.7% CPU usage and not in 100% or 200% as it did before! Yeah

* This update fixes swap-related miscalculations, though:

On macOS there can be used MANY swapfiles ( NOT swap partitions,,, the installation disk is the partition for storing swap memory data )
Thus conky code must be updated for Darwin to support multi-swapfile usage stats.

For now, we default to showing stats for swapfile0

* Fixed a bit the comments so they make sense

* Realised that the sysctl code can give us stats for the whole swap storage so removed the swapmode( int swapfd, unsigned long * retvail, unsigned long * retfree )

* I think the code is in good condition now

* semaphore.hh: Implemented ~semaphore() and added throwing exception
when sem initialisation fails just like in sem() for linux…

darwin.cc:  partially implemented update_cpu_usage() and
update_total_processes()

* Implements update_total_processes()

( Now it finds the correct number of tasks )

the changes in cmake file don’t change the functionality… It is only
comments.

In upcoming updates lua support may be enabled and the comments are
related to lua support.

* get_cpu_count() now conforms to newer sysctl code as suggested by Apple ( we use hw.logicalcpumax instead of hw.ncpus )   -->  The new implementation of get_cpu_count() finds the the max value of logical cores the mac could use on a boot.

update_total_processes() was patched to allow initialising only ONCE when conky runs the machHost and processorSet ( this could probably be implemented in a better way I guess though... )

* patch

* experimental support for get_top_info() and update_cpu_usage() :)

* going to patch stuff

* adds getting rss memory in get_top_info()

* fixes

* Couple things made more beautiful but too many things to fix ...

* Remove unneeded code from darwin_soundcard.h and keep only needed to
compile ( This way we are compatible to GPLv3, i think )

Include GPLv3 header in darwin.cc, darwin.h and darwin_soundcard.h

Add more beautiful and explanatory comments to ease the work of other
contributors… ( Mostly on things that don’t work! )

* Merged the macOS update_cpu_usage() implementation with the linux implementation but still it doesn't work as expected, plus, there are more memory related problems that will be fixed in newer release!

NOTE: It will be really good to see how functions are implemented on linux.cc for more complete implementation

* Now using a more linux-influenced implementation and dropping the old... ( only keeps mach stuff )
Needs some more work though to print accurate percentage! :)

* Add conky installer (.pkg) project

* Now gets thread count aswell! For now, we get this from update_total_processes... Also, removed the installer project because I need to learn more the software

* Properly get thread count!

- Patched core.cc to enable getting threads count on macOS!

- Cleanup in darwin.cc

* sort out some things in the code:

- running_threads_count is not the same as thread_count on macOS! There is actually a difference!
Correct a bit the code!

* Enable the if_mounted command and start implementing the check_mount function in darwin.cc

* Tighten things up

* This patch makes conky build easily and without patching on any supported macOS version!  The new flag introduced is a temporary solution for allowing conky to compile on other OS without tweaking the cmake files.  If you want to compile it with i18l support you will have to run the command: brew link gettext after you install gettext

* Update README to provide more complete info on building on macOS

* Fix

* patch check_mounted + SIP status

This commit:

- patches check_mounted function to match the implementation found in FreeBSD.cc! Now conky expects typing something like this:

conky -t '${if_mounted /Volumes/MacOS} ${endif}'

Please note that the correct way is "/Volumes/MacOS", not "/Volumes/MacOS/" ! You shouldnt put the backslash at the end... It will not work!

- Adds a new command called sip_status which you can use to make conky show System Integrity Protection related information such as if filesystem protection is enabled, if user approved kexts protection is enabled and more...

you can type conky -t '$sip_status' to  see what it does...

( I will most likely update some things later regarding sip_status and check_mounted )

* Further implement sip_status

sip_status now has different functionality!

If you give no arguments it shows whether SIP is enabled or disabled ( generally )
If you give argument ( takes only ONE ) you can specify which specific thing of SIP you want to show status for...

You need to pass 0, 1, ..., 9 to $sip_status as argument to print status for apple-internal, untrusted-kexts, and more...

Below you can see the list:

ARG:                   RESULT:
nothing --> print enabled / disabled
0   --> allow_apple_internal
1   --> allow_untrusted_kexts
2   --> allow_task_for_pid
3   --> allow_unrestricted_fs
4   --> allow_kernel_debugger
5   --> allow_unrestricted_dtrace
6   --> allow_unrestricted_nvram
7   --> allow_device_configuration
8   --> allow_any_recovery_os
9   --> allow_user_approved_kexts

* sip_status progress & if_up enabled

This commit adds the 'a' argument for $sip_status which checks if the SIP configuration is ok or it is likely to break in the future.

Also, enabled the $if_up command, but there are some problems with it...

* sip_status patches

- Updated code based on newest version of csrstat utility (v.1.8)
The 1.8 version fixes a problem in finding status of ALLOW_DEVICE_CONFIGURATION flag.

- Fixed a bug where we mistakenly printed 'disabled' even when SIP was enabled.

* Disable ncurses checks in a way that will allow compiling for other OSes! ( it was a really quick patch before )

* More changes in cmake file to make code prettier and more exact

* More cmake files cuteness

* work for supporting versions prior Sierra

This patch brings more compatibility with versions prior to Sierra.
The project as is nearly links on a 10.9.5 OSX installation.

- on versions prior Sierra clock_gettime() is not implemented thus we need to provide our own implementation for conky to work.  ( Currently we have minimal support, more studying needs to be done )

NOTE: In order to compile on versions as old as Mavericks you will need newer compilers because command line tools for 10.9.5 dont support some C++11 features... For this I donwloaded the commandline tools for Xcode 8.1 ( or 8 dont remember well ) and installed only the CommandLine Tools section with Pacifist!

( The OSX installer sees the OS as too old, so you need pacifist! )

* Oops

* $if_mounted ready

This patch removes the unneded print_mounted() function!
Also cleanup code.

* $if_up works

I think $if_up command works therefore remove the APPLE specific code in core.cc ( there wasnt anything different anyway ) and use the FreeBSD code.

Minor conky output changes in darwin.cc

* fix compatibility with Mavericks and before...

This update allows conky to be compiled on Mavericks and before by checking at compilation time what our build target is.

If it is Mavericks or lower, then cant use the csr_get_active_config func because it is not available.

On higher versions than Mavericks it works as before...

NOTE: For compiling on Mavericks or lower you will have to write 10.9 in CMAKE_OSX_DEPLOYMENT_TARGET when you run ccmake

* Added link for youtube video showing conky running on macOS

* Improvements

Minor improvements related to style
Removed unneeded free() calls

* Simplify Xcode configuration process! :)

* Removed update_cpu_usage() implementation

It was quite buggy so I removed it...

* Cleanup the source code

1. Bogus TODO comments have been deleted!
2. Started using DEBUG_MODE based printf
3. Explain some things better/cleanup

* Last small cleanup

The TODO in get_from_load_info() was unneeded.  Removed!

Also, DEBUG_MODE is enabled for now...

* update authors file

* Improve README

Make it more clean and easier to understand.

* Update README.md

small tweak

* Work for conforming with "Development" rules

1. Add to variables.xml documentation about the $sip_status variable.
2. Add sip_status variable to conkyrc.vim and nanorc to allow highlighting

3. the friends in darwin.cc is ambiguous,,, some are more than friends.

* First patch set that implements get_top_info()

:)

* Calculate cpu usage of all processes more efficiently.  (Now results match Activity Monitor's results a lot!!!)

More info about the get_top_info() implementation will come once I finish it! (soon)

* Cleanup patch!

o Move  a couple things to better places
o Rename get_sample() to get_cpu_sample() to allow to be used by different functions such as get_cpu_usage() ( this is a scene from the future... )
o Improve the way we get cpu usage for each process by passing the already created proc_taskinfo struct to the appropriate function instead of creating another one
	inside it!

* Correctly enable $running_processes variable

In our implementation update_top() doesn't calculate the count of running processes! We assign this functionality to the update_running_processes() function.

* Removed unneeded flag

This is not needed because we do not use update_top() for getting the number of running processes!

* Update README.md

* Update README.md

This adds support for TravisCL.

Though this will compile the project only on Linux it is a good sign to know if our port still can compile on Linux or we have broken things.  It seems like it can't but I suspect the problem existed before my patches.  I will investigate.

* First patch towards implementing #15

This patch a reworked get_top_info().  We now use the function get_top_info_for_kinfo_proc() to set the contents of each |process| struct.
Also, we calculate the total cpu usage and total process usage concurrently using GCD.

Aside from these we bring the function helper_get_proc_list() which makes the code simpler and cleaner.

* First fix for the algorithm that calculates % CPU usage of a process

The previous patch made the algorithm buggy.  It required more reentrant-safe functions.
Make calc_cpu_total_r() which is a more reentrant-safe reimplementation of the calc_cpu_total() function.
This is not the last commit, more are coming in the future.

* Previous commit wasn't pushed...

* Problems committing

* Make the code cleaner but break the algorithm again	#15

The algorithm doesn't work... It is a work in progress!
But this time we have merged the cpu_info and cpusample into one struct called cpusample
( I copied some variables from the linux implementation but they will probably be removed )

* Rework the code a bit / CPU usage % algorithm still doesn't work

Now get_from_load_info() is renamed to helper_update_threads_processes() and is called by both update_threads() and update_total_processes()
This makes the code nicer and removes the enum with the flags

* cleanup

remove unneeded functions, remove unneeded variables

* bugfix

* bugfix

* remove the whole get_top_info() code!

I will rework a lot this code so we can get rid of it.

* Work for #15

Now we use the ultimate solution for calculating % usage of CPU of a process!

Check the #15 Issue for information about this patch!

* Quick memory leak fix & some patches for the get_top_info algorithm

* quick patch for semaphore class

* Update the comments

* For consistency

* temp

* Revert "Merge branch 'master' into update_cpu_usage"

This reverts commit 7267a515c40d54b85107e51016703e6c10f3183e, reversing
changes made to 2190ff0b51463c12c61b3357cf846b8e705ebeb4.

* Revert "Revert "Merge branch 'master' into update_cpu_usage""

This reverts commit 692bd27a3adb2fe7027d65932467a140e42cc7bc.

* Partially implement the overall % CPU usage

* bug fix: I meant procs and threads!

* make the code better part1

* cleanup

* Stabilise the values of get_cpu_sample(). Affects get_top_info() and update_cpu_usage() ( fixes #13 and #15 )

For some reason the code that used host_statistics() function didn't produced bad values quite often.  Replaced the function with host_processor_info() and changed the algorithm
and now the values are correct!

This affects the get_top_info() and update_cpu_usage() functions which wouldn't work correctly until now.

* Finish the optimised version of get_top_info()

Fixes #15

* Quick fix for #16

Probably I will come up with a different location for get_cpu_count() because I want to conform to linux implementation.
Also, the memory leak I am mentioning in get_cpu_count() may not actually exist, as I suspected in the back of my head.

* Strictness

* Cleanup ConkyPlatformChecks.cmake

Cleanup the quick patch code for Lua.

* Add warning to README

If you are using old version of cmake, update it.  It will probably have problems when trying to locate lua.

* More cleanup

* Fix identation

This simplifies the diff.

Also, note that by merging the new code for checking for NCURSES we acheive better compatibility and easy build process

* Remove mixer related patches and files

With the newest patches from upstream, cmake checks if the header soundcard.h exists on the system.

If it doesn't exist (in the case of macOS for example) all mixer-related variables are disabled.

* Changes for using as submodule for ConkyX

* Fixes

* Implement get_freq

This implements #11
Though it doesn't support getting the **current** cpu frequency.

I haven't found a way to do it on macOS but i guess it can be done using a kernel extension. I may come back to this again in the future

* First work for correcting mem stats #6

Incorporate the update_pages_stolen() function and all of its dependencies.

I will see if I can patch the code in order to avoid license problems

* Work for #6

Now we follow the way apple's top works and not Activity Monitor.

For this reason we find different values.  But correct based on top.

* cleanup for #6

* bug fix 1

* cleanup

* hmm sorry

* More cleanup

- Move the libtop_tsamp_t object to darwin.cc.

- Remove unneeded member variables.

* A bit documentation

* Implement secondary memory stats #6

Implement memwithbuffers, memeasyfree and memfree (which isn't secondary)

* Quit update_meminfo if libtop_tsamp_update_vm_stats() failed

* Update README.md

Revert to original conky readme
Move all macOS related information to the Wiki: https://github.com/Conky-for-macOS/conky-for-macOS/wiki

* Alot junk slipped in too!

* Merge net_stats branch

For now, I have only tested up / down bytes count on en0, and it works.

This is for #14

* Corrections

- Fix License headers in darwin* files
- Remove ConkyX entry from .gitignore which slipped into from the "forConkyX" branch which was used for another project ... ConkyX.
- Cleanup top.h  (I will request the changes in a pull request finally)

* Fix identation and cleanup

* identation-fixes part1

* Try to fix problem compiling on linux

Improve checks for headers in ConkyPlatformChecks.cmake to amend the problem;
I mistakenly thought that statfs64 wasn't available in sys/statfs.h in macOS thus I tried to add platform specific code.  Though, I add the checks in the wrong place and also messed up linux-specific code by replacing checks_include sys/statfs with check_symbol_exists statfs64

* attemp to completely fix linux problem!
2018-05-07 07:27:32 -04:00
txpaper
e0990f3e7d Added detect_battery setting (multiple batteries) to fix #190 (#482)
* Fix #190:
 * Added function `is_on_battery()` to correct set update interval
 * Added setting `detect_battery` to correct select one or more batteries to check

* Added `detect_battery` to doc/config_settings.xml
2018-05-03 08:34:48 -04:00
Barben360
1410bac6aa Fixed crash caused by temporary virtual net interfaces (#479)
* Fixed crash caused by temporary virtual net interfaces

* Restored original identation
2018-04-26 07:27:21 -04:00
Adam Majer
128c8cce34 Add support for libical 3.x (#465)
In libical3, deprecated icaltime_from_timet is removed
Use icaltime_from_timet_with_zone instead. This function
exists in libical 2.x so no need to change requirements
2018-03-06 07:46:31 -05:00
Ashley
6a11147397 Allow up to 99 CPU/cores (#459) 2018-02-06 13:01:55 -05:00
Brenden Matthews
562c737588
Fix segfault when out_to_x = false. (#455)
This resolves #454.
2018-01-23 13:52:11 -05:00
François Revol
ac56f205fb Haiku port phase 1 (#433)
* cmake: Add Haiku as a supported platform

* move mixer.cc to platform-specific as Haiku doesn't use OSS

* Add haiku.h with some stubs

* Use haiku.h

* Add some Haiku stubs

* Some Haiku network workarounds

It does not define SUN_LEN, provide a default.

It doesn't name the union in struct ifreq, use ifr_addr directly.
It seems Linux also declares it so it should work without change.
We can always define it for other platforms lacking it (add a cmake test ?).

Haiku does not have IFF_RUNNING, IFF_LINK seems close in semantics, so use it.

* Haiku: Minimal implementation of update_meminfo & get_top_info

* Haiku: implement update_cpu_usage
2018-01-19 11:36:40 -05:00
Daniel Pielmeier
f93a56756b Fix SEGV in a CPU hotplug environment #127 (#453) 2018-01-19 11:36:11 -05:00
Alexey Korop
d97f4dfd8a Make mouse-through workable (#213) 2018-01-19 09:12:08 -05:00
sl33k
e219a0f2d4 add support for exteral refresh via SIGUSR2 (#268) 2018-01-19 09:08:55 -05:00
bzy-xyz
cb089b3231 eve: address apparently spurious libcurl recv errors (#372)
Some time after the last eve-related PR libcurl began returning
`CURLE_RECV_ERROR` from `curl_easy_perform()`, even when the request returns
good data that is otherwise usable.

Now, if the `struct xmlData` has been populated by write_data, we use whatever
came back (almost invariably a complete XML response). We don't depend on
libcurl returning CURLE_OK.
2018-01-19 09:08:03 -05:00
Daniel Pielmeier
0e82422132 Fix drawing text shades (#371) 2018-01-19 09:07:32 -05:00
Kevin Mooney
49daff2ced Fixed #373, segmentation fault when HOME is unset (#375) 2018-01-19 09:06:55 -05:00
deep-42-thought
e1f38f9b68 enable irc to use ipv6 if host can't be reached via ipv4 (#380) 2018-01-19 09:06:27 -05:00
Erinor2
c27b7ebff3 NVIDIA: Cleared TODO for the multi-GPU support (#382)
* Cleared TODO for the multi-GPU support

Added an optional parameter to the commands nvidia and nvidiabar.
If the parameter is omited default value is 0 for GPU0

The parameter is the GPU index starting at 0

Enhanced the cache system for multi-GPU support.

* Optimization and added modelname

* Update of documentation

* Update 2 of documentation
2018-01-19 09:04:23 -05:00
Arseny
e1a19b3093 Provide support to query the active port on PulseAudio's default sink (#405)
* Provide support to query the active port on PA's default sink

This commit exposes 2 objects:
- pa_sink_active_port_name
  (example value: "analog-output-headphones")
- pa_sink_active_port_description
  (example value: "Headphones")
that give respectively the name and description strings
for the active port on the default sink provided by PulseAudio.

* Reflect 9ed28f2a in the documentation
2018-01-19 09:03:06 -05:00
Brad Sawatzky
c712d67884 Fix segfault when kernel reports non-sequential SMP CPU indices (#416)
- For an AMD FX(tm)-6350 Six-Core Processor the file '/sys/.../present'
  reports "0,3-7".  I assume that chip is really an 8-core die with two
  cores disabled...  Presumably you could also get "0,3-4,6", and other
  combos too...
2018-01-19 09:02:32 -05:00
bunder2015
61c0dfaf60 Fix issue #307 - High bars in cpugraph (#429)
Authored-by: kira78 <kira78@users.noreply.github.com>
Signed-off-by: bunder2015 <omfgbunder@gmail.com>
2018-01-19 09:01:49 -05:00
Jan Senolt
b814aafc6e Solaris support (#445)
* Basic Solaris support

* Fixed indentation & minor improvements

* support for diskio
2018-01-19 09:00:42 -05:00
Alexey Bondarenko
cbe403bc51 Fix scrolling of UTF-8 text. (#384)
* Fix scrolling of UTF-8 text.

* Fix some out-of-bounds buffer access issues and code style issues.
2017-12-07 15:00:38 -05:00
albert2004
c93a007a13 Fix gcc-7 compilation error. (#402)
https://github.com/brndnmtthws/conky/issues/396
2017-12-07 14:59:41 -05:00
Darin McBride
a58a6d4e08 Clean up a few valgrind errors, add realloc-failure handling for graphs. (#367)
I think this fixes #360
2017-02-11 13:39:18 -08:00
deep-42-thought
e84ca1f966 enable persistent view of irc messages (#362)
* remove path from libirc-include

* feature: irc: possibly show last n lines persistently instead of all lines said since last time

* irc: add overflow-check, for case when no newmsg's ->next is NULL
2017-02-02 11:25:59 -08:00
Zak B. Elep
c6ef3ba5e7 fs.cc, linux.cc Use /proc/mounts for list of currently mounted fs (#357)
Per manpage of mount(1) in newer util-linux:

    The programs mount and umount traditionally maintained a list of
    currently mounted filesystems in the file /etc/mtab.  This real mtab
    file is still supported, but on current Linux systems it is better
    to make it a symlink to /proc/mounts instead, because a regular mtab
    file maintained in userspace cannot reliably work with namespaces,
    containers and other advanced Linux features.

In most new Linux (e.g. Debian) /etc/mtab is already symlinked to
/proc/mounts.

See
e778642a9e
for the gory details.
2017-01-30 17:31:35 -08:00
labath
2600d01373 Fix an out-of-range error in new_graph (#356)
The code was multiplying the index with the size of the element, and
then adding it to the typed pointer (resulting in a double
multiplication and an OOB access).

Replace the buggy code with a slightly safer c++ alternative.
2017-01-30 17:31:09 -08:00
bzy-xyz
641f4ecfdb eve: fix various issues (#359)
* eve: fix API, empty queue, conky reload, formatting issues

Since the EVE module was contributed, CCP has changed how the API works and
what the correct API URL is. So the module had to be updated to respect the
changes made on the EVE side.

Additionally, undefined behavior was occurring for characters without active
skill training queue, as is common for folks with multiple characters on a
single account, and was also occurring when Conky was reloaded following a
config file change. Now the `$eve` variable should just contain an empty
string if the character isn't training a skill (to make it detectable by
`$is_empty`), and the module should do The Right Thing (tm) when the
config file is changed while Conky is running.

The time remaining text has been adjusted to be slightly less verbose.

The module should do the right thing for up to 64 distinct characters.
Presently, though, every additional character requires a blocking CURL
request, meaning that querying many characters is presently not ideal. A
rewrite of the module to use asynchronous requests is probably in order, but
will be left for a future PR.

* eve: fix timezone handling; better handling of bad XML

* On Linux `gettimeofday()` doesn't return valid timezone data; we use
`localtime()` and the `tm_gmtoff` instead. Training times are no longer
incorrect as a result.

* Sometimes the EVE API will return spurious non-XML tags as part of the
response. This previously caused the XML parser to return a null document.
We tell libxml to `XML_PARSE_RECOVER` to try to recover from these errors
where they occur on real data.
2017-01-30 17:30:25 -08:00
Jörg Mechnich
5878974441 fix mpd_albumartist (#363) 2017-01-30 17:25:33 -08:00
The ultimate Renan
e94f04949c Cached versions of get_nvidia_value and get_nvidia_string_value. (#344)
* Implemented cached versions of get_nvidia_value and get_nvidia_string_balue. Unmutable values now only are queried once.

* Removed the TODO topic related to using static variable as cache + fixed a typo in the sample nvidia config

* Was using mtf variables to store the perf values. Fixed it

* Removed an useless else statement
2016-12-04 10:13:57 -05:00
deep-42-thought
0523929d4a top.cc: remove hard coded values of MAX_SP (#346) 2016-12-04 10:02:38 -05:00
Stephane Fontaine
ddf8a0f58f Possibly Fixes #319 (#333)
*tunneled* pulseaudio sinks do not have any card associated to them.
2016-10-18 14:41:04 -04:00
Guido Falsi
271ca6dc97 Try more than one sysctl to get CPU temperature. (#330)
* Try more than one sysctl to get CPU temperature.

Suggested by:	walter@pelissero.de
Reference:	https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=210235

* Added braces and using else ifs.
2016-10-07 19:54:35 +02:00
Guido Falsi
3a00680689 FreeBSD changes (#327)
* llabs() is included in FreeBSD since FreeBSD 5.0.

Oldest supported FreeBSD version is 9.3 now.

* stdio.h needs to be explicitly included here for FreeBSD.

I can wrap it in #ifdefs if needed, but I don't think it can hurt other OSes.

* addr config variable works fine on FreeBSD.

* FreeBSD 5.x is really an ancient version and long unsupported, so I think this check for it can be dropped.

* Fix and simplify code to get battery state and charge.

* Add required include on FreeBSD.

* Add needed include on FreeBSD.

* Also populate basename to avoid printing (null) process names.

Repored by fellow FreeBSD user Szabolcs Grof.
2016-10-04 09:47:57 +02:00
Guido Falsi
2e4839e601 cur_x definition is wrapped inside #ifdef BUILD_X11, but here it is used outside of such ifdef. (#326) 2016-10-04 09:47:27 +02:00
krakenfury
397a0e4581 update uri to get NOAA METAR data (#325) 2016-10-04 09:47:13 +02:00
windows5
774afe202b Update openbsd.cc (#323) 2016-10-04 09:46:28 +02:00
afa-
41aa51e7ab Check st_ctime to work with mutt MUA (#309)
Check st_ctime (time of last status change) to properly update the mail count when mutt MUA is used.
2016-09-08 08:25:28 -07:00
dbriba
17a29def4b Update x11.cc (#304) 2016-09-08 08:24:54 -07:00
shizeeg
178015a949 Fix build without X11 (#317) 2016-09-08 08:24:29 -07:00
roy-mustang
3b4b9abd97 Implemented goto action for ncurses mode (#299) 2016-07-20 09:53:48 -07:00
Ben Kibbey
b14f459740 scroll: add 'wait' and 'interval' parameters. (#297) 2016-07-18 08:11:35 -07:00
Ovnuniarchos
e2bd14e7b7 Use coordinate offsets to draw shades/outlines. Corrects behavior when GOTO-ing. (#287) 2016-07-14 09:45:06 -07:00
Vincent Cheng
48ea5914e9 Fix build failures on Debian kfreebsd (#291) 2016-07-13 07:24:29 -07:00
Matt Sturgeon
3753e2a95b Nvidia updates, docs and fixes (#278)
* nvidia: Update the docs and add more arguments

**Updated the docs in variables.xml to reflect the current nvidia object.**

Basically just copied the inline comments into the XML document

**Added the last of the compatible arguments**

The following arguments were added to `get_nvidia_barval`:

* memfree
* ambienttemp
* gpufreq
* memfreq
* mtrfreq
* imagequality

This should leave only incompatible arguments unsupported (e.g. min/max
values).

Decided to base percentages off of zero rather than the specified minimum
values.

Signed-off-by: Matt Sturgeon <matt@sturgeon.me.uk>

* nvidia: Better error/debug printing

* Merged `scan_nvidia_args` and `set_nvidia_type` into new
  `set_nvidia_query`
* Added a translation array for `nvidia`, `nvidiabar`, `nvidiagauge` and
  `nvidiagraph` commands (helps with error printing)
* Added some NORM_ERR prints to `get_nvidia_barval`, `get_nvidia_value` and
  `get_nvidia_string`
* Removed exess newlines in nvidia's core.cc error definitions

Signed-off-by: Matt Sturgeon <matt@sturgeon.me.uk>

* nvidia: Better sanity checks when running queries

Introduced a pair of functions that checks whether the target we are
querying exists and how many of the target there are.

If the target doesn't exist there probably isn't a nvidia card
installed, if the target count query fails then the propietary drivers
probably aren't installed.

Fixes #269

Signed-off-by: Matt Sturgeon <matt@sturgeon.me.uk>
2016-06-24 11:05:17 -07:00
Stephane Fontaine
c4f2e72baa Avoid port number double conversion to network byte order. (#281)
It is taken take of by `getaddrinfo`.
2016-06-24 07:17:43 -07:00
Stephane Fontaine
587631a15b Add native support for pulseaudio. (#283)
* Add native support for pulseaudio.

This adds ability to get Pulseaudio current volume without calling an
external program. Also it provides a few other parameters like card's
current profile similarly to pavucontrol. Currently it only queries the
default sink (and associated card).

* Switch to pulse async API.

This us by far the most efficient as conky subscribe to a few pulseaudio
notifications. Whenever pulseaudio server changes (volume or default
sink or default card), conky's callback updates the results.
2016-06-24 07:17:20 -07:00
Michal Rus
8696c504c6 Use text_buffer_size in print_evaluate for the buffer size (#260) 2016-05-20 08:43:17 -07:00
icanhasserver
e056dca8f1 Increase info.cpu_count for single-core systems (#257)
On single-core systems, sscanf() does't match, as the sysfs file contains the value 0 instead of i.e. 0-7 for multi-core systems.
2016-05-14 10:41:35 -07:00
Vincent Cheng
46318cf907 fix build failure when compiled with -DBUILD_NVIDIA=ON (#248) 2016-05-06 07:25:53 -04:00
Toke Høiland-Jørgensen
0db823e56c Add systemd journal support. (#214)
This adds support for reading log entries from the Systemd journal. A
new command, called simply 'journal', is added which takes a number of
lines as a parameter and optionally which journal (user or system) to
read from.

Obviously, libsystemd is required to build journal support. Tested on
Arch Linux (Systemd v229).

Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
2016-05-06 07:25:30 -04:00
Maximilian K
5d50e9be67 don't get stat on path after it was removed from config file (#250) 2016-05-06 07:24:52 -04:00
Nelis Oostens
2a9e21e23b Added BUILD_XINERAMA to print_version (#252)
Added BUILD_XINERAMA to the print_version output.
2016-05-06 07:24:41 -04:00
Santtu Lakkala
d8cbdffe95 Make evaluate useful (#226)
Make evaluate actually double-evaluate itself, allowing for constructs
such as: `${eval $${addr ${gw_iface}}}' to work.
2016-05-06 07:24:30 -04:00
marcpayne
8dda4c3995 Parse quoted execgraph cmd before parsing options (#232)
When parsing the argument string for graph objects, check if there is a
double-quoted command in the beginning of the string and extract it
before parsing any options. This prevents items in a command from being
improperly recognized as graph options. It should also eliminate the
need to place commands with spaces into a separate script.

Also, fall back on default_graph_{height,width} instead of using
hard-coded values so that the default values set in a user's config will
work.
2016-05-03 08:04:57 -04:00
Jérôme Poulin
48122dcf82 Make conky resolve symlinks before using them. (#238)
* Make dev_name resolve symlinks before resolving the name.

- When symlinks are not resolved first, you will get an error on startup when
  using path in /dev/disk/by-id, for example, in diskiograph_*.

* Improve diskio device name resolution by always resolving symlinks.

- Any device path will be resolved of any symlinks before getting the usual
  checks for labels et device name.

* Check if diskio device is really a block device, not only if it exists.

- Current check would succeed in case the device is a path, like when using
  label: with an empty argument.
2016-05-03 08:04:14 -04:00
Matt Sturgeon
d8c659e7de nvidiabar, etc (#215)
* First experiment with $nvidiabar

Added nvidiabar, nvidiagraph and nvidiagauge. Using a dummy value of 50% for now until it is integrated with the nvidia value query functions.

* Implement get_nvidia_barval()

`get_nvidia_barval()` no longer returns a dummy "50%" but instead an actual value for supported arguments:

`gpuutil`, `memutil`, `membwutil`, `videoutil`,`pcieutil`, `fanlevel` and `gputemp`
2016-05-03 08:03:45 -04:00
luebking
06f87b9c26 Update immediately when the root pixmap changes (#230)
* use CLOCK_MONOTONIC if supported

get_time is used to control the update interval etc. so there's
no need to query the system time

* repaint immediately when the root pixmap changed

Original patch by pweisenburger,
In addition resets the next_update_time to ensure "now"

FIXES: #48
2016-04-13 10:33:33 -07:00
Guillaume Maudoux
7d7e9b6fd8 Fix race conditions in signal handling (#233)
SIGHUP, SIGUSR1, SIGKINT and SIGTERM are no longer lost to race
    conditions. In particular, a SIGHUP can no more cancel a SIGTERM.
2016-04-13 10:33:04 -07:00
Brenden Matthews
4cb9ab8ab7 Merge pull request #227 from alessandro-g89/master
Improve to_bytes to work with input values with a decimal point
2016-03-28 07:35:35 -07:00
Alessandro Grassi
67e814f182 Improve to_bytes to work with input values with a decimal point 2016-03-23 08:42:16 +01:00
Brenden Matthews
f95366b649 Merge pull request #209 from aandergr/master
keep next_update_time modulo update_interval zero
2016-03-21 10:55:32 -07:00
mxmlnkn
8ccadeb7bb solve double counting at start issue 2016-02-21 10:34:46 +01:00
Alexander Graf
505c4286b4 keep next_update_time modulo update_interval zero
This patch modifies logic for setting next_update_time such that the
update is done at full update_interval seconds. That is, for example
with update_interval 60.0, update is done at 00:00:00, 00:01:00,
00:02:00, etc.

This might be useful for using conky as a clock widget which only needs
to be updated once per minute, but is obliged to update exactly at
minute change.

It is implemented in a way that is (hopefully) immune to clockchanges
(as for example by NTP or DST).
2016-02-08 22:41:30 +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
Brenden Matthews
eef323eafd Merge pull request #48 from paulegan/graph-in-shell
Support for graph output on console/shell
2014-06-17 17:23:17 -07:00
Nikolas Garofil
70f27ccfab Fix invalid read 2014-05-30 12:24:55 +02:00
Paul Egan
9809f7cd91 Support for graph output on console/shell 2014-05-05 21:07:55 +01:00
Vilmos Nebehaj
cda5afda69 Address PR comments.
In particular:
- Don't call get_battery_perct() recursively.
- Use define for length of string holding battery name.
- We can use strcpy() since bat is zero-terminated.
2014-03-09 21:32:15 +01:00
Vilmos Nebehaj
3fb201bbc8 Use strncmp() when checking battery name. 2014-03-09 18:53:26 +01:00
Vilmos Nebehaj
ad92c60d6b Compute mean percentage for multiple batteries.
If a laptop has multiple batteries, compute the mean percentage if the
user asks for 'all' instead of a specific battery.
2014-03-09 14:03:36 +01:00
eskerda
68263d4556 add support for $ibm_thinklight
Some IBM/Lenovo models come with a light on the top edge of the
display to illuminate the keyboard. This either reports 'on', 'off'
or 'unknown'.
2013-12-06 16:44:37 +01:00
Andrew Deason
f670e70d7c Set uninitialized inotify_fd to -1, not 0
Currently we set inotify_fd to the value 0 when inotify_fd hasn't been
created yet, or after we close it. But 0 is a valid fd, and we check
for the value -1 to see if it's been initialized. So, if inotify
support is compiled in, but we disable_auto_reload, we can end up
closing fd 0. This can screw up various other things in weird ways,
including that exec'd processes appear to have an invalid stdin.

So, set inotify_fd to -1 to clear all of this up.
2013-08-18 13:50:17 -05:00
Pavel Labath
02dfacd694 Add support for lua 5.2
luamm is now able to be compiled with both lua 5.1 and 5.2 (assuming 5.2 has backward
compatibility features compiled in). It is my intention to always support at least two versions
of lua.
2013-07-13 23:55:28 +02:00
Pavel Labath
0f94f409a1 Fix an some strange code found by a clang warning 2013-07-13 19:42:20 +02:00
Pavel Labath
fc84f0f6a0 Fix compilation with clang 2013-07-13 19:42:04 +02:00
Nikolas Garofil
9d36db7138 Fix warning about unused result in strerror_r() redefinition
On systems, the buildprocess will complain:
  [  7%] Building CXX object src/CMakeFiles/conky.dir/c++wrap.cc.o
  conky/src/c++wrap.cc: In function ‘std::string strerror_r(int)’:
  conky/src/c++wrap.cc:66:37: warning: ignoring return value of ‘char* strerror_r(int, char*, size_t)’, declared with attribute warn_unused_result [-Wunused-result]

According to "man 3 strerror_r" the buffer used as 2nd arg is not always used, this patch also fixes that problem.
2013-06-20 22:07:40 +02:00
Nikolas Garofil
36189de425 Fix warning about unused result of write() in priv::callback_base::stop()
On systems with a strict compiler, the buildprocess will complain:
  [ 70%] Building CXX object src/CMakeFiles/conky.dir/update-cb.cc.o
  conky/src/update-cb.cc: In member function ‘void conky::priv::callback_base::stop()’:
  conky/src/update-cb.cc:49:34: warning: ignoring return value of ‘ssize_t write(int, const void*, size_t)’, declared with attribute warn_unused_result [-Wunused-result

This patch fixes this warning (and by doing this also checks if the write worked)
2013-06-20 19:43:46 +02:00
Brenden Matthews
7a1f20847f Merge pull request #11 from rephorm/patch-1
Fix unknown short battery status
2013-05-23 17:19:59 -07:00
Brian Mattern
b08410dab4 Fix unknown short battery status
Before, in the case of an unknown battery status (which often happens on my Sony VAIO laptop after waking from sleep), the buffer would be unterminated.

(Although, this memmove trick is a bit odd. It would probably be better to remove the memmove's and put a single buffer[1] = '\0'; at the end of the function).
2013-04-30 10:33:42 -07:00
troxor
38f05de4ca Quick fix for crashes when mpd stops 2013-04-27 23:29:20 -05:00
alcazoid
749083a450 Fixed short process names in top
Conky takes process names from /proc/<pid>/stat and it's limited to 16
chars in kernel. That obviously makes top_name_width option to work only
for decreasing name length. To obtain longer names we parse
/proc/<pid>/cmdline.

Not every process has cmdline, so we take both process names and choose
one we want to use. Like this:

- Get process name from /proc/<pid>/stat

- Get process cmdline from /proc/<pid>/cmdline

- Transform cmdline to a bit simpler form(i.e. "/usr/bin/python
 /usr/bin/terminator" to "python /usr/bin/terminator"), keeping
the arguments(might be changed easily)

- Choose the one that is longer and use it
2013-04-09 16:58:15 +02:00
Brenden Matthews
318324fc63 Remove unused variable. 2013-01-29 10:59:23 -08:00