diff options
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/emms-volume-pulse.el | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/lisp/emms-volume-pulse.el b/lisp/emms-volume-pulse.el index 8d95e30..7fc6de5 100644 --- a/lisp/emms-volume-pulse.el +++ b/lisp/emms-volume-pulse.el @@ -56,13 +56,9 @@ See full list of devices on your system by running (string :tag "Sink symbolic name")) :group 'emms-volume) -(defcustom emms-volume-pulse-max-volume 150 - "The sink to use for volume adjustment. - -See full list of devices on your system by running - pactl list short sinks" - :type '(choice (number :tag "Sink number") - (string :tag "Sink symbolic name")) +(defcustom emms-volume-pulse-max-volume 100 + "The maximum volume percentage." + :type 'integer :group 'emms-volume) @@ -73,7 +69,7 @@ See full list of devices on your system by running (output (shell-command-to-string (concat "pactl list sinks" "|" - "grep -E -e 'Sink' -e 'Name' -e '^[^a-zA-Z]*Volume'")))) + "grep -E -e 'Sink' -e 'Name' -e '^[^a-zA-Z]*Volume'")))) (string-to-number (car (reverse @@ -97,12 +93,13 @@ See full list of devices on your system by running ;;;###autoload (defun emms-volume-pulse-change (amount) - "Change amixer master volume by AMOUNT." + "Change PulseAudio volume by AMOUNT." (message "Volume is %s%%" (let ((pactl (or (executable-find "pactl") (error "pactl is not in PATH"))) - (next-vol (min (+ (emms-volume--pulse-get-volume) amount) - emms-volume-pulse-max-volume))) + (next-vol (max (min (+ (emms-volume--pulse-get-volume) amount) + emms-volume-pulse-max-volume) + 0))) (when (zerop (shell-command (format "%s set-sink-volume %s %s%%" pactl emms-volume-pulse-sink next-vol))) |