The current documentation for the custom module suggests mixing manual
(`{icon}`) and automatic (`{}`) indexing of format args. Newer versions
of the fmt library seem to not support this anymore (see issue #3605).
This commit introduces a name for the `text` output of the script, so
that `{text}` can now be used instead of `{}` in the configuration.
While looping over all the upower devices, the currently set device that will be rendered in the waybar, is overridden. Since the loop doesn't end when the device is found, the upDevice_ is overridden with NULL in the iteration for the next device.
Now we only override upDevice_ if the current device matches the constraints.
Fixes d2a719d67c ("Redo to minimize code duplication.")
Fixes#3267
Hyprland hasn't been using TCP sockets for IPC since the first release,
so this getaddrinfo call and its result was never needed.
Additionally, it leaks the `aiRes`, causing test failure under ASan.
First of all in case when the number CPUs change
prevent out-of-bound index access in
waybar::modules::CpuUsage::getCpuUsage()
Secondly on Linux when updating CPU usage
read /sys/devices/system/cpu/present
and use it to detect the offline CPUs missing from /proc/stat
For offline CPUs report 0 usage and "offline" in the tooltip
Fixes issue #3498
On Linux one can test this functionality with:
echo 0 > /sys/devices/system/cpu/cpu1/online
echo 1 > /sys/devices/system/cpu/cpu1/online
On non-Linux OSes I'm not sure how to detect offline CPUs,
so I didn't add the offline CPU detection there
but at least CPU number change should not cause a crash there anymore
or cause memory safety issues after this fix
Right now, for the tooltip, all times are shifted if shift-down/shift-up
actions are used. But it really only makes sense for this to apply to
the {calendar} replacement, so use shiftedNow there and now for all
the rest.
Allows us to disable modules entirely when socket connection isn't
working. This is similar to how sway handles their socket connections
disabling modules. This supports a single waybar config for multiple
IPCs.
Since fmt 11.0.0, formatter:format() is required to be const. Mark
all of the specializations as const to be compatible with fmt 11.
This change is implemented in the same spirit of 7725f6ed5a.
Signed-off-by: Kefu Chai <tchaikov@gmail.com>