Support microphone toggling

Use pactl and exwm KBDs to support toggling my microphone setting from Emacs.
This commit is contained in:
William Carroll 2019-12-23 10:56:38 +00:00
parent ba1034a9c8
commit 25ce422abd

View file

@ -23,6 +23,12 @@
(shell-command "pactl set-sink-mute @DEFAULT_SINK@ toggle") (shell-command "pactl set-sink-mute @DEFAULT_SINK@ toggle")
(message (string/format "[pulse-audio.el] Mute toggled."))) (message (string/format "[pulse-audio.el] Mute toggled.")))
(defun pulse-audio/toggle-microphone ()
"Mute the default sink."
(interactive)
(shell-command "pactl set-source-mute @DEFAULT_SOURCE@ toggle")
(message (string/format "[pulse-audio.el] Microphone toggled.")))
(defun pulse-audio/lower-volume () (defun pulse-audio/lower-volume ()
"Low the volume output of the default sink." "Low the volume output of the default sink."
(interactive) (interactive)
@ -42,7 +48,9 @@
(exwm-input-set-key (exwm-input-set-key
(kbd "<XF86AudioLowerVolume>") #'pulse-audio/lower-volume) (kbd "<XF86AudioLowerVolume>") #'pulse-audio/lower-volume)
(exwm-input-set-key (exwm-input-set-key
(kbd "<XF86AudioRaiseVolume>") #'pulse-audio/raise-volume)) (kbd "<XF86AudioRaiseVolume>") #'pulse-audio/raise-volume)
(exwm-input-set-key
(kbd "<XF86AudioMicMute>") #'pulse-audio/toggle-microphone))
(provide 'pulse-audio) (provide 'pulse-audio)
;;; pulse-audio.el ends here ;;; pulse-audio.el ends here