Compare commits
2 Commits
7aee7c34fb
...
2e63bcff13
Author | SHA1 | Date | |
---|---|---|---|
2e63bcff13 | |||
f6035e710f |
18
pw-lib.el
18
pw-lib.el
@ -219,10 +219,7 @@ otherwise set the volume to the same value for all the related channels."
|
||||
(make-list (length orig-value) float-volume))))))
|
||||
(pw-access-set-properties pw-lib--accessor node-id (list (cons property value))))))
|
||||
|
||||
(defun pw-lib-set-default (object stored-p)
|
||||
"Set PipeWire OBJECT as the default sink or source.
|
||||
If STORED-P is non-nil, set the stored default sink or source,
|
||||
otherwise set the current default sink or source."
|
||||
(defun pw-lib--set-default-node (object stored-p)
|
||||
(let ((suffix (mapconcat #'downcase
|
||||
(split-string (pw-lib-object-value object "media.class") "/")
|
||||
"."))
|
||||
@ -230,4 +227,17 @@ otherwise set the current default sink or source."
|
||||
(node-name (pw-lib-object-value object "node.name")))
|
||||
(pw-access-set-default pw-lib--accessor (concat prefix suffix) node-name)))
|
||||
|
||||
(defun pw-lib-set-default (object stored-p)
|
||||
"Set PipeWire OBJECT as the default sink or source.
|
||||
If STORED-P is non-nil, set the stored default sink or source,
|
||||
otherwise set the current default sink or source."
|
||||
(pcase (pw-lib-object-type object)
|
||||
("Device"
|
||||
(dolist (node (pw-lib-children (pw-lib-object-id object) (pw-lib-bindings) "Node"))
|
||||
(pw-lib--set-default-node node stored-p)))
|
||||
("Node"
|
||||
(pw-lib--set-default-node object stored-p))
|
||||
(_
|
||||
(error "Cannot set this kind of object as default."))))
|
||||
|
||||
(provide 'pw-lib)
|
||||
|
5
pw-ui.el
5
pw-ui.el
@ -212,9 +212,10 @@ object. Otherwise apply it on the default audio sink."
|
||||
(defun pipewire-set-default ()
|
||||
"Set default sink or source.
|
||||
If on a Node in a PipeWire buffer, apply it on the given object.
|
||||
If on a Device, apply it on all its nodes.
|
||||
Otherwise ask for the Node to set as the default Node."
|
||||
(interactive)
|
||||
(let ((object (or (pw-ui--current-object nil '("Node"))
|
||||
(let ((object (or (pw-ui--current-object nil '("Device" "Node"))
|
||||
(let* ((default-node-ids (mapcar #'cdr (pw-lib-default-nodes)))
|
||||
(nodes (cl-remove-if
|
||||
#'(lambda (n) (member (pw-lib-object-id n) default-node-ids))
|
||||
@ -251,7 +252,7 @@ applied on some of them or the buffer:
|
||||
(defun pipewire ()
|
||||
"Display a PipeWire buffer."
|
||||
(interactive)
|
||||
(switch-to-buffer pipewire-buffer)
|
||||
(pop-to-buffer pipewire-buffer)
|
||||
(pipewire-refresh)
|
||||
(pipewire-mode))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user