From b6f9754600eb588a30e0dc46c7b84b5c58479e58 Mon Sep 17 00:00:00 2001 From: Milan Zamazal Date: Tue, 28 Jun 2022 20:55:10 +0200 Subject: [PATCH] Report the node name of the muted port --- pw-lib.el | 8 +++++++- pw-ui.el | 4 +++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/pw-lib.el b/pw-lib.el index 8a62055..08ff030 100644 --- a/pw-lib.el +++ b/pw-lib.el @@ -113,10 +113,16 @@ returned from `pw-lib-profiles'. " (error "Index of %s profile of device %s not found" profile device-id)) (pw-access-set-profile pw-lib--accessor device-id index)))) +(defun pw-lib-parent-node (object) + "Return parent node of `object'. +This is typically used for ports. +Behavior is undefined if `object' has no parent node." + (pw-lib-get-object (pw-lib-object-value object "node.id"))) + (defun pw-lib--node (object) (if (equal (pw-lib-object-type object) "Node") object - (pw-lib-get-object (pw-lib-object-value object "node.id")))) + (pw-lib-parent-node object))) (defun pw-lib--node-parameters (object-or-id &optional refresh) (let* ((object (if (numberp object-or-id) diff --git a/pw-ui.el b/pw-ui.el index daadc63..b2c70a5 100644 --- a/pw-ui.el +++ b/pw-ui.el @@ -252,7 +252,9 @@ The indicator is displayed only on graphical terminals." 'face `(:background ,pipewire-osd-volume-off-color))))))) (defun pw-ui--update-muted (object muted-p) - (pw-ui--update (format "%s %s" (pw-ui--object-name object) (if muted-p "muted" "unmuted")))) + (let ((object-name (pw-ui--object-name object)) + (node-name (pw-ui--object-name (pw-lib-parent-node object)))) + (pw-ui--update (format "%s in %s %s" object-name node-name (if muted-p "muted" "unmuted"))))) ;;;###autoload (defun pipewire-toggle-muted ()