From 88e218faf2d52a21001eea8491aecd12c54b074a Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Mon, 7 Feb 2022 13:16:00 -0600 Subject: Add bongo --- init.el | 19 ++++++++++++++++++- lisp/+bongo.el | 17 +++++++++++++++++ lisp/+tab-bar.el | 31 +++++++++++++++++++++++++++++++ 3 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 lisp/+bongo.el diff --git a/init.el b/init.el index b204e8e..4b4d668 100644 --- a/init.el +++ b/init.el @@ -700,6 +700,8 @@ tab-bar-format-align-right ;;+tab-bar-misc-info tab-bar-separator + +tab-bar-bongo + +tab-bar-emms +tab-bar-tracking-mode +tab-bar-date)) (tab-bar-mode +1) @@ -1222,11 +1224,26 @@ See also `crux-reopen-as-root-mode'." (:load-after consult embark) (add-hook 'embark-collect-mode-hook #'consult-preview-at-point-mode)) -(setup (:straight emms) +(setup (:straight (emms + :type git + :flavor melpa + :files ("*.el" + "lisp/*.el" + "doc/emms.info" + "doc/emms.texinfo" + "emms-pkg.el") + :pre-build ("make" "-Cdoc") + :repo "https://git.savannah.gnu.org/git/emms.git")) (:also-load +emms) ;; TODO: Definitely need to do more customization here (:option emms-source-file-default-directory "~/var/music/" emms-player-mpv-update-metadata t) + (dolist (hook '(emms-browser-mode-hook + emms-lyrics-mode-hook + emms-playlist-mode-hook + emms-tag-editor-mode-hook)) + (add-hook hook #'turn-off-+key-mode) + (add-hook hook #'turn-off-user-save-mode)) (require 'emms-setup) (emms-all) (emms-default-players) diff --git a/lisp/+bongo.el b/lisp/+bongo.el new file mode 100644 index 0000000..d1a2ef4 --- /dev/null +++ b/lisp/+bongo.el @@ -0,0 +1,17 @@ +;;; +bongo.el --- customizations in bongo -*- lexical-binding: t; -*- + +;;; Commentary: + +;;; Code: + +(defun +bongo-notify () + (notifications-notify + :title "Now Playing" + :body (let ((bongo-field-separator " +")) + (substring-no-properties (bongo-formatted-infoset))) + :urgency 'low + :transient t)) + +(provide '+bongo) +;;; +bongo.el ends here diff --git a/lisp/+tab-bar.el b/lisp/+tab-bar.el index 83870e9..6567f67 100644 --- a/lisp/+tab-bar.el +++ b/lisp/+tab-bar.el @@ -48,6 +48,37 @@ ignore :help (discord-date-string))))) +(defcustom +tab-bar-emms-max-length 24 + "Maximum length of `+tab-bar-emms'." + :type 'number) + +(defun +tab-bar-emms () + "Display EMMS now playing information." + (when (and emms-mode-line-mode + emms-player-playing-p) + (let ((now-playing (+string-truncate (emms-mode-line-playlist-current) + (- +tab-bar-emms-max-length 2)))) + `((emms-now-playing menu-item + ,(concat "{" now-playing "}" " ") + emms-pause + :help ,(emms-mode-line-playlist-current)))))) + +(defun +tab-bar-bongo () + "Display Bongo now playing information." + (when (and bongo-mode-line-indicator-mode + (bongo-playing-p)) + `((bongo-now-playing menu-item + ,(concat "{" + (let ((bongo-field-separator "")) + (+string-truncate (replace-regexp-in-string + "\\(.*\\)\\(.*\\)\\(.*\\)" + "\\1: \\3" + (bongo-formatted-infoset)) + (- +tab-bar-emms-max-length 2))) + "}") + bongo-pause/resume + :help ,(funcall bongo-header-line-function))))) + (defvar +tab-bar-show-original nil "Original value of `tab-bar-show'.") -- cgit 1.4.1-21-gabe81