summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--attic/misc.org121
-rw-r--r--init.org114
2 files changed, 127 insertions, 108 deletions
diff --git a/attic/misc.org b/attic/misc.org
index 2cb0fce..c10b1c6 100644
--- a/attic/misc.org
+++ b/attic/misc.org
@@ -955,6 +955,108 @@
(add-hook 'notmuch-show-hook #'jao-notmuch--show-hidden-html))
#+end_src
+* link-hint for w3m
+ #+begin_src emacs-lisp
+ (defun jao-link-hint--notmuch-next-url (&optional bound)
+ (link-hint--next-property 'w3m-href-anchor bound))
+
+ (defun jao-link-hint--notmuch-url-at-point ()
+ (get-text-property (point) 'w3m-href-anchor))
+
+ (link-hint-define-type 'notmuch-w3m-url
+ :next #'jao-link-hint--notmuch-next-url
+ :at-point-p #'jao-link-hint--notmuch-url-at-point
+ :vars '(notmuch-show-mode)
+ :open #'browse-url
+ :open-multiple t
+ :copy #'kill-new)
+
+ (push 'link-hint-notmuch-w3m-url link-hint-types)
+
+ #+end_src
+* spotify
+ Access to spotify uses packages tangled from [[./lib/media/espotify.org][espotify.org]], which
+ offers functionality tailored to the completion engines at hand:
+ #+begin_src emacs-lisp
+ (jao-load-path "espotify")
+
+ (use-package espotify
+ :demand t
+ :init (setq espotify-service-name "mopidy"))
+ (use-package consult-spotify :demand t)
+ (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-spt
+ :demand t
+ :config
+ (defun jao-spt-setup-aliases ()
+ (setq espotify-play-uri-function #'jao-spt-play-uri)
+ (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)
+ (defalias 'jao-streaming-like #'jao-spt-like)
+ (defalias 'jao-streaming-dislike #'jao-spt-dislike)))
+
+ (defvar jao-spt-on nil)
+ (defun jao-spt-on-p () jao-spt-on)
+ ;; (jao-spt-setup-aliases)
+
+ (jao-def-exec-in-term "spt" "spt" (jao-afio--goto-scratch-1))
+
+ (defun jao-streaming-toggle-player ()
+ (interactive)
+ (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")))
+
+ (transient-define-prefix jao-transient-streaming ()
+ [:description
+ (lambda () (format "Streaming using %s"
+ (if jao-spt-on "spt" "MPRIS")
+ (if jao-spt-on "" jao-mpris-player)))
+ ["Search"
+ ("a" "album" jao-streaming-album)
+ ("A" "artist" jao-streaming-artist)
+ ("t" "track" jao-streaming-track)
+ ("P" "playlist" jao-streaming-playlist)]
+ ["Play"
+ ("s" "toggle" jao-streaming-toggle)
+ ("n" "next" jao-streaming-next)
+ ("p" "previous" jao-streaming-prev)]
+ ["Seek & shout"
+ ("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-streaming-list)
+ ("L" "lyrics" jao-streaming-lyrics)
+ ("w" "currently playing" jao-streaming-current)
+ ("T" "toggle player" jao-streaming-toggle-player)]
+ ["Act"
+ ("k" "like" jao-streaming-like)
+ ("K" "dislike" jao-streaming-dislike)
+ ("S" "toggle shuffling" jao-spt-toggle-shuffle :if jao-spt-on-p)]])
+ #+end_src
* snippets
#+begin_src emacs-lisp
(defun jao-minibuffer--text-with-padding (text)
@@ -1004,22 +1106,3 @@
;; pdf-view-next-line-or-next-page))
;; (advice-add f :after #'jao--refresh))
#+end_src
-* link-hint for w3m
- #+begin_src emacs-lisp
- (defun jao-link-hint--notmuch-next-url (&optional bound)
- (link-hint--next-property 'w3m-href-anchor bound))
-
- (defun jao-link-hint--notmuch-url-at-point ()
- (get-text-property (point) 'w3m-href-anchor))
-
- (link-hint-define-type 'notmuch-w3m-url
- :next #'jao-link-hint--notmuch-next-url
- :at-point-p #'jao-link-hint--notmuch-url-at-point
- :vars '(notmuch-show-mode)
- :open #'browse-url
- :open-multiple t
- :copy #'kill-new)
-
- (push 'link-hint-notmuch-w3m-url link-hint-types)
-
- #+end_src
diff --git a/init.org b/init.org
index 531fa8d..9333074 100644
--- a/init.org
+++ b/init.org
@@ -2691,6 +2691,7 @@
(defun jao-ssh ()
(interactive)
(let ((h (completing-read "Host: " (jao-tramp-hosts))))
+ (jao-afio-goto-scratch)
(jao-exec-in-term (format "ssh %s" h) (format "*ssh %s*" h))))
#+end_src
* Chats
@@ -2944,86 +2945,24 @@
(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)
- (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)
- (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)))
+ (use-package jao-mpris :demand t)
+ (defalias 'jao-streaming-list
+ (if jao-sway-enabled #'jao-sway-run-or-focus-deezer #'ignore))
(defalias 'jao-streaming-like #'ignore)
(defalias 'jao-streaming-dislike #'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)
+ (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 "firefox" :session)
- (jao-mpris-register "chromium" :session)
-
- #+end_src
-*** spotify
- Access to spotify uses packages tangled from [[./lib/media/espotify.org][espotify.org]], which
- offers functionality tailored to the completion engines at hand:
- #+begin_src emacs-lisp
- (jao-load-path "espotify")
-
- (use-package espotify
- :demand t
- :init (setq espotify-service-name "mopidy"))
- (use-package consult-spotify :demand t)
- (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-spt
- :demand t
- :config
- (defun jao-spt-setup-aliases ()
- (setq espotify-play-uri-function #'jao-spt-play-uri)
- (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)
- (defalias 'jao-streaming-like #'jao-spt-like)
- (defalias 'jao-streaming-dislike #'jao-spt-dislike)))
-
- (defvar jao-spt-on nil)
- (defun jao-spt-on-p () jao-spt-on)
- ;; (jao-spt-setup-aliases)
-
- (jao-def-exec-in-term "spt" "spt" (jao-afio--goto-scratch-1))
-
- (defun jao-streaming-toggle-player ()
- (interactive)
- (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")))
+ (jao-mpris-register "playerctld"
+ :session (if jao-modeline-in-minibuffer-p -10 70))
#+end_src
*** mpc
@@ -3103,14 +3042,12 @@
(transient-define-prefix jao-transient-streaming ()
[:description
- (lambda () (format "Streaming using %s (%s)"
- (if jao-spt-on "spt" "MPRIS")
- (if jao-spt-on "" jao-mpris-player)))
- ["Search"
- ("a" "album" jao-streaming-album)
- ("A" "artist" jao-streaming-artist)
- ("t" "track" jao-streaming-track)
- ("P" "playlist" jao-streaming-playlist)]
+ (lambda () (format "Streaming using %s" jao-mpris-player))
+ ;; ["Search"
+ ;; ("a" "album" jao-streaming-album)
+ ;; ("A" "artist" jao-streaming-artist)
+ ;; ("t" "track" jao-streaming-track)
+ ;; ("P" "playlist" jao-streaming-playlist)]
["Play"
("s" "toggle" jao-streaming-toggle)
("n" "next" jao-streaming-next)
@@ -3123,19 +3060,18 @@
["Browse"
("l" "playing list" jao-streaming-list)
("L" "lyrics" jao-streaming-lyrics)
- ("w" "currently playing" jao-streaming-current)
- ("T" "toggle player" jao-streaming-toggle-player)]
+ ("w" "currently playing" jao-streaming-current)]
["Act"
("k" "like" jao-streaming-like)
- ("K" "dislike" jao-streaming-dislike)
- ("S" "toggle shuffling" jao-spt-toggle-shuffle :if jao-spt-on-p)]])
+ ("K" "dislike" jao-streaming-dislike)]])
(transient-define-prefix jao-transient-media ()
[["Play"
("m" "toggle" jao-player-toggle)
("n" "next" jao-player-next)
("p" "previous" jao-player-previous)
- ("s" "toggle spotify" espotify-play-pause)]
+ ("s" "toggle streaming" jao-streaming-toggle)
+ ]
["Seek and search"
("f" "seek fwd" jao-player-seek-10 :transient t)
("F" "seek bwd" jao-player-seek--10 :transient t)