alert icon indicating copy to clipboard operation
alert copied to clipboard

terminal-notifier style notification never shows

Open asimpson opened this issue 8 years ago • 11 comments

terminal-notifier style notification is never displayed but is added to the Notification Center in OS X. The behavior is like I have Do Not Disturb enabled even when I don't. A notification does correctly display when I invoke terminal-notifier directly via async-shell-command.

Mac OS Version: macOS Sierra Emacs version: 25.1.1 Alert version: 1.2

asimpson avatar Nov 14 '16 14:11 asimpson

Update: I've tracked this down to the -sender flag. Removing this causes the notification to fire correctly. E.g.

(defun alert-notifier-notify (info)
  (if alert-notifier-command
      (let ((args
             (list "-title"   (alert-encode-string (plist-get info :title))
                   "-message" (alert-encode-string (plist-get info :message)))))
        (apply #'call-process alert-notifier-command nil nil nil args))
    (alert-message-notify info)))

asimpson avatar Nov 14 '16 22:11 asimpson

Well! I was having this problem also, but it turns out not to be a problem. Sort of.

The issue is that when you identify the alert sender as Emacs, Mac OS will not display the alert when Emacs is in the foreground. This is consistent with all other Mac alerts. If you do something like

(progn (sleep-for 3)
       (alert "hello world"))

And then tab away from Emacs, I believe you'll see the alert working correctly.

waisbrot avatar Dec 07 '16 01:12 waisbrot

@waisbrot ah that makes sense, thank you! I'm going to have to figure out another way to be alerted for org related things when I'm in Emacs.

asimpson avatar Dec 07 '16 03:12 asimpson

I was thinking about this last night. The problem is that while the Mac rule makes sense for normal applications (don't alert me about a new email when I'm in the middle of reading email), Emacs is more like an operating system here. I do want to be alerted about a new email when I'm editing some source code.

Therefore, it seems to me that what you and I want is to take away -sender and have Emacs manage the logic of "display an alert only if it's coming from an inactive buffer".

waisbrot avatar Dec 07 '16 11:12 waisbrot

Yep, that’s where I’ve landed as well. It might also make sense to explore a more “native” to Emacs notification approach, but I don’t know what that looks like at the moment.

asimpson avatar Dec 07 '16 13:12 asimpson

So, alert hasn't been popping up for me either. I've been using some amalgamation of sauron / alert and recently got rid of sauron so I thought it was that. After some googling and banging my head against the wall, I find this issue. Great! Other people have this problem.

So, I go to look at which asshole added the -sender flag: 556c6300

seanfarley avatar Feb 22 '17 23:02 seanfarley

:joy: Yeah that guy, what a moron :joy:

asimpson avatar Feb 23 '17 14:02 asimpson

I'll revert it.

jwiegley avatar Feb 23 '17 18:02 jwiegley

Well, before it's reverted, we need to decide how clicking on a notification will bring up emacs, right?

seanfarley avatar Feb 23 '17 18:02 seanfarley

It's better to revert, get back functionality for reporting notifications, and then decide that question. I never click on notifications from alert.el, so I hadn't even thought about the usefulness of this: although, it would be great to click on the bubble, and jump to the buffer that originating the warning.

jwiegley avatar Feb 23 '17 19:02 jwiegley

Righto, totally agree. Though, just to point out, it's only for notifications when emacs is active (still works with -sender when not active ... didn't know if that was clear or not).

seanfarley avatar Feb 23 '17 19:02 seanfarley