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.
This commit is contained in:
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."
|
"Return a PipeWire object that is the current default audio sink."
|
||||||
(pw-lib-get-object (cdr (assoc "default.audio.sink" (pw-lib-default-nodes)))))
|
(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)
|
(defun pw-lib--volume-% (volume)
|
||||||
(when volume
|
(when volume
|
||||||
(round (* 100 volume))))
|
(round (* 100 volume))))
|
||||||
|
3
pw-ui.el
3
pw-ui.el
@ -164,7 +164,8 @@ The indicator is displayed only on graphical terminals."
|
|||||||
(not (member (pw-lib-object-type object) allowed-types)))
|
(not (member (pw-lib-object-type object) allowed-types)))
|
||||||
(setq object nil))
|
(setq object nil))
|
||||||
(when (and use-default-p (not object))
|
(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))
|
object))
|
||||||
|
|
||||||
(defvar pw-ui--osd-timer nil)
|
(defvar pw-ui--osd-timer nil)
|
||||||
|
Loading…
Reference in New Issue
Block a user