summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2022-02-09 05:33:07 +0000
committerjao <jao@gnu.org>2022-02-09 05:33:07 +0000
commit59443f92027364d9542a12df7faf7aede82f4be5 (patch)
treefcedc655d52862cd28ec55d6f4cf22701ede38b1
parent9bb5a52f04d6a0ecc47813d011ebc4f4f5b27d2a (diff)
downloadelibs-59443f92027364d9542a12df7faf7aede82f4be5.tar.gz
elibs-59443f92027364d9542a12df7faf7aede82f4be5.tar.bz2
mpris nits
-rw-r--r--exwm.org1
-rw-r--r--lib/media/jao-mpris.el15
2 files changed, 11 insertions, 5 deletions
diff --git a/exwm.org b/exwm.org
index 409e52f..4bbb23a 100644
--- a/exwm.org
+++ b/exwm.org
@@ -313,7 +313,6 @@
(delete-other-windows))
(defalias 'jao-streaming-list #'jao-exwm-deezer)
- (jao-mpris-setup-aliases)
(defun jao-exwm--with-deezer (fun)
(jao-exwm-deezer)
diff --git a/lib/media/jao-mpris.el b/lib/media/jao-mpris.el
index 08b405a..977dab3 100644
--- a/lib/media/jao-mpris.el
+++ b/lib/media/jao-mpris.el
@@ -28,7 +28,7 @@
(require 'jao-themes)
(require 'jao-minibuffer)
-(defvar jao-mpris-player "chromium")
+(defvar jao-mpris-player "playerctld")
(defun jao-mpris--playerctl (&rest args)
(shell-command-to-string (format "playerctl -p %s %s"
@@ -96,6 +96,9 @@
(defun jao-mpris--set-current (k v)
(when v (setf (alist-get k jao-mpris--current "" t) v)))
+(defun jao-mpris--del-current (k)
+ (setf (alist-get k jao-mpris--current "" t) ""))
+
(defun jao-mpris--fmt-time (x suffix)
(if x (format "%02d:%02d%s" (/ x 60) (mod x 60) (or suffix "")) ""))
@@ -130,8 +133,9 @@
(cons (jao-mpris--get 'artist) (jao-mpris--get 'title))))
;;;###autoload
-(defun jao-mpris-show-osd ()
- (interactive)
+(defun jao-mpris-show-osd (&optional refresh)
+ (interactive "P")
+ (when refresh (jao-mpris--track))
(when jao-mpris--current
(jao-notify (format "%s%s" (if-let (s (jao-mpris--get 'status))
(format "%s: " s)
@@ -158,7 +162,10 @@
(jao-mpris--set-current 'album alb)
(jao-mpris--set-current 'length len)))
(when-let (st (caadr (assoc "PlaybackStatus" properties)))
- (jao-mpris--set-current 'status st))
+ (jao-mpris--set-current 'status st)
+ (when (string= st "Stopped")
+ (dolist (k '(track title artist album length))
+ (jao-mpris--del-current k))))
(jao-mpris--track jao-mpris--current))
;;;###autoload