summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2021-02-08 21:29:59 +0000
committerjao <jao@gnu.org>2021-02-08 21:30:16 +0000
commita88985711f4f838762732bde2b5b75381ca71ee2 (patch)
treee6aa86f36705d97c4d638d34c8372757b04e4a38
parent49b1f5acdd11c2e8e674c3ace69fec1fad7867e7 (diff)
downloadelibs-a88985711f4f838762732bde2b5b75381ca71ee2.tar.gz
elibs-a88985711f4f838762732bde2b5b75381ca71ee2.tar.bz2
more espotify control commands
-rw-r--r--init.org9
-rw-r--r--lib/media/espotify.org17
-rw-r--r--lib/media/jao-mpris.el14
3 files changed, 34 insertions, 6 deletions
diff --git a/init.org b/init.org
index 1ccf0cc..9e81b65 100644
--- a/init.org
+++ b/init.org
@@ -507,6 +507,7 @@
(file-symlink-p current)
t))))
(make-symbolic-link (expand-file-name f) current t)
+ (make-symbolic-link (expand-file-name f) "~/.lockimage" t)
(if jao-sway-enabled-p
(jao-swaymsg (format "output * bg %s fill" current))
(shell-command (format "xwallpaper --zoom %s" f))))))
@@ -2724,6 +2725,7 @@
#+BEGIN_SRC emacs-lisp
(setq eshell-directory-name "~/.emacs.d/eshell")
(setq eshell-aliases-file (jao-data-file "eshell.alias"))
+ (setq eshell-hist-ignoredups 'erase)
#+END_SRC
***** Colors
#+begin_src emacs-lisp
@@ -4027,6 +4029,7 @@
(use-package jao-mpris
:config
(jao-mpris-minibuffer-order 50)
+ (setq jao-mpris--current)
(dolist (name '("spotifyd" "spotify" "mopidy"))
(jao-mpris-minibuffer-register name)
(jao-mpris-minibuffer-register name :system)))
@@ -4166,9 +4169,9 @@
("t" jao-spotify-track "track")
("P" jao-spotify-playlist "playlist"))
"Play"
- (("s" libmpdel-playback-play-pause "toggle")
- ("n" libmpdel-playback-next "next")
- ("p" libmpdel-playback-previous "previous")
+ (("s" espotify-play-pause "toggle")
+ ("n" espotify--next "next")
+ ("p" espotify-previous "previous")
("w" jao-mpdel-show-osd "currently playing"))
"Browse"
(("b" mpdel-pop-to-browser "browser")
diff --git a/lib/media/espotify.org b/lib/media/espotify.org
index 93338a9..98530a8 100644
--- a/lib/media/espotify.org
+++ b/lib/media/espotify.org
@@ -271,6 +271,23 @@ Let's start with an umbrella customization group:
(espotify-call-spotify-via-dbus "OpenUri" uri))
#+end_src
+ Although we're not going to use them explicitly below, we can define
+ a couple more commands that may come in handy:
+
+ #+begin_src emacs-lisp
+ (defun espotify-play-pause ()
+ (interactive)
+ (espotify-call-spotify-via-dbus "PlayPause"))
+
+ (defun espotify-next ()
+ (interactive)
+ (espotify-call-spotify-via-dbus "Next"))
+
+ (defun espotify-previous ()
+ (interactive)
+ (espotify-call-spotify-via-dbus "Previous"))
+ #+end_src
+
* Search front-end using consult
:PROPERTIES:
:header-args: :tangle espotify-consult.el
diff --git a/lib/media/jao-mpris.el b/lib/media/jao-mpris.el
index ad4b452..5551f03 100644
--- a/lib/media/jao-mpris.el
+++ b/lib/media/jao-mpris.el
@@ -49,8 +49,14 @@
"{{album}}"
"{{duration(mpris:length)}}")
sep))
- (m (jao-mpris--playerctl "metadata" "--format" fmt)))
- (split-string (car (split-string m "\n")) sep)))
+ (m (jao-mpris--playerctl "metadata" "--format" fmt))
+ (e (split-string (car (split-string m "\n")) sep)))
+ `((status . ,(car e))
+ (track . ,(cadr e))
+ (title . ,(caddr e))
+ (artist . ,(cadddr e))
+ (album . ,(elt e 4))
+ (duration . ,(last e)))))
;;;###autoload
(defun jao-mpris-status-times ()
@@ -72,7 +78,9 @@
(track (jao-mpris--get 'track info))
(album (jao-mpris--get 'album info))
(len (jao-mpris--get 'length info))
- (duration (cond ((stringp len) len)
+ (duration (jao-mpris--get 'duration info))
+ (duration (cond (duration duration)
+ ((stringp len) len)
((numberp len) (jao-emms--fmt-time (/ len 1e6) "")))))
(format " %s %s %s%s%s"
(jao--put-face (format "%s" (or track "")) 'jao-emms-font-lock-track)