pkgsrc-WIP-changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
waybar: update to 0.15.0
Module Name: pkgsrc-wip
Committed By: kikadf <kikadf.01%gmail.com@localhost>
Pushed By: kikadf
Date: Mon May 25 11:24:23 2026 +0200
Changeset: 79512c09c064ef9074332fae9a18d69fe4fdcd99
Modified Files:
waybar/Makefile
waybar/distinfo
waybar/patches/patch-meson.build
waybar/patches/patch-src_modules_battery.cpp
Added Files:
waybar/patches/patch-include_modules_battery.hpp
waybar/patches/patch-include_util_udev__deleter.hpp
waybar/patches/patch-src_factory.cpp
waybar/patches/patch-src_modules_cpu__frequency_bsd.cpp
Log Message:
waybar: update to 0.15.0
To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=79512c09c064ef9074332fae9a18d69fe4fdcd99
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
diffstat:
waybar/Makefile | 4 +-
waybar/distinfo | 14 ++--
waybar/patches/patch-include_modules_battery.hpp | 18 ++++
.../patches/patch-include_util_udev__deleter.hpp | 21 +++++
waybar/patches/patch-meson.build | 18 +++-
waybar/patches/patch-src_factory.cpp | 24 ++++++
waybar/patches/patch-src_modules_battery.cpp | 95 ++++++++++++----------
.../patch-src_modules_cpu__frequency_bsd.cpp | 28 +++++++
8 files changed, 170 insertions(+), 52 deletions(-)
diffs:
diff --git a/waybar/Makefile b/waybar/Makefile
index b9bced531d..09c61618b8 100644
--- a/waybar/Makefile
+++ b/waybar/Makefile
@@ -1,7 +1,7 @@
# $NetBSD$
-DISTNAME= waybar-0.14.0
-CATEGORIES= x11
+DISTNAME= waybar-0.15.0
+CATEGORIES= wayland
MASTER_SITES= ${MASTER_SITE_GITHUB:=Alexays/}
GITHUB_PROJECT= Waybar
GITHUB_TAG= ${PKGVERSION_NOREV}
diff --git a/waybar/distinfo b/waybar/distinfo
index 223221b646..45fea6b05e 100644
--- a/waybar/distinfo
+++ b/waybar/distinfo
@@ -1,10 +1,14 @@
$NetBSD$
-BLAKE2s (waybar-0.14.0.tar.gz) = 11cff6a2a8923fdc41d055203c00e115c555e9ad45ac613c56ebcfa8c9bd8ad1
-SHA512 (waybar-0.14.0.tar.gz) = dc3d18f7117be8cce5979029110770699b0d9d737337c3cf27361d6ceda6fcde33dac9781e406a70eb24c9e0e95e3801d47e81d44bfb61c311510fb30dd975a7
-Size (waybar-0.14.0.tar.gz) = 341661 bytes
-SHA1 (patch-meson.build) = f954e53a9e904e8500044e764b78fbf61ad27ed6
-SHA1 (patch-src_modules_battery.cpp) = 99668d01253a9be6dcfe544899325a906ffb6a4b
+BLAKE2s (waybar-0.15.0.tar.gz) = 59b011bb71da6acc9b3ee333f6ab9bbb4ccbb22b1627112b53b13135db4baa22
+SHA512 (waybar-0.15.0.tar.gz) = f267c1ad2af1e4e74c3d8c966009a013c0b5c2849bfaf312b3b91e9d6f6856dc5466118f308208948118ea1de0cf70986cc3b592cc830f84d634b8518c5b8c9e
+Size (waybar-0.15.0.tar.gz) = 355671 bytes
+SHA1 (patch-include_modules_battery.hpp) = 3bebca10de357bc25a70d26d677a8f7717d3b495
+SHA1 (patch-include_util_udev__deleter.hpp) = 8f95df3fc76f9f7461fe4576994c6fdfacb3b91b
+SHA1 (patch-meson.build) = 3c081f5d65408b0703eec9f7239e54942b89e9b0
+SHA1 (patch-src_factory.cpp) = de849a029ac8b51381bbe4b94ea59ab9c94c44ef
+SHA1 (patch-src_modules_battery.cpp) = 0b4483af30c912a5ebaae94ea329123b63a4580a
+SHA1 (patch-src_modules_cpu__frequency_bsd.cpp) = 9ad194942940b2b38b0f01d6a96408cd23969269
SHA1 (patch-src_modules_custom.cpp) = 644740e4862444b7ed33523affe5d97e5fcbdd32
SHA1 (patch-src_modules_simpleclock.cpp) = 7ffa485e5cc9033e090d46133654243cbd1b3f8d
SHA1 (patch-src_modules_user.cpp) = 7b9d5578a64d2b1fefbecd650549c5e9f8ea19ad
diff --git a/waybar/patches/patch-include_modules_battery.hpp b/waybar/patches/patch-include_modules_battery.hpp
new file mode 100644
index 0000000000..0279b84667
--- /dev/null
+++ b/waybar/patches/patch-include_modules_battery.hpp
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Use udev only for linux
+
+--- include/modules/battery.hpp.orig 2026-05-24 09:20:05.456525925 +0000
++++ include/modules/battery.hpp
+@@ -40,9 +40,11 @@ class Battery : public ALabel {
+ void processEvents(std::string& state, std::string& status, uint8_t capacity);
+
+ std::map<fs::path, int> batteries_;
++#ifdef HAVE_LIBUDEV
+ std::unique_ptr<udev, util::UdevDeleter> udev_;
+ std::array<pollfd, 1> poll_fds_;
+ std::unique_ptr<udev_monitor, util::UdevMonitorDeleter> mon_;
++#endif
+ fs::path adapter_;
+ int battery_watch_fd_;
+ std::mutex battery_list_mutex_;
diff --git a/waybar/patches/patch-include_util_udev__deleter.hpp b/waybar/patches/patch-include_util_udev__deleter.hpp
new file mode 100644
index 0000000000..c73f2d1c70
--- /dev/null
+++ b/waybar/patches/patch-include_util_udev__deleter.hpp
@@ -0,0 +1,21 @@
+$NetBSD$
+
+* Use udev only for linux
+
+--- include/util/udev_deleter.hpp.orig 2026-05-24 09:05:13.454406135 +0000
++++ include/util/udev_deleter.hpp
+@@ -1,5 +1,6 @@
+ #pragma once
+
++#ifdef HAVE_LIBUDEV
+ #include <libudev.h>
+
+ namespace waybar::util {
+@@ -18,4 +19,5 @@ struct UdevEnumerateDeleter {
+ struct UdevMonitorDeleter {
+ void operator()(udev_monitor* ptr) const { udev_monitor_unref(ptr); }
+ };
+-} // namespace waybar::util
+\ No newline at end of file
++} // namespace waybar::util
++#endif // HAVE_LIBUDEV
diff --git a/waybar/patches/patch-meson.build b/waybar/patches/patch-meson.build
index 5f9c7c5fca..462b314d2e 100644
--- a/waybar/patches/patch-meson.build
+++ b/waybar/patches/patch-meson.build
@@ -3,8 +3,20 @@ $NetBSD$
* Build battery on NetBSD, link with -lprop
* Config files to examples
---- meson.build.orig 2025-08-08 07:15:22.000000000 +0000
+--- meson.build.orig 2026-02-06 20:15:03.000000000 +0000
+++ meson.build
+@@ -26,9 +26,9 @@ elif compiler.has_link_argument('-lstdc+
+ cpp_link_args += ['-lstdc++fs']
+ endif
+
+-git = find_program('git', native: true, required: false)
++########################git = find_program('git', native: true, required: false)
+
+-if not git.found()
++if not false
+ add_project_arguments('-DVERSION="@0@"'.format(meson.project_version()), language: 'cpp')
+ else
+ git_path = run_command(git, 'rev-parse', '--show-toplevel', check: false).stdout().strip()
@@ -58,15 +58,19 @@ if compiler.links(code, name : 'nl_langi
add_project_arguments('-DHAVE_LANGINFO_1STDAY', language: 'cpp')
endif
@@ -27,7 +39,7 @@ $NetBSD$
+
thread_dep = dependency('threads')
fmt = dependency('fmt', version : ['>=8.1.1'], fallback : ['fmt', 'fmt_dep'])
- spdlog = dependency('spdlog', version : ['>=1.10.0'], fallback : ['spdlog', 'spdlog_dep'], default_options : ['external_fmt=enabled', 'std_format=disabled', 'tests=disabled'])
+ spdlog = dependency('spdlog', version : ['>=1.15.2'], fallback : ['spdlog', 'spdlog_dep'], default_options : ['std_format=disabled', 'tests=disabled'])
@@ -245,7 +249,7 @@ elif is_dragonfly or is_freebsd or is_ne
'man/waybar-cpu.5.scd',
'man/waybar-memory.5.scd',
@@ -37,7 +49,7 @@ $NetBSD$
src_files += files('src/modules/battery.cpp')
man_files += files('man/waybar-battery.5.scd')
endif
-@@ -563,7 +567,8 @@ executable(
+@@ -572,7 +576,8 @@ executable(
install_data(
'resources/config.jsonc',
'resources/style.css',
diff --git a/waybar/patches/patch-src_factory.cpp b/waybar/patches/patch-src_factory.cpp
new file mode 100644
index 0000000000..eaa08836da
--- /dev/null
+++ b/waybar/patches/patch-src_factory.cpp
@@ -0,0 +1,24 @@
+$NetBSD$
+
+* Enable battery module on NetBSD
+
+--- src/factory.cpp.orig 2026-05-24 09:08:08.278804792 +0000
++++ src/factory.cpp
+@@ -46,7 +46,7 @@
+ #include "modules/wayfire/window.hpp"
+ #include "modules/wayfire/workspaces.hpp"
+ #endif
+-#if defined(__FreeBSD__) || defined(__linux__)
++#if defined(__FreeBSD__) || defined(__linux__) || defined(__NetBSD__)
+ #include "modules/battery.hpp"
+ #endif
+ #if defined(HAVE_CPU_LINUX) || defined(HAVE_CPU_BSD)
+@@ -129,7 +129,7 @@ waybar::AModule* waybar::Factory::makeMo
+ auto hash_pos = name.find('#');
+ auto ref = name.substr(0, hash_pos);
+ auto id = hash_pos != std::string::npos ? name.substr(hash_pos + 1) : "";
+-#if defined(__FreeBSD__) || defined(__linux__)
++#if defined(__FreeBSD__) || defined(__linux__) || defined(__NetBSD__)
+ if (ref == "battery") {
+ return new waybar::modules::Battery(id, bar_, config_[name]);
+ }
diff --git a/waybar/patches/patch-src_modules_battery.cpp b/waybar/patches/patch-src_modules_battery.cpp
index 9382246ca4..37ddb785f0 100644
--- a/waybar/patches/patch-src_modules_battery.cpp
+++ b/waybar/patches/patch-src_modules_battery.cpp
@@ -1,10 +1,11 @@
$NetBSD$
* Add NetBSD support
+* Use udev only for linux
---- src/modules/battery.cpp.orig 2025-08-08 07:15:22.000000000 +0000
+--- src/modules/battery.cpp.orig 2026-02-06 20:15:03.000000000 +0000
+++ src/modules/battery.cpp
-@@ -2,6 +2,7 @@
+@@ -2,15 +2,79 @@
#include <algorithm>
#include <cctype>
@@ -12,10 +13,16 @@ $NetBSD$
#include "util/command.hpp"
#if defined(__FreeBSD__)
-@@ -9,6 +10,67 @@
+ #include <sys/sysctl.h>
#endif
- #include <spdlog/spdlog.h>
-
++#ifdef HAVE_LIBUDEV
+ #include <libudev.h>
+ #include <poll.h>
+-#include <spdlog/spdlog.h>
+ #include <sys/signalfd.h>
++#endif
++#include <spdlog/spdlog.h>
++
+#if defined(__NetBSD__)
+#include <fcntl.h>
+#include <unistd.h>
@@ -46,7 +53,7 @@ $NetBSD$
+ prop_object_release(dict);
+ return nullptr;
+ }
-+
++
+ array = (prop_array_t)obj;
+ prop_object_retain(array);
+ prop_object_release(dict);
@@ -56,9 +63,9 @@ $NetBSD$
+
+static int64_t handle_stat(prop_dictionary_t stat, const char * key) {
+ prop_object_t obj;
-+
-+ if ((stat == nullptr || key == nullptr) ||
-+ ((obj = prop_dictionary_get(stat, key)) == nullptr) ||
++
++ if ((stat == nullptr || key == nullptr) ||
++ ((obj = prop_dictionary_get(stat, key)) == nullptr) ||
+ (prop_object_type(obj) != PROP_TYPE_NUMBER))
+ { return -1; }
+
@@ -69,18 +76,17 @@ $NetBSD$
+ prop_object_t obj;
+
+ if ((stat == nullptr) ||
-+ ((obj = prop_dictionary_get(stat, "state")) == nullptr) ||
++ ((obj = prop_dictionary_get(stat, "state")) == nullptr) ||
+ (prop_object_type(obj) != PROP_TYPE_STRING))
+ { return false; }
+
+ return prop_string_equals_string((prop_string_t)obj, "valid");
+}
+#endif
-+
+
waybar::modules::Battery::Battery(const std::string& id, const Bar& bar, const Json::Value& config)
: ALabel(config, "battery", id, "{capacity}%", 60), last_event_(""), bar_(bar) {
- #if defined(__linux__)
-@@ -54,7 +116,7 @@ waybar::modules::Battery::~Battery() {
+@@ -56,7 +120,7 @@ waybar::modules::Battery::~Battery() {
}
void waybar::modules::Battery::worker() {
@@ -89,7 +95,7 @@ $NetBSD$
thread_timer_ = [this] {
dp.emit();
thread_timer_.sleep_for(interval_);
-@@ -240,6 +302,77 @@ waybar::modules::Battery::getInfos() {
+@@ -248,6 +312,82 @@ waybar::modules::Battery::getInfos() {
// spdlog::info("{} {} {} {}", capacity,time,status,rate);
return {capacity, time / 60.0, status, rate, 0, 0.0F};
@@ -100,21 +106,22 @@ $NetBSD$
+ prop_object_iterator_t iter;
+ prop_dictionary_t id;
+ prop_string_t desc;
-+ uint8_t cur_charge = 0;
-+ uint8_t max_charge = 0;
-+ uint8_t charge_rate = 0;
++ int32_t cur_charge = 0;
++ int32_t max_charge = 0;
++ int32_t last_max_charge = 0;
++ int32_t charge_rate = 0;
++ int32_t discharge_rate = 0;
+ std::string status;
-+ uint8_t capacity;
++ int32_t capacity;
+ float time_remaining;
+ float power;
-+ bool is_present = false;
+
+ if ((bat = get_device("acpibat0")) == nullptr) {
-+ throw std::runtime_error("get acpibat0 device info failed");
++ throw std::runtime_error("get acpibat0 device info failed");
+ }
+ if ((iter = prop_array_iterator(bat)) == nullptr) {
-+ prop_object_release(bat);
-+ throw std::runtime_error("prop_array_iterator failed");
++ prop_object_release(bat);
++ throw std::runtime_error("prop_array_iterator failed");
+ }
+ while ((id = (prop_dictionary_t)prop_object_iterator_next(iter)) != nullptr) {
+ desc = (prop_string_t)prop_dictionary_get(id, "description");
@@ -122,52 +129,56 @@ $NetBSD$
+ if (prop_string_equals_string(desc, "charge")) {
+ cur_charge = handle_stat(id, "cur-value");
+ max_charge = handle_stat(id, "max-value");
++ } else if (prop_string_equals_string(desc, "last full cap")) {
++ if (stat_is_valid(id)) last_max_charge = handle_stat(id, "cur-value");
+ } else if (prop_string_equals_string(desc, "charge rate")) {
+ if (stat_is_valid(id)) charge_rate = handle_stat(id, "cur-value");
+ } else if (prop_string_equals_string(desc, "discharge rate")) {
-+ if (stat_is_valid(id)) charge_rate = handle_stat(id, "cur-value");
-+ } else if (prop_string_equals_string(desc, "present")) {
-+ is_present = (handle_stat(id, "cur-value") == 1);
++ if (stat_is_valid(id)) discharge_rate = handle_stat(id, "cur-value");
+ }
+ }
+ prop_object_iterator_release(iter);
+ prop_object_release(bat);
+
-+ if (charge_rate == 0) {
++ spdlog::info("{} {} {} {}", max_charge,cur_charge,charge_rate,discharge_rate);
++
++ if (max_charge <= 0) max_charge = last_max_charge;
++ if (charge_rate == 0 && discharge_rate == 0) {
+ time_remaining = 0.0;
+ power = 0.0;
+ } else {
-+ time_remaining = ((max_charge - cur_charge) * 60) / charge_rate;
-+ power = charge_rate;
++ if (charge_rate) {
++ time_remaining = -(float)(max_charge - cur_charge) / (float)charge_rate;
++ power = charge_rate;
++ } else {
++ time_remaining = -(float)cur_charge / (float)discharge_rate;
++ power = discharge_rate;
++ }
+ }
+
+ capacity = (cur_charge * 100) / max_charge;
+ // Handle full-at
+ if (config_["full-at"].isUInt()) {
-+ auto full_at = config_["full-at"].asUInt();
-+ if (full_at < 100) {
-+ capacity = 100.f * capacity / full_at;
-+ }
++ auto full_at = config_["full-at"].asUInt();
++ if (full_at < 100) {
++ capacity = 100.f * capacity / full_at;
++ }
+ }
+ if (capacity > 100.f) {
-+ // This can happen when the battery is calibrating and goes above 100%
-+ // Handle it gracefully by clamping at 100%
-+ capacity = 100.f;
-+ }
-+ if (!is_present) {
-+ time_remaining = 0.0;
-+ power = 0.0;
-+ capacity = 0;
++ // This can happen when the battery is calibrating and goes above 100%
++ // Handle it gracefully by clamping at 100%
++ capacity = 100.f;
+ }
++
+ status = getAdapterStatus(capacity);
+
-+ // spdlog::info("{} {} {} {}", capacity,time_remaining,status,power);
++ spdlog::info("{} {} {} {}", capacity,time_remaining,status,power);
+ return {capacity, time_remaining, status, power, 0, 0.0F};
+
#elif defined(__linux__)
uint32_t total_power = 0; // μW
bool total_power_exists = false;
-@@ -632,6 +765,38 @@ const std::string waybar::modules::Batte
+@@ -639,6 +779,38 @@ const std::string waybar::modules::Batte
bool online = state == 2;
std::string status{"Unknown"}; // TODO: add status in FreeBSD
{
diff --git a/waybar/patches/patch-src_modules_cpu__frequency_bsd.cpp b/waybar/patches/patch-src_modules_cpu__frequency_bsd.cpp
new file mode 100644
index 0000000000..7afc262ba9
--- /dev/null
+++ b/waybar/patches/patch-src_modules_cpu__frequency_bsd.cpp
@@ -0,0 +1,28 @@
+$NetBSD$
+
+* Add NetBSD support
+
+--- src/modules/cpu_frequency/bsd.cpp.orig 2026-05-25 08:52:26.638052357 +0000
++++ src/modules/cpu_frequency/bsd.cpp
+@@ -8,7 +8,7 @@ std::vector<float> waybar::modules::CpuF
+ size_t len;
+ int32_t freq;
+
+-#ifndef __OpenBSD__
++#if defined(__FreeBSD__)
+ char buffer[256];
+ uint32_t i = 0;
+ while (true) {
+@@ -18,7 +18,11 @@ std::vector<float> waybar::modules::CpuF
+ frequencies.push_back(freq);
+ ++i;
+ }
+-#else
++#elif defined(__NetBSD__)
++ if (sysctlbyname("machdep.cpu.frequency.current", &freq, &len, NULL, 0) == 0) {
++ frequencies.push_back((float)freq);
++ }
++#elif defined(__OpenBSD__)
+ int getMhz[] = {CTL_HW, HW_CPUSPEED};
+ len = sizeof(freq);
+ sysctl(getMhz, 2, &freq, &len, NULL, 0);
Home |
Main Index |
Thread Index |
Old Index