summaryrefslogtreecommitdiffhomepage
path: root/init.el
diff options
context:
space:
mode:
Diffstat (limited to 'init.el')
-rw-r--r--init.el109
1 files changed, 101 insertions, 8 deletions
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)