Compare commits

..

3 Commits

3 changed files with 28 additions and 5 deletions

View File

@ -86,6 +86,13 @@ If the given KEY doesn't exist in OBJECT, return DEFAULT."
(or (cdr (assoc key (pw-lib--object-info object)))
default))
(defun pw-lib-properties (object)
"Return names of PipeWire OBJECT properties.
The returned value is a list of strings.
The corresponding values can be retrieved using `pw-lib-object-value'
function."
(cl-remove-if-not #'stringp (mapcar #'car (pw-lib--object-info object))))
(defun pw-lib-object-type (object)
"Return PipeWire type of OBJECT as a string.
E.g. \"Device\", \"Node\", \"Port\", \"Client\", ..."

View File

@ -96,6 +96,7 @@ The indicator is displayed only on graphical terminals."
:group 'pipewire)
(defvar pipewire-buffer "*PipeWire*")
(defvar pipewire-properties-buffer "*PipWire-properties*")
(defun pw-ui--label (label)
(propertize (concat label ":") 'face 'pipewire-label))
@ -109,7 +110,7 @@ The indicator is displayed only on graphical terminals."
'("application.name")
(let ((prefix (concat (downcase type) ".")))
(mapcar (lambda (suffix) (concat prefix suffix))
'("description" "name"))))))
'("nick" "description" "name"))))))
(or (cl-find-if #'identity
(mapcar (lambda (p) (pw-lib-object-value object p))
description-properties))
@ -381,6 +382,20 @@ Otherwise ask for the Node to set as the default Node."
(pw-ui--update))
(error "Nothing to set a profile for here")))
(defun pipewire-properties ()
"Display properties of the object at the current point."
(interactive)
(if-let ((object (pw-ui--current-object)))
(progn
(pop-to-buffer pipewire-properties-buffer)
(let ((inhibit-read-only t))
(erase-buffer)
(dolist (p (sort (pw-lib-properties object) #'string-lessp))
(insert (format "%s: %s\n" p (pw-lib-object-value object p)))))
(goto-char (point-min))
(view-mode))
(error "No PipeWire object here")))
(defvar pipewire-mode-map
(let ((map (make-sparse-keymap)))
(define-key map "d" 'pipewire-set-default)
@ -391,6 +406,7 @@ Otherwise ask for the Node to set as the default Node."
(define-key map "-" 'pipewire-decrease-volume)
(define-key map "+" 'pipewire-increase-volume-single)
(define-key map "_" 'pipewire-decrease-volume-single)
(define-key map " " 'pipewire-properties)
map))
(define-derived-mode pipewire-mode special-mode "PW"