1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-12-26 12:27:52 +00:00
Commit Graph

2766 Commits

Author SHA1 Message Date
Brenden Matthews
aac26b549e Fix long/short cpu stat init
Fixes #1630.
2023-09-30 17:20:45 -04:00
Ben Kibbey
53973402b4 hwmon: Fix device name path for some devices. 2023-09-27 08:17:45 -04:00
François Revol
c781b42f66 X11: Fix segfault on SIGINT
deinit_x11() was called too late, and it seems some libs like xinerama
and xcb-render add cleanup hooks but forget to remove them when they get
unloaded.
2023-08-12 10:04:24 -04:00
François Revol
16b89074d7 Fix Haiku build
Missing new OS-specific call, stubbed for now.
2023-08-08 08:40:51 -04:00
François Revol
8f403251a8 Fix missing asprintf definition on Haiku
It needs _GNU_SOURCE and is declared in stdio.h as on GNU/Linux,
but I suppose it's not included by the existing includes.
2023-08-08 08:40:51 -04:00
François Revol
2bd267da31 Fix build without X11
On Haiku it complained about missing X11 header.
2023-08-08 08:40:51 -04:00
Brenden Matthews
1592881663
Fix the words
per 00166b49b5 (commitcomment-113653843)
2023-05-17 19:47:51 -04:00
Guido Falsi
796802b7a9 Fix build on FreeBSD.
The freq_sysctl varaible is being redefined with a different type.

Update the first definition directly.
2023-05-17 22:29:45 +00:00
bi4k8
c406177d43 core: reset selected_font when clearing fonts 2023-05-09 21:08:35 +00:00
bi4k8
00166b49b5 text_object: fix typo in cutesy error message 2023-05-09 02:26:29 +00:00
bi4k8
faba25d197 logging: define CRIT_ERR_FREE and simplify CRIT_ERR
it's surprising to pass 2 nullptr arguments at most of the callsites of a logging function, so instead let callers explicitly state whether they have auxiliary data to free
2023-05-09 02:26:29 +00:00
bi4k8
19e779cdf9 core, logging: remove clean_up_without_threads and simplify clean_up 2023-05-09 02:26:29 +00:00
bi4k8
863bd2441b logging: remove unused THREAD_CRIT_ERR 2023-05-09 02:26:29 +00:00
bi4k8
74de272dce i8k: allocate i8k_procbuf after opening /proc/i8k
this lets us simplify error handling
2023-05-09 02:26:29 +00:00
bi4k8
48154e9805 i8k: do not consider failing to open /proc/i8k fatal
this also fixes the segfault that would happen in the main loop after `clean_up_without_threads` (#945)
2023-05-09 02:26:29 +00:00
bi4k8
804631f848 i8k: print 'error' for i8k variables if /proc/i8k could not be read
this behavior was already present for the status variables but not others
2023-05-09 02:26:29 +00:00
bi4k8
feb6a08537 freebsd: infallibly allocate 16B buffer on stack
there's no need to call calloc() for 16B, nor do we need to error-handle that allocation with exit()
2023-05-09 02:26:29 +00:00
bi4k8
7fa3d113da top: do not print ${top mem 1} as inf if $mem not used 2023-05-05 01:40:41 +00:00
bi4k8
b874ba0d5c
display-wayland: avoid crash when font has no family specified (#1498)
Co-authored-by: bi4k8 <bi4k8@github>
2023-04-10 17:43:46 +00:00
bi4k8
df16eeabf6
gradient: initialize alpha when converting from rgb (#1491)
this fixes tests that ended up comparing zero alpha to an unitialized alpha value

also improve reporting so that failing color comparison tests will print the color in hex

Co-authored-by: bi4k8 <bi4k8@github>
2023-04-05 09:07:32 -04:00
bi4k8
dab87c5246
Fix memory leaks in X11 display backend (#1483)
* display-x11: fix memory leaks

FcFini() was never being called, which meant FontConfig did not clean up its internal storage.

furthermore, restore a commented-out call to XftFontClose()

9acf0bb4c commented this call out, but it does not seem to cause any problems now on reload now

* feat: Move docs to website, rearrange bits (#1475)

* build(deps): bump actions/stale from 7 to 8 (#1472)

Bumps [actions/stale](https://github.com/actions/stale) from 7 to 8.
- [Release notes](https://github.com/actions/stale/releases)
- [Changelog](https://github.com/actions/stale/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/stale/compare/v7...v8)

---
updated-dependencies:
- dependency-name: actions/stale
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Add fontconfig platform checks

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: bi4k8 <bi4k8@github>
Co-authored-by: Brenden Matthews <brenden@brndn.io>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Brenden Matthews <github@brenden.brndn.io>
2023-03-31 12:54:20 -04:00
bi4k8
3b1c9a7cc1
ncurses color fixes (#1482)
* specials: avoid duplicating color specials when both ncurses and a graphical output are enabled

* ncurses: fix black

we previously used the ncurses color as the id for its color pair, but this scheme needs to be shifted by one to avoid using the invalid 0 color-pair id for black (color id 0)

---------

Co-authored-by: bi4k8 <bi4k8@github>
2023-03-31 12:52:59 -04:00
bi4k8
4a40eef51a
display-output: allow no outputs (#1481)
some users rely on this behavior, which quietly changed in 281097a2a5

Co-authored-by: bi4k8 <bi4k8@github>
2023-03-31 12:52:48 -04:00
bi4k8
30eda7e5d0
colours: parse 3-digit colour specifications again (#1480)
Co-authored-by: bi4k8 <bi4k8@github>
2023-03-31 12:52:37 -04:00
bi4k8
2fb7d47039
gradients: fix saturation/luma calculations for 32-bit systems (#1470)
* gradients: fix saturation calculation for 32-bit systems

this multiplication has two 512 scale factors as well as 360 and a color difference of up to 255. as such, it can overflow 32 bits, which results in an incorrect saturation value being computed

cast to uint64_t so we have enough bits to multiply without overflow

* gradients: fix luma calculation for 32-bit systems

this multiplication has 0-255 colors at 512 scale factor being multiplied by 10000 (summed across components), then multiplied by 360

this multiplication (360 * 10000 * 255 * 512) overflows a long on 32-bit systems, computing the wrong luma value

cast to uint64_t so we have enough bits to multiply without overflow

---------

Co-authored-by: bi4k8 <bi4k8@github>
2023-03-25 08:28:10 -04:00
bi4k8
566fbe7187
Fix and test graph parsing (#1447)
* specials: comment all parser cases

* specials: scan_graph: early-return if args is null

* specials: fix logic in scan_graph

* tests: add scan_graph parsing test

* specials: separate command parsing from graph parsing

this simplifies the implementation of graph parsing and makes it less ambiguous to parse graphs in contexts where commands are not expected

* specials: tweak comments in scan_graph

* tests: update for scan_command separation

---------

Co-authored-by: bi4k8 <bi4k8@github>
2023-03-05 19:25:56 -05:00
bi4k8
8f0a21bcc0 colours: cache X11 pixel values
now that we allocate these as-needed when converting colours to the X11 representation, we need to avoid reallocating the same colour over and over; cache them so we only allocate each colour once
2023-03-04 11:00:35 -05:00
Brenden Matthews
55947d0182 Don't prefix mouse hook with conky_ twice.
This fixes #1438.
2023-02-28 22:37:31 -05:00
Brenden Matthews
de3bd0c2eb Add some colour tests. 2023-02-24 19:41:02 -05:00
Brenden Matthews
a39015b7bd
Apply clang-format. 2023-02-24 08:43:15 -05:00
Brenden Matthews
a21a8f7d26 Build fixes for strict checks.
This fixes #1419.
2023-02-24 08:35:13 -05:00
bi4k8
4a7bec5ba6
Premultiply background colors for X11 (#1421)
* initialize XColor/XftColor

this does not change behavior, but avoids passing uninitialized data to X/Xft functions

* gui, x11: move have_argb_visual to x11 files

this variable only has meaning with respect to X11

* x11: clear have_argb_visual if the setting changes to false

otherwise, we may try to use colors with alpha when we no longer requested a 32-bit visual

* x11: premultiply alpha of background colors

* x11: clean up set_foreground_color a bit

---------

Co-authored-by: bi4k8 <bi4k8@github>
2023-02-24 08:13:48 -05:00
bi4k8
5e98c49c4c
use new Colour type for specials and gradients (#1418)
* gradient, colours: use 24-bit colour depth internally on Wayland

our Colour type assumes this anyway; lower colour depth should be handled by display backends

* core: restore gradient color computation

this was mistakenly disabled when moving to a unified Colour representation

* core, gradient: use Colour type

* tests: gradient: always test hsv/hcl

colour computations no longer depend on the display backends we compile with, so these can be tested unconditionally now

* gradients, specials: use Color type

this makes specials now accept color names as well as hex codes, and removes all notions of color depth from gradient calculations

---------

Co-authored-by: bi4k8 <bi4k8@github>
2023-02-24 08:13:19 -05:00
Brenden Matthews
f3b7b1f189
Unbreak Xinerama config loading. (#1408)
This resolves #1364 and #1372.
2023-02-18 09:34:53 -05:00
Brenden Matthews
06f000d9da
Enable GCC 12 in actions, fix warning. (#1407)
* Enable GCC 12 in actions, fix warning.

This resolves #1406.
2023-02-18 08:33:11 -05:00
tranquillity-codes
4b8d5eb34a
Add an above-all overlay mode for own_window_type, utility (#1402)
* Add libXdamage to flake.nix

* Add TYPE_UTILITY as above-all alternative to TYPE_OVERRIDE

* Click-through for TYPE_UTILITY

* Added libxfixes to MacOS CI workflow

* Disable building of XFIXES on MacOS

* Fix build for xinerama/xfixes on macos.

* Update Lua version check.

* Tidy this up.

* Fix BUILD_XFIXES on Linux

* Sigh, fix this.

---------

Co-authored-by: tranquillity-codes <dev@itycodes.org>
Co-authored-by: Brenden Matthews <brenden@brndn.io>
2023-02-16 22:03:14 -05:00
Brenden Matthews
4807d3c68d Fix a couple security nits from codeql
See:
- https://github.com/brndnmtthws/conky/security/code-scanning/1
- https://github.com/brndnmtthws/conky/security/code-scanning/2
- https://github.com/brndnmtthws/conky/security/code-scanning/3
2023-02-14 21:43:45 -05:00
bi4k8
fe27753929 move color settings to their own file
these settings are used for GUI builds as well as ncurses builds, and if we support colors in console and HTTP output, will be used there too

colors really are essential to what Conky does, even if some outputs don't support them, so it makes sense to build support for them unconditionally
2023-02-06 10:15:34 -05:00
bi4k8
9b2706fc49 build x11-color.cc for any GUI, not just wayland
we should actually build this for ncurses and html backends too, not just GUI ones
2023-02-06 10:15:34 -05:00
bi4k8
9ab51edf9f ncurses: allocate custom colors
color0-9 will now use their configured RGB values exactly
2023-02-06 10:15:34 -05:00
bi4k8
d51bf688ba ncurses: call init_pair immediately before using colors
this allows using color0, etc. in ncurses; the nearest available ncurses color will be used
2023-02-06 10:15:34 -05:00
bi4k8
9cc4b083fc core: avoid argb32 roundtrips when calling set_current_text_color 2023-02-06 10:15:34 -05:00
bi4k8
ec24079a3a remove x11 dependency for color parsing
this means we can use the same, portable color-parsing code
everywhere, including ncurses
2023-02-06 10:15:34 -05:00
bi4k8
a72902fa35 add Colour type and use it pervasively 2023-02-06 10:15:34 -05:00
bi4k8
d3e9bcbe71 wayland: use arithmetic instead of wrong-endian memcpy
this fixes corruption of parsed colors in Wayland-only builds
2023-01-04 07:59:33 -05:00
bi4k8
31b4c27abc use ARGB, not RGBA, for Wayland color values
this impacts only colors from which we compute Cairo colors, not the
rendered pixel buffers themselves, which were already and remain
ARGB32.

this makes Wayland and (24-bit) X11 use the same representation of
colors, fixing bugs when both backends were enabled.

we should still eventually switch to a backend-independent color
representation, because there are no guarantees of which pixel format
X11 will use (it isn't alway ARGB32) and backends like ncurses have
their own color representation; in most code we just hope the
unsigned long will be interpreted by the same backend as wrote it.
2023-01-03 08:35:23 -05:00
bi4k8
1c95c6d577 wayland: trigger window resize when scale changes
scale changes are applied by window_resize, so we need to make
sure it gets called when the scale has changed.
2023-01-03 08:34:35 -05:00
Tin Švagelj
7fbdfbd4d4
Added mouse events to conky (#955)
* Add mouse events.

Signed-off-by: Tin Svagelj <tin.svagelj@live.com>

* Rename MOUSE_EVENTS flag to BUILD_MOUSE_EVENTS.

Signed-off-by: Tin Svagelj <tin.svagelj@live.com>

* Update NORM_ERR func argument from std::string to char*

Because func was previously char* I forgot to update NORM_ERR function
argument to `func.c_str()` not that it's std::string.

Previously func was pointing to std::string memory that was freed at
assignment.

Signed-off-by: Tin Svagelj <tin.svagelj@live.com>

Signed-off-by: Tin Svagelj <tin.svagelj@live.com>
2023-01-01 12:39:57 -05:00
Brenden Matthews
0e61013ac9 Fix these warns. 2022-12-27 09:15:29 -05:00
Brenden Matthews
3e827ba82f Fix this def. 2022-12-27 09:15:29 -05:00