diff options
Diffstat (limited to 'custom')
-rw-r--r-- | custom/jao-custom-mac.el (renamed from custom/jao-custom-brew.el) | 9 | ||||
-rw-r--r-- | custom/jao-custom-multimedia.el | 225 |
2 files changed, 34 insertions, 200 deletions
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) |