summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--attic/elisp/misc.el98
-rw-r--r--custom/jao-custom-mac.el (renamed from custom/jao-custom-brew.el)9
-rw-r--r--custom/jao-custom-multimedia.el225
-rw-r--r--init.el109
4 files changed, 233 insertions, 208 deletions
diff --git a/attic/elisp/misc.el b/attic/elisp/misc.el
index 2213646..69343fb 100644
--- a/attic/elisp/misc.el
+++ b/attic/elisp/misc.el
@@ -1081,3 +1081,101 @@ It should be the title of the web page as returned by `rdrview'"
(if rdrview
(eww-rdrview-toggle-and-reload)
(eww-readable)))
+
+;;; spotify
+(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))
+
+;;; spt
+(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)
+ (defalias 'jao-streaming-toggle-shuffle #'jao-spt-toggle-shuffle)))
+
+(jao-def-exec-in-term "spt" "spt" (jao-afio-goto-scratch))
+
+(defvar jao-spt-on t)
+
+(defun jao-streaming-toggle-player ()
+ (interactive)
+ (if jao-spt-on
+ (progn (setq jao-mpris-player "playerctld")
+ (require 'jao-mpris)
+ (jao-mpris-setup-aliases))
+ (jao-spt-setup-aliases)
+ (setq jao-mpris-player "spt"))
+ (setq jao-spt-on (not jao-spt-on))
+ (message "%s activated " jao-mpris-player))
+
+(jao-streaming-toggle-player)
+
+;;; mpd + mopidy
+(use-package jao-mpc
+ :demand t
+ :commands jao-mpc-setup)
+
+(defvar jao-mopidy-port 6669)
+(defvar jao-mpc-last-port jao-mpc-port)
+
+(defun jao-mpc-toggle-port ()
+ (interactive)
+ (setq jao-mpc-port
+ (if (equal jao-mpc-port jao-mopidy-port) 6600 jao-mopidy-port)
+ jao-mpc-last-port jao-mpc-port))
+
+(defsubst jao-mpc-mopidy-p () (equal jao-mpc-last-port jao-mopidy-port))
+
+(jao-mpc-setup jao-mopidy-port 70)
+
+(defun jao-mpc-pport (&optional mop)
+ (cond ((or mop (jao-mpc-playing-p jao-mopidy-port)) jao-mopidy-port)
+ ((jao-mpc-playing-p) 6600)
+ (t jao-mpc-last-port)))
+
+(defmacro jao-defun-play (name &optional mpc-name)
+ (let ((arg (gensym)))
+ `(defun ,(intern (format "jao-player-%s" name)) (&optional ,arg)
+ (interactive "P")
+ (,(intern (format "jao-mpc-%s" (or mpc-name name)))
+ (setq jao-mpc-last-port (jao-mpc-pport ,arg))))))
+
+(jao-defun-play toggle)
+(jao-defun-play next)
+(jao-defun-play previous)
+(jao-defun-play stop)
+(jao-defun-play echo echo-current-times)
+(jao-defun-play list show-playlist)
+(jao-defun-play info lyrics-track-data)
+(jao-defun-play browse show-albums)
+(jao-defun-play select-album)
+
+(defun jao-player-seek (delta) (jao-mpc-seek delta (jao-mpc-pport)))
+
+(defalias 'jao-player-connect 'jao-mpc-connect)
+(defalias 'jao-player-play 'jao-mpc-play)
diff --git a/custom/jao-custom-brew.el b/custom/jao-custom-mac.el
index 6f57e65..05c5c4b 100644
--- a/custom/jao-custom-brew.el
+++ b/custom/jao-custom-mac.el
@@ -1,4 +1,4 @@
-;;; jao-custom-brew.el --- Setup for homebrew -*- lexical-binding: t; -*-
+;;; jao-custom-brew.el --- Setup for mac env -*- lexical-binding: t; -*-
(setenv "HOMEBREW_PREFIX" "/opt/homebrew")
(setenv "HOMEBREW_CELLAR" "/opt/hombrew/Cellar")
@@ -12,10 +12,11 @@
"/Applications/Emacs.app/Contents/MacOS/libexec-arm64-11"
"/opt/homebrew/sbin"
"/opt/homebrew/bin"
- "~/.local/bin"))
+ "~/.local/bin"
+ "/Library/TeX/texbin"))
(jao-exec-path p))
(add-to-list 'Info-directory-list "/opt/homebrew/share/info")
-(provide 'jao-custom-brew)
-;;; jao-custom-brew.el ends here
+(provide 'jao-custom-mac)
+;;; jao-custom-mac.el ends here
diff --git a/custom/jao-custom-multimedia.el b/custom/jao-custom-multimedia.el
index a550a47..cc91aa7 100644
--- a/custom/jao-custom-multimedia.el
+++ b/custom/jao-custom-multimedia.el
@@ -59,160 +59,6 @@
(defalias 'jao-streaming-volume #'ignore)
(defalias 'jao-streaming-volume-down #'ignore)
-;;; mpris
-(defun jao-mpris-lyrics (&optional force)
- (interactive "P")
- (jao-show-lyrics force #'jao-mpris-artist-title))
-
-(defun jao-mpris-mopidy-p () (string= "mopidy "jao-mpris-player))
-
-(defun jao-mpc-mopidy-playlist ()
- (interactive)
- (jao-mpc-show-playlist jao-mopidy-port))
-
-(use-package jao-mpris :demand t)
-
-(defun jao-mpris-setup-aliases ()
- (setq espotify-play-uri-function #'espotify-play-uri-with-dbus)
- ;; (setq jao-mpris-player "mopidy")
- (defalias 'jao-streaming-list #'jao-mpc-mopidy-playlist)
- (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-register "playerctld" :session 70)
-;; (jao-mpris-register "mopidy" :session 70)
-
-;;; mpc
-(use-package jao-mpc
- :demand t
- :commands jao-mpc-setup)
-
-(defvar jao-mopidy-port 6669)
-(defvar jao-mpc-last-port jao-mpc-port)
-
-(defun jao-mpc-toggle-port ()
- (interactive)
- (setq jao-mpc-port
- (if (equal jao-mpc-port jao-mopidy-port) 6600 jao-mopidy-port)
- jao-mpc-last-port jao-mpc-port))
-
-(defsubst jao-mpc-mopidy-p () (equal jao-mpc-last-port jao-mopidy-port))
-
-(jao-mpc-setup jao-mopidy-port 70)
-
-(defun jao-mpc-pport (&optional mop)
- (cond ((or mop (jao-mpc-playing-p jao-mopidy-port)) jao-mopidy-port)
- ((jao-mpc-playing-p) 6600)
- (t jao-mpc-last-port)))
-
-(defmacro jao-defun-play (name &optional mpc-name)
- (let ((arg (gensym)))
- `(defun ,(intern (format "jao-player-%s" name)) (&optional ,arg)
- (interactive "P")
- (,(intern (format "jao-mpc-%s" (or mpc-name name)))
- (setq jao-mpc-last-port (jao-mpc-pport ,arg))))))
-
-(jao-defun-play toggle)
-(jao-defun-play next)
-(jao-defun-play previous)
-(jao-defun-play stop)
-(jao-defun-play echo echo-current-times)
-(jao-defun-play list show-playlist)
-(jao-defun-play info lyrics-track-data)
-(jao-defun-play browse show-albums)
-(jao-defun-play select-album)
-
-(defun jao-player-seek (delta) (jao-mpc-seek delta (jao-mpc-pport)))
-
-(defalias 'jao-player-connect 'jao-mpc-connect)
-(defalias 'jao-player-play 'jao-mpc-play)
-
-;;; spotify
-(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))
-
-;;; spt
-(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)
- (defalias 'jao-streaming-toggle-shuffle #'jao-spt-toggle-shuffle)))
-
-(jao-def-exec-in-term "spt" "spt" (jao-afio-goto-scratch))
-
-(defvar jao-spt-on t)
-
-(defun jao-streaming-toggle-player ()
- (interactive)
- (if jao-spt-on
- (progn (setq jao-mpris-player "playerctld")
- (require 'jao-mpris)
- (jao-mpris-setup-aliases))
- (jao-spt-setup-aliases)
- (setq jao-mpris-player "spt"))
- (setq jao-spt-on (not jao-spt-on))
- (message "%s activated " jao-mpris-player))
-
-(jao-streaming-toggle-player)
-
-;;; music transients
-(require 'jao-lyrics)
-(setq jao-lyrics-info-function #'jao-player-info)
-
-(defun jao-player-seek-10 () (interactive) (jao-player-seek 10))
-(defun jao-player-seek--10 () (interactive) (jao-player-seek -10))
-
-(defun jao-streaming-clear () (interactive) (jao-mpc-clear jao-mopidy-port))
-
-(defun jao-streaming-echo-current ()
- (interactive)
- (jao-mpc-echo-current jao-mopidy-port))
-
-(defun jao-streaming-show-playlist ()
- (interactive)
- (jao-mpc-show-playlist jao-mopidy-port))
-
-(use-package jao-random-album
- :demand t
- :config
- (defun jao--notify-album (album)
- (unless jao-minibuffer-mode
- (jao-notify album "Next album" jao-notify-audio-icon))
- (jao-minibuffer-refresh))
- (setq jao-random-album-notify #'jao--notify-album))
-
(defun jao-toggle-pasystray-applet ()
(interactive)
(or (jao-shell-kill-p "pasystray") (jao-shell-exec "pasystray")))
@@ -236,7 +82,8 @@
("u" "up" jao-streaming-volume :transient t)
("d" "down" jao-streaming-volume-down :transient t)]
["Browse"
- ("l" "playing list" jao-streaming-list :if jao-mpris-mopidy-p)
+ ("l" "playing list" j
+ ao-streaming-list :if jao-mpris-mopidy-p)
("L" "lyrics" jao-streaming-lyrics)
("w" "currently playing" jao-streaming-current)]
["Act" :if jao-mpris-mopidy-p
@@ -244,48 +91,34 @@
("K" "dislike" jao-streaming-dislike)
("S" "toggle shuffle" jao-streaming-toggle-shuffle)]])
-(transient-define-prefix jao-transient-media ()
- [["Play"
- ("m" "toggle" jao-player-toggle)
- ("n" "next" jao-player-next)
- ("p" "previous" jao-player-previous)
- ("s" "select album" jao-player-select-album)]
- ["Seek and search"
- ("f" "seek fwd" jao-player-seek-10 :transient t)
- ("F" "seek bwd" jao-player-seek--10 :transient t)
- ("a" "search album" jao-mpc-select-album)
- ("S" "play stream" jao-mpc-play-stream)]
- ["Browse"
- ("b" "browse" jao-player-browse)
- ("l" "show play list" jao-player-list)
- ("L" "show lyrics" jao-show-lyrics)
- ("w" "now playing" jao-player-echo)]
- [:description
- (lambda ()
- (message "%s %s"
- (if (jao-mpc-mopidy-p) "mopidy" "mpd")
- (if (jao-mpc-playing-p)
- (jao-mpc--current-timestr t)
- (jao-mpc--current-str)))
- (format "Master %s%%" (jao-mixer-get-level nil t)))
- ("d" "down" jao-mixer-master-down :transient t)
- ("u" "up" jao-mixer-master-up :transient t)
- ("M" "toggle" jao-mixer-master-toggle)]
- [:description
- (lambda () (format "Capture %s%%" (jao-mixer-get-level "Capture" t)))
- ("D" "down" jao-mixer-capture-down :transient t)
- ("U" "up" jao-mixer-capture-up :transient t)]
- ["Utilities"
- ("c" "reconnect to mpd" jao-player-connect)
- ("N" "next random album" jao-random-album-next)
- ("r" (lambda ()
- (concat (if jao-random-album-active "dis" "en") "able random album"))
- jao-random-album-toggle)
- ;; ("P" (lambda () (concat "Toggle to " (if (jao-mpc-mopidy-p) "mpd" "mopidy")))
- ;; jao-mpc-toggle-port)
- ("P" "pasystray" jao-toggle-pasystray-applet)]])
+;;; mpris
+(defun jao-mpris-lyrics (&optional force)
+ (interactive "P")
+ (jao-show-lyrics force #'jao-mpris-artist-title))
+
+(defun jao-mpris-mopidy-p () (string= "mopidy "jao-mpris-player))
+
+(defun jao-mpc-mopidy-playlist ()
+ (interactive)
+ (jao-mpc-show-playlist jao-mopidy-port))
+
+(use-package jao-mpris :demand t)
+
+(defun jao-mpris-setup-aliases ()
+ (setq espotify-play-uri-function #'espotify-play-uri-with-dbus)
+ ;; (setq jao-mpris-player "mopidy")
+ (defalias 'jao-streaming-list #'jao-mpc-mopidy-playlist)
+ (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))
-(global-set-key (kbd "s-m") #'jao-transient-media)
+(jao-mpris-register "playerctld" :session 70)
;;; - provide
(provide 'jao-custom-multimedia)
diff --git a/init.el b/init.el
index 666d551..b29fab9 100644
--- a/init.el
+++ b/init.el
@@ -103,7 +103,7 @@
(require 'info)
(add-to-list 'Info-directory-list jao-info-dir)
-(jao-when-darwin (require 'jao-custom-brew))
+(jao-when-darwin (require 'jao-custom-mac))
(jao-exec-path (expand-file-name "bin" jao-emacs-dir))
@@ -993,13 +993,14 @@
scroll-step 1
redisplay-skip-fontification-on-input nil))
-(use-package ultra-scroll
- :ensure t
- :init
- (setq scroll-conservatively 0 ; or whatever value you prefer, since v0.4
- scroll-margin 0) ; important: scroll-margin>0 not yet supported
- :config
- (ultra-scroll-mode 1))
+(jao-when-linux
+ (use-package ultra-scroll
+ :ensure t
+ :init
+ (setq scroll-conservatively 0 ; or whatever value you prefer, since v0.4
+ scroll-margin 0) ; important: scroll-margin>0 not yet supported
+ :config
+ (ultra-scroll-mode 1)))
;;;; show diffs when running C-x s
(add-to-list 'save-some-buffers-action-alist
@@ -1653,6 +1654,98 @@
(jao-when-linux (require 'jao-custom-multimedia))
+;;;; mpc
+(use-package jao-mpc :demand t)
+
+(defmacro jao-defun-play (name &optional mpc-name)
+ (let ((arg (gensym)))
+ `(defun ,(intern (format "jao-player-%s" name)) (&optional ,arg)
+ (interactive "P")
+ (,(intern (format "jao-mpc-%s" (or mpc-name name)))))))
+
+(jao-defun-play toggle)
+(jao-defun-play next)
+(jao-defun-play previous)
+(jao-defun-play stop)
+(jao-defun-play echo echo-current-times)
+(jao-defun-play list show-playlist)
+(jao-defun-play info lyrics-track-data)
+(jao-defun-play browse show-albums)
+(jao-defun-play select-album)
+
+(defun jao-player-seek (delta) (jao-mpc-seek delta))
+
+(defalias 'jao-player-connect 'jao-mpc-connect)
+(defalias 'jao-player-play 'jao-mpc-play)
+
+(use-package jao-lyrics
+ :init
+ (setq jao-lyrics-info-function #'jao-player-info
+ jao-lyrics-cache-dir (jao-d-l "~/Documents/lyrics" "~/.lyrics")))
+
+(defun jao-player-seek-10 () (interactive) (jao-player-seek 10))
+(defun jao-player-seek--10 () (interactive) (jao-player-seek -10))
+
+(defun jao-streaming-clear () (interactive) (jao-mpc-clear jao-mopidy-port))
+
+(defun jao-streaming-echo-current ()
+ (interactive)
+ (jao-mpc-echo-current jao-mopidy-port))
+
+(defun jao-streaming-show-playlist ()
+ (interactive)
+ (jao-mpc-show-playlist jao-mopidy-port))
+
+(use-package jao-random-album
+ :demand t
+ :config
+ (defun jao--notify-album (album)
+ (unless jao-minibuffer-mode
+ (jao-notify album "Next album" jao-notify-audio-icon))
+ (jao-minibuffer-refresh))
+ (setq jao-random-album-notify #'jao--notify-album))
+
+(transient-define-prefix jao-transient-media ()
+ [["Play"
+ ("m" "toggle" jao-player-toggle)
+ ("n" "next" jao-player-next)
+ ("p" "previous" jao-player-previous)
+ ("s" "select album" jao-player-select-album)]
+ ["Seek and search"
+ ("f" "seek fwd" jao-player-seek-10 :transient t)
+ ("F" "seek bwd" jao-player-seek--10 :transient t)
+ ("a" "search album" jao-mpc-select-album)
+ ("S" "play stream" jao-mpc-play-stream)]
+ ["Browse"
+ ("b" "browse" jao-player-browse)
+ ("l" "show play list" jao-player-list)
+ ("L" "show lyrics" jao-show-lyrics)
+ ("w" "now playing" jao-player-echo)]
+ [:description
+ (lambda ()
+ (message "mpd %s" (if (jao-mpc-playing-p)
+ (jao-mpc--current-timestr t)
+ (jao-mpc--current-str)))
+ (format "Master %s%%" (jao-mixer-get-level nil t)))
+ :if jao-is-linux
+ ("d" "down" jao-mixer-master-down :transient t)
+ ("u" "up" jao-mixer-master-up :transient t)
+ ("M" "toggle" jao-mixer-master-toggle)]
+ [:description
+ (lambda () (format "Capture %s%%" (jao-mixer-get-level "Capture" t)))
+ :if jao-is-linux
+ ("D" "down" jao-mixer-capture-down :transient t)
+ ("U" "up" jao-mixer-capture-up :transient t)]
+ ["Utilities"
+ ("c" "reconnect to mpd" jao-player-connect)
+ ("N" "next random album" jao-random-album-next)
+ ("r" (lambda ()
+ (concat (if jao-random-album-active "dis" "en") "able random album"))
+ jao-random-album-toggle)
+ ("P" "pasystray" jao-toggle-pasystray-applet :if jao-is-linux)]])
+
+(global-set-key (kbd "s-m") #'jao-transient-media)
+
;;; Graphical window system
(defvar jao-exwm-enabled nil)