New command pipewire-toggle-microphone

This commit is contained in:
Milan Zamazal 2022-06-28 20:43:37 +02:00
parent b80fbab73a
commit adf36e59b1

View File

@ -251,6 +251,9 @@ The indicator is displayed only on graphical terminals."
(propertize (make-string n-inactive mark) (propertize (make-string n-inactive mark)
'face `(:background ,pipewire-osd-volume-off-color))))))) '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"))))
;;;###autoload ;;;###autoload
(defun pipewire-toggle-muted () (defun pipewire-toggle-muted ()
"Switch mute status of an audio output or input. "Switch mute status of an audio output or input.
@ -259,9 +262,17 @@ object. Otherwise apply it on the default audio sink."
(interactive) (interactive)
(let* ((object (pw-ui--current-object t '("Node" "Port"))) (let* ((object (pw-ui--current-object t '("Node" "Port")))
(muted-p (pw-lib-toggle-mute object))) (muted-p (pw-lib-toggle-mute object)))
(pw-ui--update (format "%s %s" (pw-ui--object-name object) (if muted-p "muted" "unmuted"))) (pw-ui--update-muted object muted-p)
(pw-ui--osd-volume object))) (pw-ui--osd-volume object)))
;;;###autoload
(defun pipewire-toggle-microphone ()
"Switch mute status of the default audio input."
(interactive)
(let* ((object (car (pw-lib-default-capture-ports)))
(muted-p (pw-lib-toggle-mute object)))
(pw-ui--update-muted object muted-p)))
;;;###autoload ;;;###autoload
(defun pipewire-set-volume (volume &optional object single-p) (defun pipewire-set-volume (volume &optional object single-p)
"Set volume of an audio output or input. "Set volume of an audio output or input.