Mstrodl / elcord

Discord Rich Presence / Gamebridge support for Emacs!
MIT License
196 stars 44 forks source link

EMMS Support #65

Open WiredLovelace opened 2 years ago

WiredLovelace commented 2 years ago

Well, this might seem like a very silly feature but, it would be pretty amazing to display what EMMS is currently playing. I don't know how the Discord rich application integration system works but, would it be possible to print the value of another variable as well? like... A string we define

Mstrodl commented 2 years ago

Well, this might seem like a very silly feature but, it would be pretty amazing to display what EMMS is currently playing. I don't know how the Discord rich application integration system works but, would it be possible to print the value of another variable as well? like... A string we define

You can override elcord-buffer-details-format or PR a change to elcord--details-and-state which breaks out the state parameter into it's own function if you want:

;; Override this in your own config
(defun elcord-buffer-details-format ()
  "Return the buffer details string shown on discord."
  (format "Editing %s" (buffer-name)))

;; OR:
(defun elcord--details-and-state ()
  "Obtain the details and state to use for Discord's Rich Presence."
  (let ((activity (if elcord-display-buffer-details
                      (list
                       (cons "details" (funcall elcord-buffer-details-format-function))
                       ;; Replace this expression with a function call (`elcord-buffer-state-format-function`?)
                       (cons "state" (format "Line %s (%s of %S)"
                                             (format-mode-line "%l")
                                             (format-mode-line "%l")
                                             (+ 1 (count-lines (point-min) (point-max))))))
                    (list
                     (cons "details" "Editing")
                     (cons "state" (elcord--mode-text))))))
    (when elcord-display-elapsed
      (push (list "timestamps" (cons "start" elcord--startup-time)) activity))
    activity))
zackattackz commented 1 year ago

Don't know if you're still interested but I'm almost finished with an auxiliary package that will add this functionality. It will display the song name, artist name, time remaining, and display album art picture :D