From 88e218faf2d52a21001eea8491aecd12c54b074a Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Mon, 7 Feb 2022 13:16:00 -0600 Subject: Add bongo --- lisp/+bongo.el | 17 +++++++++++++++++ lisp/+tab-bar.el | 31 +++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 lisp/+bongo.el (limited to 'lisp') 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