kebaux

DOOM-inspired Emacs Timer

custom-doom-themed-emacs-timer

I decided to give the standard emacs org-timer a DOOM-inspired makeover.

;; enable desktop notifications to allow the custom timer notification to display
(setq alert-default-style 'notifications)

;; custom notification to display when a timer has finished using org-timer-start-timer
(after! org
  (require 'alert)  ;; ensure alert is loaded

  (defun my/org-timer-notify ()
    "Notify me when an Org timer is finished with a random Doom-style message and play a sound."
    (let* ((num (+ 10 (random 91))) ;; generates a random number between 10 and 100
           (enemy-list '("Cacodemons" "Hell Knights" "Imps" "Mancubis" "Hellhounds"))
           (type (nth (random (length enemy-list)) enemy-list)) ; random enemy
           (msg (format "%d %s vanquished, rest up slayer." num type))
           (sound-file (expand-file-name "~/org/media/doom-slayer.mp3")))  ;; path to the audio file
      (alert msg :title "DOOM Timer")
      (when (executable-find "ffplay")
        (start-process "doom-sound" nil "ffplay" "-nodisp" "-autoexit" sound-file))
      (message "%s" msg)))

  (add-hook 'org-timer-done-hook #'my/org-timer-notify))

note: this code assumes FFMPEG is installed on the machine, in order to play the audio file.

;; if you want to use another library for audio playback, modify this part of the snippet
(when (executable-find "ffplay")
        (start-process "doom-sound" nil "ffplay" "-nodisp" "-autoexit" sound-file))



#doom-emacs #emacs #org-mode