I bought a new record a few days ago, and of course the first thing I did was converting it to mp3 files. Then I loaded my new music into EMMS and started listening.
And then I noticed a problem – minor but annoying. I wanted to learn the titles of the tracks, but I don’t have them in the modeline (EMMS displays the title there by default, but I turned it off to save screen real estate).
Well, system notifications to the rescue. Why not make EMMS display the track information in the system notification when it starts playing? It turns out that this is something that can be done in basically two minutes:
(defun emms-notify-track-description () "Use `notify-send' to show the description of the currecnt track." (call-process "notify-send" nil nil nil "-a" "EMMS" (emms-track-description (emms-playlist-current-selected-track)))) (add-hook 'emms-player-started-hook #'emms-notify-track-description)
Again, this is Emacs: such little customizations can be done withing minutes. Perhaps the least obvious thing here was looking up the call-process
function and finding the emms-player-started-hook
variable. The former was made easy by the fact that I did something like that before and I only had to copy-paste the invocation; the latter was made easy by the fact that I just searched for variables containing the strings emms
and hook
.
And that’s it for today, I’m going off to listen to some music now.