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

312 Commits

Author SHA1 Message Date
Nikolas Garofil
6c590590a3
Delete broken weathervars before rewrite (#595)
* Kill non-functioning XOAP

* Change weathercode to TODO
2018-08-12 03:51:21 +02:00
Nikolas Garofil
38959715e5 Fix all gcc -Wall warnings 2018-08-08 15:54:47 -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
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
Magliano Andrea
98196d0e6b Preliminary import from 2.8.1 git release
* don't use kvm_* calls, just sysctl (so no suid perm necessary)

* sysctls calls in general aren't thread safe, collapse callbacks
  using same sysctls (specifically total/running procs and proc list
  ones).

  Some sysctls need two calls (first to get size of obj returned,
  second to get object self); if different threads use this schema
  on same sysctl, weird values are returned (first/second calls
  sequence should be serialized).

  In general it makes not much sense too having more threads that use
  the same sysctl; just get info once and populate all data.

* add DragonFly specific extended uname string ($version in conky.conf)
  with git version and signature

Todo:

- top process list logic is old style, use top.cc funcs.
- find a solution for cpu freq

Signed-off-by: Pavel Labath <pavelo@centrum.sk>
2012-06-28 18:56:01 +02:00
Brenden Matthews
ddef05d4eb Update version, copyright. 2012-05-03 16:34:44 -07:00
Pavel Labath
17cf8517c3 Merge remote branch 'origin/master' into lua-config 2011-03-26 21:09:00 +01:00
Pavel Labath
ad8dfc0853 Make audacious vars use the new update system 2011-03-26 19:35:03 +01:00
Pavel Labath
7cf37f7de0 Make $rss use the new callback system 2011-02-16 00:33:22 +01:00
Pavel Labath
fb81e3a9b3 Make $weather use the new callback system 2011-01-06 16:26:53 +01:00
Pavel Labath
b0deb283ec make $curl use the new callback system instead of timed_thread
ps: this breaks $rss and $weather, they need to be ported as well
2011-01-06 15:29:51 +01:00
Pavel Labath
87591f502e add a $memdirty variable
patch contributed by Piotr Karbowski (sf.net #3138195)
2011-01-04 14:48:33 +01:00
Pavel Labath
0852aa4fcd Merge remote branch 'origin/master' into lua-config
Conflicts:
	src/ccurl_thread.cc
	src/conky.cc
	src/llua.cc
	src/logging.h
	src/nvidia.cc
2010-11-13 20:05:59 +01:00
Pavel Labath
375e21af07 Fix a small leak + some cleanup 2010-11-13 19:40:43 +01:00
Nikolas Garofil
561e1ea75d Fix missing SCNu16 (Thanks pavelo) 2010-11-12 18:21:58 +01:00
Pavel Labath
1c785f2ab9 Remove obsolete config-file stuff, move slowly toward making conky functional again 2010-09-15 23:37:13 +02:00
Pavel Labath
a111356ea4 Make music_player_interval a lua setting 2010-09-11 14:45:19 +02:00
Pavel Labath
47d9a63dff Make update_interval{,_on_battery} lua settings 2010-09-11 14:25:19 +02:00
Pavel Labath
ef2b39a97f Make text_buffer_size a lua setting 2010-08-29 23:50:32 +02:00
Pavel Labath
a9893684ac Make max_user_text a lua setting 2010-08-29 20:01:05 +02:00
Pavel Labath
0085402d08 Make if_up_strictness a lua setting 2010-08-25 19:40:24 +02:00
Pavel Labath
127ed29fb9 Make stippled_borders a lua setting 2010-08-25 19:26:15 +02:00
Pavel Labath
2c96799e59 Make {overwrite,append}_file lua settings 2010-08-22 13:04:19 +02:00
Pavel Labath
228f65bc52 Make diskio_avg_samples a lua setting 2010-08-22 12:31:11 +02:00
Pavel Labath
9d30e34a01 Make net_avg_samples a lua setting 2010-08-22 12:28:04 +02:00
Pavel Labath
80f3359634 make cpu_avg_samples a lua setting 2010-08-22 12:24:26 +02:00
Pavel Labath
968f5f4201 auto_ptr is deprecated 2010-06-26 12:33:55 +02:00
Pavel Labath
76a1b17e5c make out_to_http a lua setting 2010-06-20 19:31:17 +02:00
Pavel Labath
78ba5c2800 Merge remote branch 'origin/master' into lua-config
Conflicts:
	src/conky.cc
	src/conky.h
	src/top.cc
2010-06-20 19:09:13 +02:00
Nikolas Garofil
54d4e6518d Add support for out_to_http 2010-06-04 14:41:12 +02:00
Pavel Labath
f81c29a42d make out_to_ncurses a lua setting
this completes the porting of bool settings
2010-04-30 19:33:21 +02:00
Pavel Labath
dfc9efa3cc make out_to_console/stderr lua settings 2010-04-30 19:06:17 +02:00
Pavel Labath
9e8bbdd4ef Create a conky window when own_window is set 2010-04-23 21:25:09 +02:00
Pavel Labath
00e91d8c31 Merge remote branch 'origin/master' into lua-config
Conflicts:
	src/conky.cc
	src/x11.cc
2010-04-22 21:17:14 +02:00
Nikolas Garofil
a6e63bcaa0 Add support for MySQL
Warning: Altough the current version works (for me),
the syntax of the configoptions and vars will probably change
over time. Contact me if you have ideas.

The following is a example of how you can use it now:

mysql_host someserver.com
mysql_db my_database
mysql_user loginname
mysql_password "s3cr3t"
TEXT
${mysql select var1 from some_table}${mysql select var2 from some_table}
2010-04-18 17:52:41 +02:00
Pavel Labath
0584d423e6 make default_{shade_,outline_,}color lua settings 2010-03-11 12:08:55 +01:00
Pavel Labath
ac8d4385eb Make colorN a lua setting 2010-03-11 11:31:10 +01:00
Pavel Labath
c41a507e62 Initialize X when out_to_x is set (using the infractructure from previous commit) 2010-03-10 20:01:26 +01:00
Pavel Labath
aa95dfdd5e make top_cpu_separate a lua setting 2010-03-07 13:33:48 +01:00
Pavel Labath
70d53b770f Merge branch 'master' into lua-config
Conflicts:
	src/conky.cc
2010-03-04 18:23:46 +01:00
Pavel Labath
d93dc72e6d Random C++ification: to_real_path() and current_config 2010-03-04 17:40:20 +01:00
Pavel Labath
12e98c7da5 Port out_to_x setting to lua-config 2010-02-25 22:28:34 +01:00
Pavel Labath
54630eb39e Header housekeeping: remove unneeded extern "C", add modelines, add inclusion guards
hopefully, this doesn't break anything
2010-02-25 21:50:50 +01:00
Nikolas Garofil
e7ed9a5060 Revert "Use "using namespace std;" and remove all std::'s"
This reverts commit 41e80b9833.
2010-02-24 20:10:26 +01:00
Nikolas Garofil
41e80b9833 Use "using namespace std;" and remove all std::'s
I'm doing this because otherwise i'll will forget to add all those
std::'s and will lose a LOT of time finding the problems.
If you don't agree, undo this patch...
...but i hope you won't :)
2010-02-24 19:39:45 +01:00
Pavel Labath
c9447ddb8e Put zero in free_and_zero 2010-02-23 19:36:47 +01:00
Nikolas Garofil
45dfe4994d Use template for free_and_zero 2010-02-23 16:31:17 +01:00