Compare commits

..

4 Commits

Author SHA1 Message Date
ae7a95230f README: Add info about MELPA 2022-07-26 20:00:57 +02:00
115a8a89a3 Use user-error rather than ‘error’ in interactive functions 2022-07-25 20:58:07 +02:00
8109f43855 Toggle microphone: Better error message if there is no default input
Instead of an Elisp type error.
2022-07-16 21:33:36 +02:00
a81c61ab0a Expand commentary in pipewire.el
This is what would be displayed in MELPA package description.
2022-07-16 21:25:20 +02:00
2 changed files with 28 additions and 18 deletions

View File

@ -18,14 +18,9 @@ discuss anything.
pipewire-0 currently requires presence of PipeWire command line tools, pipewire-0 currently requires presence of PipeWire command line tools,
namely [[https://docs.pipewire.org/page_man_pw_cli_1.html][pw-cli]] and [[https://docs.pipewire.org/page_man_pw_metadata_1.html][pw-metadata]]. namely [[https://docs.pipewire.org/page_man_pw_cli_1.html][pw-cli]] and [[https://docs.pipewire.org/page_man_pw_metadata_1.html][pw-metadata]].
To install pipewire-0, put the *.el files to a site-lisp directory and You can install pipewire-0 from [[https://melpa.org/#/pipewire][MELPA]]. If you use [[https://github.com/radian-software/straight.el][straight.el]] and
add the following line to your Emacs configuration: prefer using source repos directly, you can install pipewire-0 as
follows:
#+begin_src elisp
(require pipewire)
#+end_src
Or if you use [[https://github.com/radian-software/straight.el][straight.el]], you can install pipewire-0 as follows:
#+begin_src elisp #+begin_src elisp
(straight-use-package (straight-use-package
@ -34,6 +29,13 @@ Or if you use [[https://github.com/radian-software/straight.el][straight.el]], y
:local-repo "pipewire-0")) :local-repo "pipewire-0"))
#+end_src #+end_src
To install pipewire-0 manually, put the *.el files to a site-lisp
directory and add the following line to your Emacs configuration:
#+begin_src elisp
(require pipewire)
#+end_src
** User interface ** User interface
=M-x pipewire= enters a buffer with PipeWire objects: =M-x pipewire= enters a buffer with PipeWire objects:

View File

@ -25,11 +25,18 @@
;;; Commentary: ;;; Commentary:
;; ;;
;; PipeWire user interface based on pipewire-lib. ;; PipeWire user interface and library.
;; An interactive buffer can be displayed using `M-x pipewire'. ;; It currently uses pw-cli and pw-metadata command line utilities to
;; interact with PipeWire.
;;
;; An interactive PipeWire buffer can be displayed using `M-x pipewire'.
;; There you can view basic PipeWire status and change some settings.
;; `pipewire-increase-volume', `pipewire-decrease-volume' and ;; `pipewire-increase-volume', `pipewire-decrease-volume' and
;; `pipewire-toggle-muted' functions are also suitable to bind on the ;; `pipewire-toggle-muted' functions can be used also standalone and
;; multimedia keys. ;; are suitable to bind on the multimedia keys.
;;
;; The package can be used also non-interactively in Elisp programs.
;; See pipewire-lib.el source file for available functions.
;;; Code: ;;; Code:
@ -150,7 +157,7 @@ The indicator is displayed only on graphical terminals."
(interactive) (interactive)
(when (and (not (eq major-mode 'pipewire-mode)) (when (and (not (eq major-mode 'pipewire-mode))
(not (equal (buffer-name) pipewire-buffer))) (not (equal (buffer-name) pipewire-buffer)))
(error "Not in a PipeWire buffer")) (user-error "Not in a PipeWire buffer"))
(pipewire-lib-refresh) (pipewire-lib-refresh)
(let ((inhibit-read-only t) (let ((inhibit-read-only t)
(default-ids (mapcar #'cdr (pipewire-lib-default-nodes))) (default-ids (mapcar #'cdr (pipewire-lib-default-nodes)))
@ -287,9 +294,10 @@ object. Otherwise apply it on the default audio sink."
(defun pipewire-toggle-microphone () (defun pipewire-toggle-microphone ()
"Switch mute status of the default audio input." "Switch mute status of the default audio input."
(interactive) (interactive)
(let* ((object (car (pipewire-lib-default-capture-ports))) (let ((object (car (pipewire-lib-default-capture-ports))))
(muted-p (pipewire-lib-toggle-mute object))) (if object
(pipewire--update-muted object muted-p))) (pipewire--update-muted object (pipewire-lib-toggle-mute object))
(user-error "No default audio input"))))
;;;###autoload ;;;###autoload
(defun pipewire-set-volume (volume &optional object single-p) (defun pipewire-set-volume (volume &optional object single-p)
@ -384,7 +392,7 @@ Otherwise ask for the Node to set as the default Node."
;; Without this, ports of the device may not be displayed on the update: ;; Without this, ports of the device may not be displayed on the update:
(sit-for 0) (sit-for 0)
(pipewire--update)) (pipewire--update))
(error "Nothing to set a profile for here"))) (user-error "Nothing to set a profile for here")))
(defun pipewire-properties () (defun pipewire-properties ()
"Display properties of the object at the current point." "Display properties of the object at the current point."
@ -398,7 +406,7 @@ Otherwise ask for the Node to set as the default Node."
(insert (format "%s: %s\n" p (pipewire-lib-object-value object p))))) (insert (format "%s: %s\n" p (pipewire-lib-object-value object p)))))
(goto-char (point-min)) (goto-char (point-min))
(view-mode)) (view-mode))
(error "No PipeWire object here"))) (user-error "No PipeWire object here")))
(defvar pipewire-mode-map (defvar pipewire-mode-map
(let ((map (make-sparse-keymap))) (let ((map (make-sparse-keymap)))