summaryrefslogtreecommitdiff
path: root/sysutils/conky/files/patch-src_freebsd.cc
diff options
context:
space:
mode:
authorGuido Falsi <madpilot@FreeBSD.org>2022-10-13 20:22:58 +0200
committerGuido Falsi <madpilot@FreeBSD.org>2022-10-13 20:22:58 +0200
commitcf75f452e94a2eb6da98eabc5b9e002f138e4051 (patch)
tree729feb3a8955217f1b40e623ce7a6b33e3131f7d /sysutils/conky/files/patch-src_freebsd.cc
parentbsd.default-versions.mk: Sort, and update the lang_DEFAULT check list (diff)
sysutils/conky: Update to 1.14.0
- Add patch implementing missing function for FreeBSD, already proposed upstream: https://github.com/brndnmtthws/conky/pull/1252 - Updated dependencies, upstream changed its documentation build method Old html documentation has been removed, the information is now encoded in yaml files. Upstream code does not provide a method to automatically produce human readable documentation from the yaml files, so I install those directly in PORTDOCS.
Diffstat (limited to '')
-rw-r--r--sysutils/conky/files/patch-src_freebsd.cc30
1 files changed, 30 insertions, 0 deletions
diff --git a/sysutils/conky/files/patch-src_freebsd.cc b/sysutils/conky/files/patch-src_freebsd.cc
new file mode 100644
index 000000000000..2b9fc160c295
--- /dev/null
+++ b/sysutils/conky/files/patch-src_freebsd.cc
@@ -0,0 +1,30 @@
+--- src/freebsd.cc.orig 2022-10-12 18:18:08 UTC
++++ src/freebsd.cc
+@@ -460,6 +460,27 @@ int get_battery_perct(const char *) {
+ return batcapacity;
+ }
+
++void get_battery_power_draw(char *buffer, unsigned int n, const char *bat) {
++ int rate = 0;
++ double ret = 0;
++
++ /*
++ * hw.acpi.battery.rate returns battery discharge rate in mW,
++ * or -1 (according to docs, but also 0 in practice) when not discharging.
++ *
++ * ref. acpi_battery(4)
++ */
++ if (GETSYSCTL("hw.acpi.battery.rate", rate)) {
++ fprintf(stderr, "Cannot read sysctl \"hw.acpi.battery.rate\"\n");
++ }
++
++ if (rate > 0) {
++ ret = (double)rate/(double)1000;
++ }
++
++ snprintf(buffer, n, "%.1f", ret);
++}
++
+ double get_battery_perct_bar(struct text_object *obj) {
+ int batperct = get_battery_perct(obj->data.s);
+ return batperct;