diff options
author | William Carroll <wpcarro@gmail.com> | 2019-12-23T17·31+0000 |
---|---|---|
committer | William Carroll <wpcarro@gmail.com> | 2020-01-06T15·25+0000 |
commit | 5785a5d126210e8c9651da038b6c8b083041fef6 (patch) | |
tree | 2303a7bc5b7928b528e06e1abb899119882c15bb /configs/shared/.emacs.d/wpc/pulse-audio.el | |
parent | c078f0452666e4d7a03d234393ccec7210a86642 (diff) |
Support prelude/start-process
If you refer to the previous commit where I change shell-command usages to start-process function calls, you'll see the rationale for why I prefer start-process. This commit introduces a more ergonomic API for start-process that fits most of my current use-cases of it. This cleans up the code. I have introduced a bug in the way that I'm tokenizing the COMMAND value. I've tracked that with a TODO. For now it only affects the `xmodmap -e '<command-string>'` calls, which isn't too disruptive.
Diffstat (limited to 'configs/shared/.emacs.d/wpc/pulse-audio.el')
-rw-r--r-- | configs/shared/.emacs.d/wpc/pulse-audio.el | 43 |
1 files changed, 15 insertions, 28 deletions
diff --git a/configs/shared/.emacs.d/wpc/pulse-audio.el b/configs/shared/.emacs.d/wpc/pulse-audio.el index 87e0c7c5ed30..b81f88c1b098 100644 --- a/configs/shared/.emacs.d/wpc/pulse-audio.el +++ b/configs/shared/.emacs.d/wpc/pulse-audio.el @@ -10,6 +10,7 @@ ;; Dependencies ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(require 'prelude) (require 'string) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -33,49 +34,35 @@ (defun pulse-audio/toggle-mute () "Mute the default sink." (interactive) - (start-process - "*pactl<pulse-audio/toggle-mute>*" - nil - "pactl" - "set-sink-mute" - "@DEFAULT_SINK@" - "toggle") + (prelude/start-process + :name "pulse-audio/toggle-mute" + :command "pactl set-sink-mute @DEFAULT_SINK@ toggle") (pulse-audio/message "Mute toggled.")) (defun pulse-audio/toggle-microphone () "Mute the default sink." (interactive) - (start-process - "*pactl<pulse-audio/toggle-mute>*" - nil - "pactl" - "set-source-mute" - "@DEFAULT_SOURCE@" - "toggle") + (prelude/start-process + :name "pulse-audio/toggle-microphone" + :command "pactl set-source-mute @DEFAULT_SOURCE@ toggle") (pulse-audio/message "Microphone toggled.")) (defun pulse-audio/decrease-volume () "Low the volume output of the default sink." (interactive) - (start-process - "*pactl<pulse-audio/toggle-mute>*" - nil - "pactl" - "set-sink-volume" - "@DEFAULT_SINK@" - (string/format "-%s%%" pulse-audio/step-size)) + (prelude/start-process + :name "pulse-audio/decrease-volume" + :command (string/format "pactl set-sink-volume @DEFAULT_SINK@ -%s%%" + pulse-audio/step-size)) (pulse-audio/message "Volume decreased.")) (defun pulse-audio/increase-volume () "Raise the volume output of the default sink." (interactive) - (start-process - "*pactl<pulse-audio/toggle-mute>*" - nil - "pactl" - "set-sink-volume" - "@DEFAULT_SINK@" - (string/format "+%s%%" pulse-audio/step-size)) + (prelude/start-process + :name "pulse-audio/increase-volume" + :command (string/format "pactl set-sink-volume @DEFAULT_SINK@ +%s%%" + pulse-audio/step-size)) (pulse-audio/message "Volume increased.")) (when pulse-audio/install-kbds? |