From 6cd287823401747e5716e203864a387aa762c18c Mon Sep 17 00:00:00 2001 From: jao Date: Sun, 30 Jan 2022 08:00:51 +0000 Subject: mpris clean-ups, and, oh, spotify -> streaming --- init.org | 117 +++++++++++++++++++++++++++++++++------------------------------ 1 file changed, 61 insertions(+), 56 deletions(-) (limited to 'init.org') diff --git a/init.org b/init.org index 0bf7da3..fd4e583 100644 --- a/init.org +++ b/init.org @@ -2900,6 +2900,30 @@ (global-set-key (kbd "") #'jao-toggle-audio-applet) + #+end_src +*** mpris + #+begin_src emacs-lisp + (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-list #'jao-term-ncmpcpp) + (defalias 'jao-streaming-lyrics 'jao-show-lyrics) + (defalias 'jao-streaming-toggle #'jao-mpris-play-pause) + (defalias 'jao-streaming-next #'jao-mpris-next) + (defalias 'jao-streaming-prev #'jao-mpris-previous) + (defalias 'jao-streaming-current #'jao-mpris-show-osd) + (defalias 'jao-streaming-seek #'jao-mpris-seek) + (defalias 'jao-streaming-seek-back #'jao-mpris-seek-back) + (defalias 'jao-streaming-volume #'jao-mpris-vol) + (defalias 'jao-streaming-volume-down #'jao-mpris-vol-down))) + + (jao-mpris-setup-aliases) + (jao-mpris-register "mopidy" :system (if jao-modeline-in-minibuffer-p -10 70)) + (jao-mpris-register "chromium" :session) + (jao-mpris-register "firefox" :session) + #+end_src *** spotify Access to spotify uses packages tangled from [[./lib/media/espotify.org][espotify.org]], which @@ -2911,55 +2935,36 @@ :demand t :init (setq espotify-service-name "mopidy")) (use-package consult-spotify :demand t) - (defalias 'jao-spotify-album #'consult-spotify-album) - (defalias 'jao-spotify-track #'consult-spotify-track) - (defalias 'jao-spotify-artist #'consult-spotify-artist) - (defalias 'jao-spotify-playlist #'consult-spotify-playlist) + (defalias 'jao-streaming-album #'consult-spotify-album) + (defalias 'jao-streaming-track #'consult-spotify-track) + (defalias 'jao-streaming-artist #'consult-spotify-artist) + (defalias 'jao-streaming-playlist #'consult-spotify-playlist) (jao-def-exec-in-term "ncmpcpp" "ncmpcpp" (jao-afio--goto-scratch)) - (use-package jao-mpris - :demand t - :config - (defun jao-mpris-setup-aliases () - (setq espotify-play-uri-function #'espotify-play-uri-with-dbus) - (defalias 'jao-spotify-list #'jao-term-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-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 :config (defun jao-spt-setup-aliases () (setq espotify-play-uri-function #'jao-spt-play-uri) - (defalias 'jao-spotify-list #'jao-term-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) + (defalias 'jao-streaming-list #'jao-term-spt) + (defalias 'jao-streaming-lyrics #'jao-spt-show-lyrics) + (defalias 'jao-streaming-toggle #'jao-spt-toggle) + (defalias 'jao-streaming-next #'jao-spt-next) + (defalias 'jao-streaming-prev #'jao-spt-previous) + (defalias 'jao-streaming-current #'jao-spt-echo-current) + (defalias 'jao-streaming-seek #'jao-spt-seek) + (defalias 'jao-streaming-seek-back #'jao-spt-seek-back) + (defalias 'jao-streaming-volume #'jao-spt-vol) + (defalias 'jao-streaming-volume-down #'jao-spt-vol-down))) + + (defvar jao-spt-on nil) (defun jao-spt-on-p () jao-spt-on) - (jao-spt-setup-aliases) + ;; (jao-spt-setup-aliases) (jao-def-exec-in-term "spt" "spt" (jao-afio--goto-scratch-1)) - (defun jao-spotify-toggle-player () + (defun jao-streaming-toggle-player () (interactive) (if jao-spt-on (jao-mpris-setup-aliases) (jao-spt-setup-aliases)) (message "%s activated " @@ -3024,13 +3029,13 @@ (defun jao-player-seek-10 () (interactive) (jao-player-seek 10)) (defun jao-player-seek--10 () (interactive) (jao-player-seek -10)) - (defun jao-spotify-clear () (interactive) (jao-mpc-clear jao-mopidy-port)) + (defun jao-streaming-clear () (interactive) (jao-mpc-clear jao-mopidy-port)) - (defun jao-spotify-echo-current () + (defun jao-streaming-echo-current () (interactive) (jao-mpc-echo-current jao-mopidy-port)) - (defun jao-spotify-show-playlist () + (defun jao-streaming-show-playlist () (interactive) (jao-mpc-show-playlist jao-mopidy-port)) @@ -3041,28 +3046,28 @@ (jao-def-exec-in-term "aptitude" "aptitude" (jao-afio--goto-scratch)) (jao-def-exec-in-term "htop" "htop" (jao-afio--goto-scratch)) - (transient-define-prefix jao-transient-spotify () + (transient-define-prefix jao-transient-streaming () [: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) - ("P" "playlist" jao-spotify-playlist)] + ("a" "album" jao-streaming-album) + ("A" "artist" jao-streaming-artist) + ("t" "track" jao-streaming-track) + ("P" "playlist" jao-streaming-playlist)] ["Play" - ("s" "toggle" jao-spotify-toggle) - ("n" "next" jao-spotify-next) - ("p" "previous" jao-spotify-prev)] + ("s" "toggle" jao-streaming-toggle) + ("n" "next" jao-streaming-next) + ("p" "previous" jao-streaming-prev)] ["Seek & shout" - ("f" "seek fwd" jao-spotify-seek :transient t) - ("F" "seek bwd" jao-spotify-seek-back :transient t) - ("u" "up" jao-spotify-volume :transient t) - ("d" "down" jao-spotify-volume-down :transient t)] + ("f" "seek fwd" jao-streaming-seek :transient t) + ("F" "seek bwd" jao-streaming-seek-back :transient t) + ("u" "up" jao-streaming-volume :transient t) + ("d" "down" jao-streaming-volume-down :transient t)] ["Browse" - ("l" "playing list" jao-spotify-list) - ("L" "lyrics" jao-spotify-lyrics) - ("w" "currently playing" jao-spotify-current) - ("T" "toggle player" jao-spotify-toggle-player)] + ("l" "playing list" jao-streaming-list) + ("L" "lyrics" jao-streaming-lyrics) + ("w" "currently playing" jao-streaming-current) + ("T" "toggle player" jao-streaming-toggle-player)] ["Act" :if jao-spt-on-p ("k" "like" jao-spt-like) ("K" "dislike" jao-spt-dislike) -- cgit v1.2.3