Releases: DragShot/DS-Desktop-Notify
DS Desktop Notify v0.91
Here's another update with features requested through e-mail.
- Debug messages are no longer displayed on the console by default.
- A basic logging system has been put in place in
DesktopNotify
, with methodssetLogOutput
andsetLogLevel
added for customization of log output and priority level. - Log output defaults to the
System.out
stream, but it can be set to anyOutputStream
at any time. - There are four priority levels available:
DEBUG
,INFORMATION
,WARNING
andERROR
. ConstantNONE
is also available for setting for no messages to be logged at all.
DS Desktop Notify v0.90
This update in particular addresses something requested via e-mail by several people.
The library now lets you share the notification window as a service available for other processes to post notifications into. This allows for multiple JVMs, and even processes that are not JVMs, to display notifications in a single queue without colliding with each other. A new package ds.desktop.notify.service
has been added in order to make this possible.
How to use:
Displaying notifications through the service is pretty straightforward. All you need is to get a proper instance of the service through the static method NotifyService.get()
, and then use the method postNotification
to build and display your notifications instead of doing it on your own. This method supports almost everything available in DS Desktop Notify, except action events.
NotifyService service = NotifyService.get();
service.postNotification("Some title", "A message", DesktopNotify.INFORMATION, DesktopNotify.LEFT_TO_RIGHT, 0, "dark");
You can always set to null
whatever parameter you don't want to use.
Basically, the first process to try and get an instance of NotifyService
will be in control of the service, receiving a NotifyServer
, while the others will get a NotifyClient
that will communicate with the service through a local socket. Everything is setup automatically, so both kinds of instances are used in the same fashion and feel no different.
Notification services can be stopped at any moment with stop()
, although the window will remain in place as long as there are other notifications remaining, but the service itself won't be accepting any more requests. After stopping the service, you'll have to call NotifyService.reset()
and then NotifyService.get()
if you want to start a new one. Also, any clients that used to be connected to the previous service will reconnect on their own the next time they try to post a notification.
Post notifications through launch parameters
Another important change is that this new feature can also be used from the command line, just as requested. For instructions and syntax required, run the built .jar file in a command prompt with the parameter -?
or --help
.
java -jar DS-Desktop-Notify.jar -?
Here are some quick examples:
java -jar DS-Desktop-Notify.jar -t "This is a title" -m "This is a message" -p 1
java -jar DS-Desktop-Notify.jar -m "This is quite a long message, with several lines although no title.\n\nEven several paragraphs!" -p 7
java -jar DS-Desktop-Notify.jar -t "Success" -m "All tasks have been completed!" -p 7 -e light
This method supports everything NotifyService
does, and allows for notifications to be posted from any process with command line access or batch scripts. This also allows to host the notification service in a dedicated process,
java -jar DS-Desktop-Notify.jar -h start
Keep on mind that calls like this will not return control back to the script until the service stops and the notification queue ends.
DS Desktop Notify v0.85
- Now the layout orientation can be flipped globally through
DesktopNotify.setDefaultTextOrientation()
or individually usingNotificationBuilder
, in order to improve support for messages in right-to-left languages (Arabic, Persian, etc.).