Last active
August 29, 2015 14:23
-
-
Save ayman/5fcf7be488d3cde6fcdd to your computer and use it in GitHub Desktop.
Making MacOS notifications kinda work.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
| ;; Jabber Terminal Notifier | |
| ;; requires 'init-terminal-notifier.el' | |
| ;; https://gist.github.com/ayman/bb72a25e16af9e6f30bf | |
| (defun jabber-info-terminal-notify (infotype buffer text) | |
| "Pushing info notifications through terminal-notify." | |
| (unless (get-buffer-window buffer) | |
| (terminal-notifier-notify "Jabber" (jabber-escape-xml text)))) | |
| (defun jabber-message-terminal-notify (from buffer text title) | |
| "Pushing messages notifications through terminal-notify." | |
| (unless (get-buffer-window buffer) | |
| (terminal-notifier-notify title (jabber-escape-xml text)))) | |
| (defun jabber-muc-terminal-notify (nick group buffer text title) | |
| "Pushing MUC notifications through terminal-notify." | |
| (unless (get-buffer-window buffer) | |
| (terminal-notifier-notify title | |
| (if nick | |
| (format "%s: %s" nick text) | |
| text)))) | |
| (defun jabber-muc-terminal-notify-personal (nick group buffer text title) | |
| (if (jabber-muc-looks-like-personal-p text group) | |
| (jabber-muc-terminal-notify nick group buffer text title))) | |
| (pushnew 'jabber-message-terminal-notify | |
| (get 'jabber-alert-message-hooks 'custom-options)) | |
| (pushnew 'jabber-muc-terminal-notify | |
| (get 'jabber-alert-muc-hooks 'custom-options)) | |
| (pushnew 'jabber-muc-terminal-notify-personal | |
| (get 'jabber-alert-muc-hooks 'custom-options)) | |
| ;; (add-hook 'jabber-alert-message-hooks 'jabber-notify-message) | |
| (add-hook 'jabber-chat-mode-hook 'goto-address) | |
| ;; Message alert hooks | |
| ;; (define-jabber-alert echo "Show a message in the echo area" | |
| ;; (lambda (msg) | |
| ;; (unless (minibuffer-prompt) | |
| ;; (message "%s" msg)))) | |
| ;; Define location of gnutls-cli on OS X, instaled via brew | |
| ;; (setq starttls-use-gnutls t | |
| ;; starttls-gnutls-program "/opt/local/bin/gnutls-cli" | |
| ;; starttls-extra-arguments nil) | |
| ;; (remove-hook 'jabber-alert-presence-hooks | |
| ;; 'sr-jabber-alert-presence-func) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment