Support org-pomodoro with desktop notification on macOS

This commit is contained in:
lemyx 2025-01-19 22:28:23 +08:00
parent f8565daf66
commit e12f7ff9ce
5 changed files with 65 additions and 7 deletions

View File

@ -26,9 +26,6 @@
(require 'init-meow)
(require 'init-dired)
;; Gtd
(require 'init-calendar)
;; Reading
(require 'init-english)
@ -48,6 +45,10 @@
(require 'init-tex)
(require 'init-pdf)
;; Gtd
(require 'init-calendar)
(require 'init-pomodoro)
(require 'init-session)
(emacs-session-restore)

View File

@ -14,7 +14,7 @@ fi
# emacs
brew tap d12frosted/emacs-plus
brew uninstall emacs-plus
brew install emacs-plus --with-xwidgets --with-imagemagick
brew install emacs-plus --with-xwidgets --with-imagemagick --with-dbus --with-ctags
brew services restart d12frosted/emacs-plus/emacs-plus@29
osascript -e 'tell application "Finder" to make alias file to posix file "/opt/homebrew/opt/emacs-plus@29/Emacs.app" at POSIX file "/Applications" with properties {name:"Emacs.app"}'
@ -29,9 +29,9 @@ brew install node
npm install -g yaml-language-server
npm install -g bash-language-server
npm install -g vscode-langservers-extracted
npm install -g pyright
pip3 install ruff-lsp --break-system-packages
brew install texlab
brew install basedpyright
# aider
brew install aider
@ -40,5 +40,8 @@ brew install aider
brew install --cask squirrel
brew install librime
# pomodoro
brew install terminal-notifier
# fetch submodules
git submodule update --init

54
lisp/init-pomodoro.el Normal file
View File

@ -0,0 +1,54 @@
;;; init-pomodoro.el --- Pomodoro settings -*- lexical-binding: t -*-
;;; Commentary:
;;; Code:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; org-pomodoro
(use-package org-pomodoro
:custom-face
(org-pomodoro-mode-line ((t (:inherit warning))))
(org-pomodoro-mode-line-overtime ((t (:inherit error))))
(org-pomodoro-mode-line-break ((t (:inherit success))))
:bind (:map org-mode-map
("C-c C-x m" . org-pomodoro))
:init
(with-eval-after-load 'org-agenda
(bind-keys :map org-agenda-mode-map
("K" . org-pomodoro)
("C-c C-x m" . org-pomodoro))))
;; https://github.com/devbins/.emacs.d/blob/5341a41e2b100c1228eb2438aa5a83927857cfb0/lisp/init-func.el#L335
(defun notify-osx (title msg)
(call-process "terminal-notifier"
nil 0 nil
"-group" "Emacs"
"-title" title
;; "-sender" "org.gnu.Emacs"
"-message" msg
"-sound" "Glass"
"-active" "org.gnu.Emacs"))
;; org-pomodoro mode hooks
(add-hook 'org-pomodoro-started-hook
(lambda ()
(notify-osx "Pomodoro started!" "Time for a pomodoro.")))
(add-hook 'org-pomodoro-finished-hook
(lambda ()
(notify-osx "Pomodoro completed!" "Time for a break.")))
(add-hook 'org-pomodoro-break-finished-hook
(lambda ()
(notify-osx "Pomodoro Short Break Finished" "Ready for Another?")))
(add-hook 'org-pomodoro-long-break-finished-hook
(lambda ()
(notify-osx "Pomodoro Long Break Finished" "Ready for Another?")))
(add-hook 'org-pomodoro-killed-hook
(lambda ()
(notify-osx "Pomodoro Killed" "One does not simply kill a pomodoro!")))
(provide 'init-pomodoro)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-pomodoro.el ends here

@ -1 +1 @@
Subproject commit a7f21534522a725259cf2efd46837d7bd88ec231
Subproject commit a256968d1faaf2936d12696a364158df56931cdb

@ -1 +1 @@
Subproject commit 425ff7cb89a76e08878d13743728a14a38da98ab
Subproject commit 781ee08f8d92f640dff8a0d8838b67a13a391846