diff options
author | jao <jao@gnu.org> | 2022-02-02 03:54:52 +0000 |
---|---|---|
committer | jao <jao@gnu.org> | 2022-02-02 03:54:52 +0000 |
commit | e80a2fef9627c95186ac2068cc58f082b6ca0729 (patch) | |
tree | 65f0c7d122d9f4edd65bd9ba00796e29a3939f4d | |
parent | 42cf90da66e9ff24939a98139016138905e1b201 (diff) | |
download | elibs-e80a2fef9627c95186ac2068cc58f082b6ca0729.tar.gz elibs-e80a2fef9627c95186ac2068cc58f082b6ca0729.tar.bz2 |
tweaks for interaction with deezer
-rw-r--r-- | exwm.org | 34 | ||||
-rw-r--r-- | init.org | 18 | ||||
-rw-r--r-- | lib/media/jao-mpris.el | 4 |
3 files changed, 45 insertions, 11 deletions
@@ -253,9 +253,6 @@ (jao-def-exwm-runner jao-exwm-vlc 4 "VLC" "vlc") - (jao-def-exwm-runner jao-exwm-deezer 5 "Deezer" "deezer-desktop") - (defalias 'jao-streaming-list #'jao-exwm-deezer) - (jao-def-exwm-runner jao-exwm-slack 0 "Slack" "slack") (jao-def-exwm-runner jao-exwm-signal 0 "Signal" "signal-desktop") @@ -301,6 +298,33 @@ "/tmp/screenshot/$(date +'%g%m%d-%H%M%S').png"))) (start-process-shell-command "import" "* exwm - console *" c))) + (defun jao-exwm--send-str (str) + (dolist (k (string-to-list (kbd str))) + (exwm-input--fake-key k))) + + #+end_src +* Deezer support + #+begin_src emacs-lisp + (jao-def-exwm-runner jao-exwm-deezer-1 5 "Deezer" "deezer-desktop") + + (defun jao-exwm-deezer () + (interactive) + (jao-exwm-deezer-1) + (delete-other-windows)) + + (defalias 'jao-streaming-list #'jao-exwm-deezer) + (jao-mpris-setup-aliases) + + (defun jao-exwm--with-deezer (fun) + (jao-exwm-deezer) + (funcall fun)) + + (defun jao-exwm-deezer-like () + (interactive) + (jao-exwm-deezer) + (exwm-input--update-focus (selected-window)) + (jao-exwm--send-str "L")) + #+end_src * Zathura support #+begin_src emacs-lisp @@ -319,10 +343,6 @@ (string-to-number (match-string 4 exwm-title)) (match-string 2 exwm-title))))) - (defun jao-exwm--send-str (str) - (dolist (k (string-to-list (kbd str))) - (exwm-input--fake-key k))) - (defun jao-zathura-goto-page (page-no) (jao-exwm--send-str (format "%sg" page-no))) @@ -2911,12 +2911,19 @@ #+end_src *** mpris #+begin_src emacs-lisp + (defun jao-mpris-lyrics (&optional force) + (interactive "P") + (jao-show-lyrics force #'jao-mpris-artist-title)) + (use-package jao-mpris :demand t :config (defun jao-mpris-setup-aliases () (setq espotify-play-uri-function #'espotify-play-uri-with-dbus) - (defalias 'jao-streaming-lyrics 'jao-show-lyrics) + (if (functionp 'jao-exwm-deezer) + (defalias 'jao-streaming-list #'jao-exwm-deezer) + (defalias 'jao-streaming-list #'ignore)) + (defalias 'jao-streaming-lyrics #'jao-mpris-lyrics) (defalias 'jao-streaming-toggle #'jao-mpris-play-pause) (defalias 'jao-streaming-next #'jao-mpris-next) (defalias 'jao-streaming-prev #'jao-mpris-previous) @@ -2978,7 +2985,14 @@ (defun jao-streaming-toggle-player () (interactive) - (if jao-spt-on (jao-mpris-setup-aliases) (jao-spt-setup-aliases)) + (if jao-spt-on + (let ((player (completing-read "Player: " + '( "chromium" "mopidy" "firefox" + "spotify") + nil nil nil nil jao-mpris-player))) + (setq jao-mpris-player player) + (jao-mpris-setup-aliases)) + (jao-spt-setup-aliases)) (message "%s activated " (if (setq jao-spt-on (not jao-spt-on)) "spt" "mpris"))) diff --git a/lib/media/jao-mpris.el b/lib/media/jao-mpris.el index b7e9aea..08b405a 100644 --- a/lib/media/jao-mpris.el +++ b/lib/media/jao-mpris.el @@ -94,7 +94,7 @@ (alist-get k (or l jao-mpris--current))) (defun jao-mpris--set-current (k v) - (setf (alist-get k jao-mpris--current "" t) v)) + (when v (setf (alist-get k jao-mpris--current "" t) v))) (defun jao-mpris--fmt-time (x suffix) (if x (format "%02d:%02d%s" (/ x 60) (mod x 60) (or suffix "")) "")) @@ -145,7 +145,7 @@ (defun jao-mpris--handler (_iname properties &rest _args) (let ((inhibit-message t)) - (message "Receivied properties: %S from %s" properties _iname)) + (message "Received properties: %S from %s" properties _iname)) (when-let (md (caadr (assoc "Metadata" properties))) (let ((tno (caadr (assoc "xesam:trackNumber" md))) (tlt (caadr (assoc "xesam:title" md))) |