about summary refs log tree commit diff
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2019-12-23T10·56+0000
committerWilliam Carroll <wpcarro@gmail.com>2020-01-06T15·25+0000
commit25ce422abd8c7b2bd11a7906e3d155f83f53bacc (patch)
treefe2586d4109dc4a162c52365a400bbdd2d4c5b74
parentba1034a9c85f395de2073c69ee3c1daec48ded47 (diff)
Support microphone toggling
Use pactl and exwm KBDs to support toggling my microphone setting from Emacs.
-rw-r--r--configs/shared/.emacs.d/wpc/pulse-audio.el10
1 files changed, 9 insertions, 1 deletions
diff --git a/configs/shared/.emacs.d/wpc/pulse-audio.el b/configs/shared/.emacs.d/wpc/pulse-audio.el
index 7dff888e98ea..2a8418439c5d 100644
--- a/configs/shared/.emacs.d/wpc/pulse-audio.el
+++ b/configs/shared/.emacs.d/wpc/pulse-audio.el
@@ -23,6 +23,12 @@
   (shell-command "pactl set-sink-mute @DEFAULT_SINK@ toggle")
   (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 ()
   "Low the volume output of the default sink."
   (interactive)
@@ -42,7 +48,9 @@
   (exwm-input-set-key
    (kbd "<XF86AudioLowerVolume>") #'pulse-audio/lower-volume)
   (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)
 ;;; pulse-audio.el ends here