From e4e46f41b0d01b9efab86b2f3cebbf116c3216b5 Mon Sep 17 00:00:00 2001 From: jao Date: Sat, 22 Jan 2022 00:10:17 +0000 Subject: spt/mpris switching --- init.org | 61 ++++++++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 44 insertions(+), 17 deletions(-) (limited to 'init.org') diff --git a/init.org b/init.org index 86005e1..7c801f5 100644 --- a/init.org +++ b/init.org @@ -2940,15 +2940,45 @@ :demand t :config (defun jao-mpris-setup-aliases () + (setq espotify-play-uri-function #'espotify-play-uri-with-dbus) + (defalias 'jao-spotify-list 'jao-exwm-ncmpcpp) + (defalias 'jao-spotify-lyrics 'jao-show-lyrics) (defalias 'jao-spotify-toggle #'jao-mpris-play-pause) (defalias 'jao-spotify-next #'jao-mpris-next) (defalias 'jao-spotify-prev #'jao-mpris-previous) - (defalias 'jao-spotify-current #'jao-mpris-show-osd))) + (defalias 'jao-spotify-current #'jao-mpris-show-osd) + (defalias 'jao-spotify-seek #'jao-mpris-seek) + (defalias 'jao-spotify-seek-back #'jao-mpris-seek-back) + (defalias 'jao-spotify-volume #'jao-mpris-vol) + (defalias 'jao-spotify-volume-down #'jao-mpris-vol-down))) (jao-mpris-setup-aliases) (jao-mpris-register "mopidy" :system (if jao-modeline-in-minibuffer-p -10 70)) - (use-package jao-spt :demand t) + (use-package jao-spt + :demand t + :config + (defun jao-spt-setup-aliases () + (setq espotify-play-uri-function #'jao-spt-play-uri) + (defalias 'jao-spotify-list 'jao-exwm-spt) + (defalias 'jao-spotify-lyrics 'jao-spt-show-lyrics) + (defalias 'jao-spotify-toggle #'jao-spt-toggle) + (defalias 'jao-spotify-next #'jao-spt-next) + (defalias 'jao-spotify-prev #'jao-spt-previous) + (defalias 'jao-spotify-current #'jao-spt-echo-current) + (defalias 'jao-spotify-seek #'jao-spt-seek) + (defalias 'jao-spotify-seek-back #'jao-spt-seek-back) + (defalias 'jao-spotify-volume #'jao-spt-vol) + (defalias 'jao-spotify-volume-down #'jao-spt-vol-down))) + + (defvar jao-spt-on t) + (jao-spt-setup-aliases) + + (defun jao-spotify-toggle-player () + (interactive) + (if jao-spt-on (jao-mpris-setup-aliases) (jao-spt-setup-aliases)) + (message "%s activated " + (if (setq jao-spt-on (not jao-spt-on)) "spt" "mpris"))) #+end_src *** mpc @@ -3019,21 +3049,14 @@ (interactive) (jao-mpc-show-playlist jao-mopidy-port)) - (defun jao-player-seek-m10 () - (interactive) - (jao-player-seek 10 jao-mopidy-port)) - - (defun jao-player-seek-m-10 () - (interactive) - (jao-player-seek -10 jao-mopidy-port)) - - (defun jao-player-level-cap () (interactive) (jao-mixer-level "Capture")) (use-package jao-random-album :demand t) (transient-define-prefix jao-transient-spotify () - [["Search" + [:description + (lambda () (format "Spotify using %s" (if jao-spt-on "spt" "MPRIS"))) + ["Search" ("a" "album" jao-spotify-album) ("A" "artist" jao-spotify-artist) ("t" "track" jao-spotify-track) @@ -3043,12 +3066,16 @@ ("n" "next" jao-spotify-next) ("p" "previous" jao-spotify-prev)] ["Seek" - ("f" "seek fwd" jao-player-seek-m10 :transient t) - ("F" "seek bwd" jao-player-seek-m-10 :transient t)] + ("f" "seek fwd" jao-spotify-seek :transient t) + ("F" "seek bwd" jao-spotify-seek-back :transient t)] + ["Volume" + ("u" "" "up" jao-spotify-volume :transient t) + ("d" "down" jao-spotify-volume-down :transient t)] ["Browse" - ("l" "playing list" jao-exwm-ncmpcpp) - ("T" "show times" jao-mpris-status-times) - ("w" "currently playing" jao-spotify-current)]]) + ("l" "playing list" jao-spotify-list) + ("L" "lyrics" jao-spotify-lyrics) + ("w" "currently playing" jao-spotify-current) + ("t" "toggle player" jao-spotify-toggle-player)]]) (transient-define-prefix jao-transient-media () [["Play" -- cgit v1.2.3