Comments (6)
This sounds like a great idea!
from alert.
from alert.
If the style notifier
is https://github.com/julienXX/terminal-notifier, then it seems like it can take a -group ID
(no need to keep a hashmap for that one); I don't have a Mac to test that on though.
If growlnotify
is the same as http://www.growlforwindows.com/gfw/help/growlnotify.aspx then this one seems usable: /c:coalesingid The coalescing id used to update/replace existing notifications.
I don't know if any other styles would support replacing.
from alert.
Would it also make sense to add this as the :remover
of the style? Ie.:
diff --git a/alert.el b/alert.el
index 9b5ce12..c699e33 100644
--- a/alert.el
+++ b/alert.el
@@ -798,8 +798,18 @@ by the `notifications' style.")
(puthash (plist-get info :id) id alert-notifications-ids)))
(alert-message-notify info))
+(defun alert-notifications-remove (info)
+ "Remove the `notifications-notify' message based on INFO :id."
+ (message "remove %S" info)
+ (let ((id (and (plist-get info :id)
+ (gethash (plist-get info :id) alert-notifications-ids))))
+ (when id
+ (notifications-close-notification id)
+ (remhash (plist-get info :id) alert-notifications-ids))))
+
(alert-define-style 'notifications :title "Notify using notifications"
- :notifier #'alert-notifications-notify))
+ :notifier #'alert-notifications-notify
+ :remover #'alert-notifications-remove))
(defcustom alert-notifier-command (executable-find "terminal-notifier")
One minor issue is that this makes it a bit confusing to test, since simply doing (alert "test test" :id "new-mail")
from eval-expression
will get immediately removed by the post-command-hook
alert-remove-on-command
, unless you also provide some :buffer
to it.
OTOH, adding a :remover
probably makes the alert styles act more like each other wrt. never-persist and buffer changes and such.
from alert.
@jwiegley I find the above (defun alert-notifications-remove
handy, but I'm not sure if having it as :remover
can mess up things. Should I make a PR with just the defun for now?
from alert.
Sure, that's safe enough to merge right away.
from alert.
Related Issues (20)
- tmux-specific alert styles HOT 1
- [FR] Add severity "emoji icons"
- Minor mode to allow users to override the builtin `notifications-notify` command with `alert`?
- two 'ignore styles?
- alert-trivial-face foreground color "Dark Purple" is invalid?
- Alert always labels libnotify notifications as transient HOT 1
- post-command-hook alert-remove-on-command should not act during eval-expression
- Race Condition On mode-line Prevents (Meaningful) Restore
- alert broken using growl on Windows
- alert won't notify via notify-send HOT 2
- not working with Chinese or Emoji when style is osx-notifier HOT 1
- not working well with notifier style HOT 1
- :persistent doesn't work with libnotify HOT 5
- Support sounds
- Enhancement request: use https://github.com/KDE/snoretoast instead
- Feature request: ability to change app name
- Use `notifications-notify`, not `notify-send` command? HOT 1
- Parameter `:style` is not handled correctly HOT 2
- invalid-function: log4e:deflogger HOT 2
- alert-fade-time not working with osx-notifier
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from alert.