1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-06-02 07:20:47 +00:00
Commit Graph

145 Commits

Author SHA1 Message Date
Brenden Matthews
308f2cb8ea
Update copyright, authors. 2021-02-27 09:14:19 -06:00
Brenden Matthews
9adaba449a
Run clang-format. 2021-02-01 17:30:17 -06:00
Syco
bea6a5cb9b tests for issue 236 2021-01-31 08:26:46 -06:00
Brenden Matthews
1c599a2752
Add missing mpd_comment variable. 2020-07-27 08:01:52 -04:00
AlexApps99
8dc04f3902 Renamed to rstrip to allow for future lstrip or even strip (rstrip+lstrip) command 2020-01-24 19:27:31 -05:00
AlexApps99
b8d3515f19 Added strip command
Strips trailing whitespace from string
2020-01-24 19:27:31 -05:00
AlexApps99
f7c15b027a Renamed start_case to startcase, lower_case to lowercase and upper_case to uppercase 2020-01-21 13:04:13 -05:00
AlexApps99
1bb8754dce Added lower_case and upper_case commands 2020-01-21 13:04:13 -05:00
helmat
6ad788b78d Fix if_mounted & if_running variables for FreeBSD 2020-01-08 13:21:00 -05:00
Brenden Matthews
40a438be3e FreeBSD fixes, GitLab CI build improvements.
- use sccache for build caching
 - add coverage reports as build artifacts
 - add lcov-summary for coverage summary
 - clean up/refactor CI yaml

This resolves the FreeBSD part of #754.
2019-02-25 11:22:19 -05:00
Brenden Matthews
46abd3b75a Apply fixes from clang-tidy/format. 2019-02-23 17:13:19 -05:00
lasers
7eec746b82 update copyright year to 2019 2019-01-05 11:15:36 -06:00
lasers
9dd559b1e9 remove deprecated BMPx support 2019-01-04 19:58:52 -06:00
Brenden Matthews
282160156f Remove deprecated EVE online support.
The EVE API that was in use is now deprecated and no longer works.

This resolves #732.
2019-01-03 10:42:49 -05:00
lasers
f8ff46c2dc add memwithbuffersgraph variable (#671) 2018-10-21 15:52:15 +03:00
Amish Naidu
9b4fc81553 fontN - Predefine font configuration analgous to colorN (#667)
* Add fontN config and text variables

fontN, N in {0..9} allows setting a fontN variable to some font settings
which can later be recalled in text, like colorN.

* Add documentation for fontN

* Add syntax-highlighting config for fontN
2018-10-12 20:43:48 +03:00
lasers
a845a403be doc/variables.xml: add undocumented lock keys 2018-09-04 11:08:26 -05:00
su8
07681e184b Add new variable sysctlbyname for FreeBSD 2018-09-04 10:44:30 -05:00
lasers
887786d746 doc/variables.xml: add undocumented variables 2018-08-31 08:23:19 -05:00
void0
84f136f84a Add new ${github_notifications} variable to count all unread notifications (#637)
* Add new ${github} variable to count all unread notifications

* doc/variables.xml: add github_notifications

* common.cc: Make the "skip" variable static so on each iteration to preserve the current state
2018-08-25 12:07:03 -04:00
su8
5980fb4a52 misc.cc: Evaluate the result and then parse it to capitalize 2018-08-22 23:13:11 -05:00
su8
d963e0e418 Add ${battery_status} variable to display the battery status 2018-08-22 22:52:39 -05:00
su8
0bc7b80d78 fix missing variables when using multiple out_to_xxx (#628) 2018-08-20 08:32:42 -04:00
su8
0edc80bf9b
Arguments to character-handling functions must be representable as an unsigned char 2018-08-14 12:07:16 +00:00
lasers
eb31df1bef core.cc,linux.cc: add ${iface} (#603)
* core.cc,linux.cc: add ${iface}

* doc/variables.xml: add ${iface}

* Remove code smells

* linux.cc: Add for loop to iterate interfaces

* Index all NICs

* linux.cc: Allow+Remove NIC exclusion

* linux.cc: Remove code smells

* fix code smell

* switch skip by strcmpreturn
2018-08-13 08:09:24 -04:00
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
c9d03fbaa1
Su8 master (#581)
* common.cc,diskio.cc: Display units in "SI" as per https://github.com/brndnmtthws/conky/issues/86 request

* Make the mem* and swap* variables to accept additional argument to print the usage in SI units

* common.cc: Fix indentation

* core.cc: Make the strndup() function call as manifest constant

* Add two more formal parameters to "human_readable()"

* diskio.cc: Restore the multiply of 1024LL

* Move the base multiplying into standalone function

* Use the "apply_base_multiplier()" function where necessary
2018-08-07 12:09:34 -04:00
Brenden Matthews
8aa9c819f3
Conky for mac os master (#579)
* Try to amend #31

* BUILD_WLAN should be available for all OS.

Keep BUILD_WLAN OFF by default for compatibility reasons.

* WLAN-related variables should be available for every OS.

There are some problems (probably null-dereference)

* Fix $wireless_essid crashing conky if no argument provided.

Conky wasn't parsing the argument of the variable as it should, thus wasn't allocating the `dev` member variable.

Also fix some documentation stuff.

* Improve `get_freq` #20

Using the Intel® Power Gadget API (https://software.intel.com/en-us/blogs/2012/12/13/using-the-intel-power-gadget-api-on-mac-os-x) we can now get actual Core frequency and not the constant factory one.

Though, for some weird reason the API gives the same freq for all Cores, thus the |cpu| arg becomes useless.

* Oops, this accidently slipped in

* Introduce BUILD_IPGFREQ build option

This build option has been introduced for one particular reason:

On macOS getting current core-frequency is not supported by the APIs.  A solution is to install Intel's ® Power Gadget which comes with an .app, a Framework and a kernel-extension.  Though, this may trouble some alot, thus introduce BUILD_IPGFREQ.

* Forgot static here.

* Some improvements for get_freq again.

Fix frequency not printing correctly (I wasn't using the divisor)
Add more guards.

* Setup cmake files and project code for Objective-C code #17

We want to use CoreWLAN framework.

* update_cpu_usage() now supports multiple cores

Also, some cleanup.

* Updated default conky config to monitor Mac Networking

* Made Mac Friendly BuildOptions and generic default conky configs

* Undid Xdamage config and cleaned up previous IF statements

* Re-Added XDamage fix

* Finish up the algorithm. I think its now correct. Closes: #33

* Cleanup macro and introduce a no-op free_cpu() function for ALL cpu-related variables

free_cpu() must be implemented for every OS and on all except macOS its a no-op function.

* Reformat, add empty comment.
2018-08-07 11:54:01 -04:00
Brenden Matthews
a78a750dad
Build fix for macOS. (#574) 2018-08-06 18:09:20 -04:00
su8
bd98860640 upspeed/f downspeed/f: Be able to use ${gw_iface} as argument (#571) 2018-08-06 17:48:07 -04:00
su8
2a24fe36db Remove code smells 2018-08-04 23:11:21 +02:00
su8
4155ac253b 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 2018-08-04 22:26:40 +02:00
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
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
Evan
da47868d1e Add cat and catp variables. (#507) 2018-05-19 10:27:10 -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
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
Ashley
6a11147397 Allow up to 99 CPU/cores (#459) 2018-02-06 13:01:55 -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
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
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
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
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
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
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