From c75fb751e4fd18ca8d87b0198e91a1976ffb2f2d Mon Sep 17 00:00:00 2001
From: V3n3RiX <venerix@koprulu.sector>
Date: Sun, 5 Feb 2023 03:15:29 +0000
Subject: gentoo auto-resync : 05:02:2023 - 03:15:29

---
 gui-apps/Manifest.gz                               | Bin 4215 -> 4220 bytes
 gui-apps/waybar/Manifest                           |  10 +-
 .../waybar/files/waybar-0.9.13-libcxx-build.patch  |  36 --
 .../waybar/files/waybar-0.9.17-wireplumber.patch   | 374 +++++++++++++++++++++
 gui-apps/waybar/waybar-0.9.12.ebuild               |  72 ----
 gui-apps/waybar/waybar-0.9.13.ebuild               |  76 -----
 gui-apps/waybar/waybar-0.9.16.ebuild               |   3 +-
 gui-apps/waybar/waybar-0.9.17.ebuild               |  77 +++++
 8 files changed, 457 insertions(+), 191 deletions(-)
 delete mode 100644 gui-apps/waybar/files/waybar-0.9.13-libcxx-build.patch
 create mode 100644 gui-apps/waybar/files/waybar-0.9.17-wireplumber.patch
 delete mode 100644 gui-apps/waybar/waybar-0.9.12.ebuild
 delete mode 100644 gui-apps/waybar/waybar-0.9.13.ebuild
 create mode 100644 gui-apps/waybar/waybar-0.9.17.ebuild

(limited to 'gui-apps')

diff --git a/gui-apps/Manifest.gz b/gui-apps/Manifest.gz
index c17b7de5436a..bbaa42edbc4f 100644
Binary files a/gui-apps/Manifest.gz and b/gui-apps/Manifest.gz differ
diff --git a/gui-apps/waybar/Manifest b/gui-apps/waybar/Manifest
index b96e0f5e01ef..9b7db95dd7c0 100644
--- a/gui-apps/waybar/Manifest
+++ b/gui-apps/waybar/Manifest
@@ -1,9 +1,7 @@
-AUX waybar-0.9.13-libcxx-build.patch 1193 BLAKE2B 71ca297fd87a5b6fcdf5dcaa11de100b2b953e4973c537169c32ca82efdd651cdb5cc22e41bcbc5e18f6b07f4733755f1588a456f47788201ba5368daa1bc356 SHA512 18b7a7ef2d2fd18c5364a5da972a0cd2aef35be05495f365c21fbe368d8d7147bf92db1c4c14373e8cfde8b1a8f71783b527759e982a1ced753f8c9c6a783b0c
-DIST waybar-0.9.12.tar.gz 183392 BLAKE2B 697a2fce74af8337dfbfc8d8823cf4f2acfda6a0dd009cea03ec2b79358a80db0935418436a51e375be2f702e2d53f9f3403ab01cb1e91e246c7e4cc01effdf5 SHA512 c035140ca0d47ae2cbc0313e25dc206c116b5b6f7a4e6192c7d40a9bd0ef18b8bfafdc8aeea2a85d670dccceda1e3942b6b3e3a451f51a6e68d25edf0ccb1b05
-DIST waybar-0.9.13.tar.gz 198160 BLAKE2B 222863b1048d2833be393875cad947647eccde3fcae335c48d4606843b3b9445717c18955351c56779196afaf9a5333ae7f718ea590521a79359372450d494a9 SHA512 d0a87044bcccdd16b1bbb20de750804c06335f11e638d37b5b80b72233e513378ba521f5c9d2c121a78a206877487628a6562cb080dd43eadae27e52d4cf6349
+AUX waybar-0.9.17-wireplumber.patch 15607 BLAKE2B eb5ad8d86cf5881bcaa4bcde7baee10c0c0c6add3005c0e13dcc86fa0e6212d1e49900642edb8ddaff14ee1cfdf338c16e6b06e8c9a94309f0220c1a39dc5703 SHA512 1ab4da1c0f1c5c62a8054a7e7ce8c81141a15abc053fbff8c3d98e78d6934b6dcacd04d52841d0ea98fe7507298d33bf896f0a4ba3a55f4610aec0f9c8e3045b
 DIST waybar-0.9.16.tar.gz 215154 BLAKE2B c1e655dc57d3950472e22b23bd7bb7f96dd5daa1fc1ffee871a3677486f9f41981dbea8f559f8097e9c7bc367b0bcf224119af556ca62006f0e68e380b91fdec SHA512 d89067639de8ad560cd1515bb448f47f5994281b35239f069a2012165c0f83e0a3ae861cffbb93e7636d7d95cece9424e5900d40a06b80e71768aabda5f7b54a
-EBUILD waybar-0.9.12.ebuild 1686 BLAKE2B 74268b2f60c60b2e549f7c2d6fb6c4716ba904851cd3209710e0ceb909c164ba138001a37be8dfa469ce6a30a978bec84ca923167296bdc1fa06c32a1ba4950d SHA512 6e8e552d54d7cd4791dc4a42e18db655b578be3ee9d4ac5dad9406ad0b9ed15dea8c4b6101c0de0b0a24443f6d2e24dd140f054dd56704be82709d3d0501b78f
-EBUILD waybar-0.9.13.ebuild 1738 BLAKE2B ea4c1d9f2d46f0f6e8379152f62b0e8bc34456ba2cb7f83c408627874e4d349d10c5201bba32b39a3b11eb97d9dc64b91a6b103bd651978e03d4bb2740e4cc8a SHA512 76033a85795bb6969e9539713244ad2beb38630eb506ee8080cd4e14c3fcffc58062497f16272c4c4647ceea5f3d71d5dcf664d189e50f822ccc2a990b4e8ec6
-EBUILD waybar-0.9.16.ebuild 1701 BLAKE2B 1def271ef1a013cb75c9cba3043667abad1bc2b3b027f2160561ce5fffcf14ce20d017bb9c2be7429560da7e84bd9133e0cc418d0e5aeb32b6101a67f969d56b SHA512 c72daf205b0867316c45dbb1dcd4d77b1aa1d0a8c7adee281a96a4f050b4458def94f7213cd32deaad9f8b4fa4f1844b922d9369642a640dc10665c13ee738de
+DIST waybar-0.9.17.tar.gz 220836 BLAKE2B 78a9065f4b20c1047ce5296c8eb3b6d05ecb1e4b9994b250937e7f681cf6d7f773a5de59189544eab90ad91cfd2abf170ec76c1b125a1d7b09a22f8a7a9d43e0 SHA512 51aba7649c0e2ad3ccf22f6ede3cdf9be9c84268d31d39c5eac62e150e3b115f5560b70ebd54242fd856abec0cca5eba405f1ec153cac4cd6623523f6b19189f
+EBUILD waybar-0.9.16.ebuild 1724 BLAKE2B f5ed70964a390e5ee8970ec8b90c5510d2ce8643bce7d9143e9f725fc878fdde7517d7f570ad05abbcdda5d202099400dfb88e97c2458efc9a1ef706cd299545 SHA512 0c05b7ccef38626b964b493c2aca14aefee022e85d9b963f00db9cbb04b09adf423863301f3a1ae0f2822bcb2a0677afde79d78b3acd6a13d4caa04e369afe7b
+EBUILD waybar-0.9.17.ebuild 1784 BLAKE2B d1a5381088407105efe98e931343995dace4e2edae39b46cb384b4c11ebc6b13443488dd7c779a9275d6d7e8d4cbd003acdf6eacdeb95b7f91ecaf67a5d0858d SHA512 dfe159672a5a191f8299b50723ea09c9311bb5fbd826b284cdd40b48379675ef4ccc7c8ce20012d86caa40b5ceb712f8b3ef07cacc5af9c86d6073dec0e18b45
 EBUILD waybar-9999.ebuild 1632 BLAKE2B a3b478c3aab3a41e0df3d06d93bc76d3fe20f187b29c9d56e61535a0cf5b0ff2a93bc40d0d90bfc88b800ee28ac7829422482728b0edb2ca0501a36d3a97228d SHA512 708c52f2030a5c72aa4c56bd0e1871633bb3641bfe3b77d518c2ac7907966663c4dcac1fccfc6ab4e16e27a96f41d09658911fae4fdf259ac822c069c62630c4
 MISC metadata.xml 1280 BLAKE2B 83dcff4c9798e9a6013b1b74894095cd07802373cc9b7d0230d3ab1ef9f574f0701053314a8906fbe0074946b90763afc322e3ec921e78b5703304bc22e8f5c1 SHA512 fcd07931cee04e7050e9f7cf2e711a5ff1194f10aa602ad222e19e2708d701cd8c0fb9535c42282715abaac2c85d5456e5bc8058f0f96bd716245114316f1d17
diff --git a/gui-apps/waybar/files/waybar-0.9.13-libcxx-build.patch b/gui-apps/waybar/files/waybar-0.9.13-libcxx-build.patch
deleted file mode 100644
index ad24e22fc437..000000000000
--- a/gui-apps/waybar/files/waybar-0.9.13-libcxx-build.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-https://github.com/Alexays/Waybar/commit/d25278f710a4932798c98141bcf5b482de0e9166
-
-From: Jan Beich <jbeich@FreeBSD.org>
-Date: Mon, 23 May 2022 16:23:00 +0000
-Subject: [PATCH] fix(upower): add missing include for libc++
-
-In file included from src/modules/upower/upower.cpp:1:
-include/modules/upower/upower.hpp:25:16: error: no template named 'unordered_map' in namespace 'std'
-  typedef std::unordered_map<std::string, UpDevice *> Devices;
-          ~~~~~^
-In file included from src/modules/upower/upower_tooltip.cpp:1:
-include/modules/upower/upower_tooltip.hpp:13:16: error: no template named 'unordered_map' in namespace 'std'
-  typedef std::unordered_map<std::string, UpDevice*> Devices;
-          ~~~~~^
---- a/include/modules/upower/upower.hpp
-+++ b/include/modules/upower/upower.hpp
-@@ -5,6 +5,7 @@
- #include <iostream>
- #include <map>
- #include <string>
-+#include <unordered_map>
- 
- #include "ALabel.hpp"
- #include "glibconfig.h"
---- a/include/modules/upower/upower_tooltip.hpp
-+++ b/include/modules/upower/upower_tooltip.hpp
-@@ -2,6 +2,8 @@
- 
- #include <libupower-glib/upower.h>
- 
-+#include <unordered_map>
-+
- #include "gtkmm/box.h"
- #include "gtkmm/label.h"
- #include "gtkmm/window.h"
-
diff --git a/gui-apps/waybar/files/waybar-0.9.17-wireplumber.patch b/gui-apps/waybar/files/waybar-0.9.17-wireplumber.patch
new file mode 100644
index 000000000000..9db19e2a2b5d
--- /dev/null
+++ b/gui-apps/waybar/files/waybar-0.9.17-wireplumber.patch
@@ -0,0 +1,374 @@
+Commit: https://github.com/Alexays/Waybar/commit/4e8ccf36b54cacf5281726d23ea14312a133f977
+Commit: https://github.com/Alexays/Waybar/commit/8da5425189d52ebbaab063c9289c5de5adbe0ca5
+Issue: https://github.com/Alexays/Waybar/issues/1852
+From 4e8ccf36b54cacf5281726d23ea14312a133f977 Mon Sep 17 00:00:00 2001
+From: Sasha Moak <sasha.moak@gmail.com>
+Date: Thu, 12 Jan 2023 16:17:11 -0800
+Subject: [PATCH] fix(wireplumber): waybar crashes when default node changes
+
+In order to fix the issue, the default node name is cached rather than
+the default node id. This is due to ids being unstable. So now when the
+object manager is installed (ie ready), the default node name is
+retrieved and stored for later.
+
+Now when the mixer changed signal is emitted, the id of the changed node
+is used to get the node from the object manager. The nodes name is
+grabbed off that node and compared against the default node name, if
+they match the volume is updated. Some safeguarding has been added such
+that if the node cannot be found off the object manager, it's ignored.
+
+Additionally, the "changed" signal on the default nodes api is now
+utilized to update the default node name if it has changed. This way if
+the default node changes, the module will be updated with the correct
+volume and node.nick.
+
+This adds additional debug logging for helping diagnose wireplumber
+issues.
+
+This also adds the wireplumber man page entry to the main waybar
+supported section.
+---
+ include/modules/wireplumber.hpp |  10 +-
+ man/waybar.5.scd.in             |   1 +
+ src/modules/wireplumber.cpp     | 184 ++++++++++++++++++++++++++------
+ 3 files changed, 157 insertions(+), 38 deletions(-)
+
+diff --git a/include/modules/wireplumber.hpp b/include/modules/wireplumber.hpp
+index c0ee7f0be..fa988fcf3 100644
+--- a/include/modules/wireplumber.hpp
++++ b/include/modules/wireplumber.hpp
+@@ -20,15 +20,19 @@ class Wireplumber : public ALabel {
+   void loadRequiredApiModules();
+   void prepare();
+   void activatePlugins();
+-  static void updateVolume(waybar::modules::Wireplumber* self);
+-  static void updateNodeName(waybar::modules::Wireplumber* self);
+-  static uint32_t getDefaultNodeId(waybar::modules::Wireplumber* self);
++  static void updateVolume(waybar::modules::Wireplumber* self, uint32_t id);
++  static void updateNodeName(waybar::modules::Wireplumber* self, uint32_t id);
+   static void onPluginActivated(WpObject* p, GAsyncResult* res, waybar::modules::Wireplumber* self);
+   static void onObjectManagerInstalled(waybar::modules::Wireplumber* self);
++  static void onMixerChanged(waybar::modules::Wireplumber* self, uint32_t id);
++  static void onDefaultNodesApiChanged(waybar::modules::Wireplumber* self);
+ 
+   WpCore* wp_core_;
+   GPtrArray* apis_;
+   WpObjectManager* om_;
++  WpPlugin* mixer_api_;
++  WpPlugin* def_nodes_api_;
++  gchar* default_node_name_;
+   uint32_t pending_plugins_;
+   bool muted_;
+   double volume_;
+diff --git a/man/waybar.5.scd.in b/man/waybar.5.scd.in
+index b1ed4c527..7566dd000 100644
+--- a/man/waybar.5.scd.in
++++ b/man/waybar.5.scd.in
+@@ -277,6 +277,7 @@ A module group is defined by specifying a module named "group/some-group-name".
+ - *waybar-sway-scratchpad(5)*
+ - *waybar-sway-window(5)*
+ - *waybar-sway-workspaces(5)*
++- *waybar-wireplumber(5)*
+ - *waybar-wlr-taskbar(5)*
+ - *waybar-wlr-workspaces(5)*
+ - *waybar-temperature(5)*
+diff --git a/src/modules/wireplumber.cpp b/src/modules/wireplumber.cpp
+index 9a12a9b5b..9652e1e2b 100644
+--- a/src/modules/wireplumber.cpp
++++ b/src/modules/wireplumber.cpp
+@@ -1,15 +1,22 @@
+ #include "modules/wireplumber.hpp"
+ 
++#include <spdlog/spdlog.h>
++
++bool isValidNodeId(uint32_t id) { return id > 0 && id < G_MAXUINT32; }
++
+ waybar::modules::Wireplumber::Wireplumber(const std::string& id, const Json::Value& config)
+     : ALabel(config, "wireplumber", id, "{volume}%"),
+       wp_core_(nullptr),
+       apis_(nullptr),
+       om_(nullptr),
++      mixer_api_(nullptr),
++      def_nodes_api_(nullptr),
++      default_node_name_(nullptr),
+       pending_plugins_(0),
+       muted_(false),
+       volume_(0.0),
+       node_id_(0) {
+-  wp_init(WP_INIT_ALL);
++  wp_init(WP_INIT_PIPEWIRE);
+   wp_core_ = wp_core_new(NULL, NULL);
+   apis_ = g_ptr_array_new_with_free_func(g_object_unref);
+   om_ = wp_object_manager_new();
+@@ -18,10 +25,15 @@ waybar::modules::Wireplumber::Wireplumber(const std::string& id, const Json::Val
+ 
+   loadRequiredApiModules();
+ 
++  spdlog::debug("[{}]: connecting to pipewire...", this->name_);
++
+   if (!wp_core_connect(wp_core_)) {
++    spdlog::error("[{}]: Could not connect to PipeWire", this->name_);
+     throw std::runtime_error("Could not connect to PipeWire\n");
+   }
+ 
++  spdlog::debug("[{}]: connected!", this->name_);
++
+   g_signal_connect_swapped(om_, "installed", (GCallback)onObjectManagerInstalled, this);
+ 
+   activatePlugins();
+@@ -33,33 +45,26 @@ waybar::modules::Wireplumber::~Wireplumber() {
+   g_clear_pointer(&apis_, g_ptr_array_unref);
+   g_clear_object(&om_);
+   g_clear_object(&wp_core_);
++  g_clear_object(&mixer_api_);
++  g_clear_object(&def_nodes_api_);
++  g_free(&default_node_name_);
+ }
+ 
+-uint32_t waybar::modules::Wireplumber::getDefaultNodeId(waybar::modules::Wireplumber* self) {
+-  uint32_t id;
+-  g_autoptr(WpPlugin) def_nodes_api = wp_plugin_find(self->wp_core_, "default-nodes-api");
++void waybar::modules::Wireplumber::updateNodeName(waybar::modules::Wireplumber* self, uint32_t id) {
++  spdlog::debug("[{}]: updating node name with node.id {}", self->name_, id);
+ 
+-  if (!def_nodes_api) {
+-    throw std::runtime_error("Default nodes API is not loaded\n");
++  if (!isValidNodeId(id)) {
++    spdlog::warn("[{}]: '{}' is not a valid node ID. Ignoring node name update.", self->name_, id);
++    return;
+   }
+ 
+-  g_signal_emit_by_name(def_nodes_api, "get-default-node", "Audio/Sink", &id);
+-
+-  if (id <= 0 || id >= G_MAXUINT32) {
+-    auto err = fmt::format("'{}' is not a valid ID (returned by default-nodes-api)\n", id);
+-    throw std::runtime_error(err);
+-  }
+-
+-  return id;
+-}
+-
+-void waybar::modules::Wireplumber::updateNodeName(waybar::modules::Wireplumber* self) {
+-  auto proxy = static_cast<WpProxy*>(
+-      wp_object_manager_lookup(self->om_, WP_TYPE_GLOBAL_PROXY, WP_CONSTRAINT_TYPE_G_PROPERTY,
+-                               "bound-id", "=u", self->node_id_, NULL));
++  auto proxy = static_cast<WpProxy*>(wp_object_manager_lookup(
++      self->om_, WP_TYPE_GLOBAL_PROXY, WP_CONSTRAINT_TYPE_G_PROPERTY, "bound-id", "=u", id, NULL));
+ 
+   if (!proxy) {
+-    throw std::runtime_error(fmt::format("Object '{}' not found\n", self->node_id_));
++    auto err = fmt::format("Object '{}' not found\n", id);
++    spdlog::error("[{}]: {}", self->name_, err);
++    throw std::runtime_error(err);
+   }
+ 
+   g_autoptr(WpProperties) properties =
+@@ -73,15 +78,24 @@ void waybar::modules::Wireplumber::updateNodeName(waybar::modules::Wireplumber*
+   auto description = wp_properties_get(properties, "node.description");
+ 
+   self->node_name_ = nick ? nick : description;
++  spdlog::debug("[{}]: Updating node name to: {}", self->name_, self->node_name_);
+ }
+ 
+-void waybar::modules::Wireplumber::updateVolume(waybar::modules::Wireplumber* self) {
++void waybar::modules::Wireplumber::updateVolume(waybar::modules::Wireplumber* self, uint32_t id) {
++  spdlog::debug("[{}]: updating volume", self->name_);
+   double vol;
+   GVariant* variant = NULL;
+-  g_autoptr(WpPlugin) mixer_api = wp_plugin_find(self->wp_core_, "mixer-api");
+-  g_signal_emit_by_name(mixer_api, "get-volume", self->node_id_, &variant);
++
++  if (!isValidNodeId(id)) {
++    spdlog::error("[{}]: '{}' is not a valid node ID. Ignoring volume update.", self->name_, id);
++    return;
++  }
++
++  g_signal_emit_by_name(self->mixer_api_, "get-volume", id, &variant);
++
+   if (!variant) {
+-    auto err = fmt::format("Node {} does not support volume\n", self->node_id_);
++    auto err = fmt::format("Node {} does not support volume\n", id);
++    spdlog::error("[{}]: {}", self->name_, err);
+     throw std::runtime_error(err);
+   }
+ 
+@@ -93,22 +107,121 @@ void waybar::modules::Wireplumber::updateVolume(waybar::modules::Wireplumber* se
+   self->dp.emit();
+ }
+ 
++void waybar::modules::Wireplumber::onMixerChanged(waybar::modules::Wireplumber* self, uint32_t id) {
++  spdlog::debug("[{}]: (onMixerChanged) - id: {}", self->name_, id);
++
++  g_autoptr(WpNode) node = static_cast<WpNode*>(wp_object_manager_lookup(
++      self->om_, WP_TYPE_NODE, WP_CONSTRAINT_TYPE_G_PROPERTY, "bound-id", "=u", id, NULL));
++
++  if (!node) {
++    spdlog::warn("[{}]: (onMixerChanged) - Object with id {} not found", self->name_, id);
++    return;
++  }
++
++  const gchar* name = wp_pipewire_object_get_property(WP_PIPEWIRE_OBJECT(node), "node.name");
++
++  if (g_strcmp0(self->default_node_name_, name) != 0) {
++    spdlog::debug(
++        "[{}]: (onMixerChanged) - ignoring mixer update for node: id: {}, name: {} as it is not "
++        "the default node: {}",
++        self->name_, id, name, self->default_node_name_);
++    return;
++  }
++
++  spdlog::debug("[{}]: (onMixerChanged) - Need to update volume for node with id {} and name {}",
++                self->name_, id, name);
++  updateVolume(self, id);
++}
++
++void waybar::modules::Wireplumber::onDefaultNodesApiChanged(waybar::modules::Wireplumber* self) {
++  spdlog::debug("[{}]: (onDefaultNodesApiChanged)", self->name_);
++
++  uint32_t default_node_id;
++  g_signal_emit_by_name(self->def_nodes_api_, "get-default-node", "Audio/Sink", &default_node_id);
++
++  if (!isValidNodeId(default_node_id)) {
++    spdlog::warn("[{}]: '{}' is not a valid node ID. Ignoring node change.", self->name_,
++                 default_node_id);
++    return;
++  }
++
++  g_autoptr(WpNode) node = static_cast<WpNode*>(
++      wp_object_manager_lookup(self->om_, WP_TYPE_NODE, WP_CONSTRAINT_TYPE_G_PROPERTY, "bound-id",
++                               "=u", default_node_id, NULL));
++
++  if (!node) {
++    spdlog::warn("[{}]: (onDefaultNodesApiChanged) - Object with id {} not found", self->name_,
++                 default_node_id);
++    return;
++  }
++
++  const gchar* default_node_name =
++      wp_pipewire_object_get_property(WP_PIPEWIRE_OBJECT(node), "node.name");
++
++  spdlog::debug(
++      "[{}]: (onDefaultNodesApiChanged) - got the following default node: Node(name: {}, id: {})",
++      self->name_, default_node_name, default_node_id);
++
++  if (g_strcmp0(self->default_node_name_, default_node_name) == 0) {
++    spdlog::debug(
++        "[{}]: (onDefaultNodesApiChanged) - Default node has not changed. Node(name: {}, id: {}). "
++        "Ignoring.",
++        self->name_, self->default_node_name_, default_node_id);
++    return;
++  }
++
++  spdlog::debug(
++      "[{}]: (onDefaultNodesApiChanged) - Default node changed to -> Node(name: {}, id: {})",
++      self->name_, default_node_name, default_node_id);
++
++  self->default_node_name_ = g_strdup(default_node_name);
++  updateVolume(self, default_node_id);
++  updateNodeName(self, default_node_id);
++}
++
+ void waybar::modules::Wireplumber::onObjectManagerInstalled(waybar::modules::Wireplumber* self) {
+-  self->node_id_ =
+-      self->config_["node-id"].isInt() ? self->config_["node-id"].asInt() : getDefaultNodeId(self);
++  spdlog::debug("[{}]: onObjectManagerInstalled", self->name_);
++
++  self->def_nodes_api_ = wp_plugin_find(self->wp_core_, "default-nodes-api");
++
++  if (!self->def_nodes_api_) {
++    spdlog::error("[{}]: default nodes api is not loaded.", self->name_);
++    throw std::runtime_error("Default nodes API is not loaded\n");
++  }
++
++  self->mixer_api_ = wp_plugin_find(self->wp_core_, "mixer-api");
++
++  if (!self->mixer_api_) {
++    spdlog::error("[{}]: mixer api is not loaded.", self->name_);
++    throw std::runtime_error("Mixer api is not loaded\n");
++  }
++
++  uint32_t default_node_id;
++  g_signal_emit_by_name(self->def_nodes_api_, "get-default-configured-node-name", "Audio/Sink",
++                        &self->default_node_name_);
++  g_signal_emit_by_name(self->def_nodes_api_, "get-default-node", "Audio/Sink", &default_node_id);
++
++  if (self->default_node_name_) {
++    spdlog::debug("[{}]: (onObjectManagerInstalled) - default configured node name: {} and id: {}",
++                  self->name_, self->default_node_name_, default_node_id);
++  }
+ 
+-  g_autoptr(WpPlugin) mixer_api = wp_plugin_find(self->wp_core_, "mixer-api");
++  updateVolume(self, default_node_id);
++  updateNodeName(self, default_node_id);
+ 
+-  updateVolume(self);
+-  updateNodeName(self);
+-  g_signal_connect_swapped(mixer_api, "changed", (GCallback)updateVolume, self);
++  g_signal_connect_swapped(self->mixer_api_, "changed", (GCallback)onMixerChanged, self);
++  g_signal_connect_swapped(self->def_nodes_api_, "changed", (GCallback)onDefaultNodesApiChanged,
++                           self);
+ }
+ 
+ void waybar::modules::Wireplumber::onPluginActivated(WpObject* p, GAsyncResult* res,
+                                                      waybar::modules::Wireplumber* self) {
++  auto plugin_name = wp_plugin_get_name(WP_PLUGIN(p));
++  spdlog::debug("[{}]: onPluginActivated: {}", self->name_, plugin_name);
+   g_autoptr(GError) error = NULL;
+ 
+   if (!wp_object_activate_finish(p, res, &error)) {
++    spdlog::error("[{}]: error activating plugin: {}", self->name_, error->message);
+     throw std::runtime_error(error->message);
+   }
+ 
+@@ -118,6 +231,7 @@ void waybar::modules::Wireplumber::onPluginActivated(WpObject* p, GAsyncResult*
+ }
+ 
+ void waybar::modules::Wireplumber::activatePlugins() {
++  spdlog::debug("[{}]: activating plugins", name_);
+   for (uint16_t i = 0; i < apis_->len; i++) {
+     WpPlugin* plugin = static_cast<WpPlugin*>(g_ptr_array_index(apis_, i));
+     pending_plugins_++;
+@@ -127,13 +241,13 @@ void waybar::modules::Wireplumber::activatePlugins() {
+ }
+ 
+ void waybar::modules::Wireplumber::prepare() {
+-  wp_object_manager_add_interest(om_, WP_TYPE_NODE, NULL);
+-  wp_object_manager_add_interest(om_, WP_TYPE_GLOBAL_PROXY, NULL);
+-  wp_object_manager_request_object_features(om_, WP_TYPE_GLOBAL_PROXY,
+-                                            WP_PIPEWIRE_OBJECT_FEATURES_MINIMAL);
++  spdlog::debug("[{}]: preparing object manager", name_);
++  wp_object_manager_add_interest(om_, WP_TYPE_NODE, WP_CONSTRAINT_TYPE_PW_PROPERTY, "media.class",
++                                 "=s", "Audio/Sink", NULL);
+ }
+ 
+ void waybar::modules::Wireplumber::loadRequiredApiModules() {
++  spdlog::debug("[{}]: loading required modules", name_);
+   g_autoptr(GError) error = NULL;
+ 
+   if (!wp_core_load_component(wp_core_, "libwireplumber-module-default-nodes-api", "module", NULL,
+From a9c9f1d705991c7f6ff9de7eac3430a219011978 Mon Sep 17 00:00:00 2001
+From: Sasha Moak <sasha.moak@gmail.com>
+Date: Tue, 31 Jan 2023 17:56:58 -0800
+Subject: [PATCH] fix(wireplumber): free(): invalid pointer
+
+When freeing the `default_node_name_` pointer using `free`, the `&`
+operator was used to try to free the reference rather than the pointer.
+This caused a core dump. In order to fix this, the pointer is freed
+instead (ie the `&` operator is no longer used).
+---
+ src/modules/wireplumber.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/modules/wireplumber.cpp b/src/modules/wireplumber.cpp
+index fd1a0d389..4c7a2d0b1 100644
+--- a/src/modules/wireplumber.cpp
++++ b/src/modules/wireplumber.cpp
+@@ -47,7 +47,7 @@ waybar::modules::Wireplumber::~Wireplumber() {
+   g_clear_object(&wp_core_);
+   g_clear_object(&mixer_api_);
+   g_clear_object(&def_nodes_api_);
+-  g_free(&default_node_name_);
++  g_free(default_node_name_);
+ }
+
+ void waybar::modules::Wireplumber::updateNodeName(waybar::modules::Wireplumber* self, uint32_t id) {
diff --git a/gui-apps/waybar/waybar-0.9.12.ebuild b/gui-apps/waybar/waybar-0.9.12.ebuild
deleted file mode 100644
index 6fbac657f700..000000000000
--- a/gui-apps/waybar/waybar-0.9.12.ebuild
+++ /dev/null
@@ -1,72 +0,0 @@
-# Copyright 1999-2022 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-inherit meson
-
-DESCRIPTION="Highly customizable Wayland bar for Sway and Wlroots based compositors"
-HOMEPAGE="https://github.com/Alexays/Waybar"
-
-if [[ ${PV} == 9999 ]]; then
-	inherit git-r3
-	EGIT_REPO_URI="https://github.com/Alexays/${PN^}.git"
-else
-	SRC_URI="https://github.com/Alexays/${PN^}/archive/${PV}.tar.gz -> ${P}.tar.gz"
-	KEYWORDS="~amd64"
-fi
-S="${WORKDIR}/${PN^}-${PV}"
-
-LICENSE="MIT"
-SLOT="0"
-IUSE="mpd network +popups pulseaudio sndio tray +udev wifi"
-
-BDEPEND="
-	>=app-text/scdoc-1.9.2
-	dev-util/gdbus-codegen
-	virtual/pkgconfig
-"
-DEPEND="
-	dev-cpp/cairomm:0
-	dev-cpp/glibmm:2
-	dev-cpp/gtkmm:3.0
-	dev-libs/glib:2
-	dev-libs/jsoncpp:=
-	dev-libs/libinput:=
-	dev-libs/libsigc++:2
-	>=dev-libs/libfmt-7.0.0:=
-	<dev-libs/libfmt-9.0.0:=
-	>=dev-libs/spdlog-1.8.5:=
-	dev-libs/date:=
-	dev-libs/wayland
-	dev-libs/wayland-protocols
-	gui-libs/wlroots:=
-	x11-libs/gtk+:3[wayland]
-	x11-libs/libxkbcommon
-	mpd? ( media-libs/libmpdclient )
-	network? ( dev-libs/libnl:3 )
-	popups? ( gui-libs/gtk-layer-shell )
-	pulseaudio? ( media-sound/pulseaudio )
-	sndio? ( media-sound/sndio:= )
-	tray? (
-		dev-libs/libdbusmenu[gtk3]
-		dev-libs/libappindicator
-	)
-	udev? ( virtual/libudev:= )
-	wifi? ( || ( sys-apps/util-linux net-wireless/rfkill ) )
-"
-RDEPEND="${DEPEND}"
-
-src_configure() {
-	local emesonargs=(
-		$(meson_feature mpd)
-		$(meson_feature network libnl)
-		$(meson_feature popups gtk-layer-shell)
-		$(meson_feature pulseaudio)
-		$(meson_feature sndio)
-		$(meson_feature tray dbusmenu-gtk)
-		$(meson_feature udev libudev)
-		$(meson_feature wifi rfkill)
-	)
-	meson_src_configure
-}
diff --git a/gui-apps/waybar/waybar-0.9.13.ebuild b/gui-apps/waybar/waybar-0.9.13.ebuild
deleted file mode 100644
index c4886a844841..000000000000
--- a/gui-apps/waybar/waybar-0.9.13.ebuild
+++ /dev/null
@@ -1,76 +0,0 @@
-# Copyright 1999-2022 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-inherit meson
-
-DESCRIPTION="Highly customizable Wayland bar for Sway and Wlroots based compositors"
-HOMEPAGE="https://github.com/Alexays/Waybar"
-
-if [[ ${PV} == 9999 ]]; then
-	inherit git-r3
-	EGIT_REPO_URI="https://github.com/Alexays/${PN^}.git"
-else
-	SRC_URI="https://github.com/Alexays/${PN^}/archive/${PV}.tar.gz -> ${P}.tar.gz"
-	KEYWORDS="~amd64"
-fi
-S="${WORKDIR}/${PN^}-${PV}"
-
-LICENSE="MIT"
-SLOT="0"
-IUSE="mpd network +popups pulseaudio sndio tray +udev wifi"
-
-BDEPEND="
-	>=app-text/scdoc-1.9.2
-	dev-util/gdbus-codegen
-	virtual/pkgconfig
-"
-DEPEND="
-	dev-cpp/cairomm:0
-	dev-cpp/glibmm:2
-	dev-cpp/gtkmm:3.0
-	dev-libs/glib:2
-	dev-libs/jsoncpp:=
-	dev-libs/libinput:=
-	dev-libs/libsigc++:2
-	>=dev-libs/libfmt-7.0.0:=
-	<dev-libs/libfmt-9.0.0:=
-	>=dev-libs/spdlog-1.8.5:=
-	dev-libs/date:=
-	dev-libs/wayland
-	dev-libs/wayland-protocols
-	gui-libs/wlroots:=
-	x11-libs/gtk+:3[wayland]
-	x11-libs/libxkbcommon
-	mpd? ( media-libs/libmpdclient )
-	network? ( dev-libs/libnl:3 )
-	popups? ( gui-libs/gtk-layer-shell )
-	pulseaudio? ( media-sound/pulseaudio )
-	sndio? ( media-sound/sndio:= )
-	tray? (
-		dev-libs/libdbusmenu[gtk3]
-		dev-libs/libappindicator
-	)
-	udev? ( virtual/libudev:= )
-	wifi? ( || ( sys-apps/util-linux net-wireless/rfkill ) )
-"
-RDEPEND="${DEPEND}"
-
-PATCHES=(
-	"${FILESDIR}"/${P}-libcxx-build.patch
-)
-
-src_configure() {
-	local emesonargs=(
-		$(meson_feature mpd)
-		$(meson_feature network libnl)
-		$(meson_feature popups gtk-layer-shell)
-		$(meson_feature pulseaudio)
-		$(meson_feature sndio)
-		$(meson_feature tray dbusmenu-gtk)
-		$(meson_feature udev libudev)
-		$(meson_feature wifi rfkill)
-	)
-	meson_src_configure
-}
diff --git a/gui-apps/waybar/waybar-0.9.16.ebuild b/gui-apps/waybar/waybar-0.9.16.ebuild
index 006b9fc848cb..ed6e3ca97877 100644
--- a/gui-apps/waybar/waybar-0.9.16.ebuild
+++ b/gui-apps/waybar/waybar-0.9.16.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -23,6 +23,7 @@ IUSE="experimental mpd network +popups pulseaudio sndio tray +udev wifi"
 
 BDEPEND="
 	>=app-text/scdoc-1.9.2
+	>=dev-cpp/catch-3.0.0
 	dev-util/gdbus-codegen
 	virtual/pkgconfig
 "
diff --git a/gui-apps/waybar/waybar-0.9.17.ebuild b/gui-apps/waybar/waybar-0.9.17.ebuild
new file mode 100644
index 000000000000..9d2f830e6558
--- /dev/null
+++ b/gui-apps/waybar/waybar-0.9.17.ebuild
@@ -0,0 +1,77 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit meson
+
+DESCRIPTION="Highly customizable Wayland bar for Sway and Wlroots based compositors"
+HOMEPAGE="https://github.com/Alexays/Waybar"
+
+if [[ ${PV} == 9999 ]]; then
+	inherit git-r3
+	EGIT_REPO_URI="https://github.com/Alexays/${PN^}.git"
+else
+	SRC_URI="https://github.com/Alexays/${PN^}/archive/${PV}.tar.gz -> ${P}.tar.gz"
+	KEYWORDS="~amd64"
+fi
+S="${WORKDIR}/${PN^}-${PV}"
+
+LICENSE="MIT"
+SLOT="0"
+IUSE="experimental mpd network +popups pulseaudio sndio tray +udev wifi"
+
+BDEPEND="
+	>=app-text/scdoc-1.9.2
+	>=dev-cpp/catch-3.0.1
+	dev-util/gdbus-codegen
+	virtual/pkgconfig
+"
+DEPEND="
+	dev-cpp/cairomm:0
+	dev-cpp/glibmm:2
+	dev-cpp/gtkmm:3.0
+	dev-libs/glib:2
+	dev-libs/jsoncpp:=
+	dev-libs/libinput:=
+	dev-libs/libsigc++:2
+	>=dev-libs/libfmt-7.0.0:=
+	>=dev-libs/spdlog-1.8.5:=
+	dev-libs/date:=
+	dev-libs/wayland
+	dev-libs/wayland-protocols
+	gui-libs/wlroots:=
+	x11-libs/gtk+:3[wayland]
+	x11-libs/libxkbcommon
+	mpd? ( media-libs/libmpdclient )
+	network? ( dev-libs/libnl:3 )
+	popups? ( gui-libs/gtk-layer-shell )
+	pulseaudio? ( media-sound/pulseaudio )
+	sndio? ( media-sound/sndio:= )
+	tray? (
+		dev-libs/libdbusmenu[gtk3]
+		dev-libs/libappindicator
+	)
+	udev? ( virtual/libudev:= )
+	wifi? ( || ( sys-apps/util-linux net-wireless/rfkill ) )
+"
+RDEPEND="${DEPEND}"
+
+PATCHES=(
+	"${FILESDIR}/waybar-0.9.17-wireplumber.patch"
+)
+
+src_configure() {
+	local emesonargs=(
+		$(meson_feature mpd)
+		$(meson_feature network libnl)
+		$(meson_feature popups gtk-layer-shell)
+		$(meson_feature pulseaudio)
+		$(meson_feature sndio)
+		$(meson_feature tray dbusmenu-gtk)
+		$(meson_feature udev libudev)
+		$(meson_feature wifi rfkill)
+		$(meson_use experimental)
+	)
+	meson_src_configure
+}
-- 
cgit v1.2.3