Change volume of playback ports by default

This seems to be more correct than changing volume of the whole sink.
The default volume of the sink is 1 (100) and alsamixer also changes
volume of the ports.
main
Milan Zamazal 8 months ago
parent 2d76e595a9
commit cd1a8beeab

@ -150,6 +150,13 @@ version, call `pw-lib-refresh' first."
"Return a PipeWire object that is the current default audio sink."
(pw-lib-get-object (cdr (assoc "default.audio.sink" (pw-lib-default-nodes)))))
(defun pw-lib-default-playback-ports ()
"Return list of PipeWire objects that are default playback ports."
(cl-remove-if-not #'(lambda (o)
(if-let ((name (pw-lib-object-value o "port.name")))
(string-match "^playback" name)))
(pw-lib-children (pw-lib-object-id (pw-lib-default-audio-sink)) "Port")))
(defun pw-lib--volume-% (volume)
(when volume
(round (* 100 volume))))

@ -164,7 +164,8 @@ The indicator is displayed only on graphical terminals."
(not (member (pw-lib-object-type object) allowed-types)))
(setq object nil))
(when (and use-default-p (not object))
(setq object (pw-lib-default-audio-sink)))
(setq object (or (car (pw-lib-default-playback-ports))
(pw-lib-default-audio-sink))))
object))
(defvar pw-ui--osd-timer nil)

Loading…
Cancel
Save