You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@netbeans.apache.org by Hector Espert <he...@gmail.com> on 2020/05/16 11:26:19 UTC

Netbeans notifications API

Hi everybody.

After the first proposal to integrate the native linux notification system
https://github.com/apache/netbeans/pull/1948, I started to work in the
notifications module to expose an API.


My idea is to allow to extend the notifications system and integrate it
with the native notifications system via a future module or a external
plugin without break the current behavior.


I created a Draft PR with the first draft of the notifications API to
receive your feedback about that.
https://github.com/apache/netbeans/pull/2142


Regards

Re: Netbeans notifications API

Posted by Oliver Rettig <Ol...@orat.de>.
Hi all,
I like the idea to have the functionality in Netbeans to create notifications which are shown 
by the os-specific ways. 
best regards
Oliver
> On Sun, 17 May 2020, 21:07 Glenn Holmer, <ce...@kolabnow.com.invalid> wrote:
> > On 5/17/20 4:57 AM, Hector Espert wrote:
> > >> Why does it need native code?
> > > 
> > > I don't understand your question. When I mean the native notification
> > > system, it is the OS notification system.
> > 
> > What does it mean "native Linux notification system"? libnotify?
> > What does this try to achieve that can't be done in pure Java?
> 
> Show NetBeans notifications via the native OS desktop notifications.
> 
> Best wishes,
> 
> Neil



RE: Netbeans notifications API

Posted by Eirik Bakke <eb...@ultorg.com>.
Different users will have different opinions on this.

Users frequently get annoyed when apps reach "outside their sandbox"--e.g. Acrobat Reader begging to be updated, web pages asking permission to send notifications, Chrome tabs playing audio, or Spotify showing an album cover overlay when you try to adjust volume for a different app.

No harm in supporting OS-level NetBeans notifications, but it should not be the default.

-- Eirik

-----Original Message-----
From: Scott Palmer <sw...@gmail.com> 
Sent: Monday, May 18, 2020 11:04 AM
To: dev@netbeans.apache.org
Subject: Re: Netbeans notifications API


> On May 18, 2020, at 9:54 AM, Neil C Smith <ne...@apache.org> wrote:
> 
> On Mon, 18 May 2020 at 14:37, Glenn Holmer <ce...@kolabnow.com.invalid> wrote:
>> Yes, they are. We want native notifications so we can have native 
>> notifications.
> 
> You asked why it couldn't be done in pure Java.
> 
>> That's still not an answer. What is the use case?
> 
> Notifications that show up outside of the IDE, eg. pop up above 
> another application when you've left the IDE doing something?  Of 
> course, it's an interesting question of whether there's much overlap 
> between notifications you'd want to show up in the IDE window and not?
> 
> Best wishes,
> 
> Neil

If the OS provides a notification mechanism, that is where notifications are expected and where notifications should go. 
However, this is really something that should be solved in the JDK desktop module, like the system tray… e.g. this:
https://docs.oracle.com/javase/8/docs/api/java/awt/TrayIcon.html#displayMessage-java.lang.String-java.lang.String-java.awt.TrayIcon.MessageType-

Though if other non-system-tray notifications should be used, then it is still something that should be addressed by the desktop module and then used by NetBeans.

I suggest the efforts go towards generic notification support in OpenJDK and then come back to utilize it in NetBeans. ;-)

Cheers,

Scott
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@netbeans.apache.org
For additional commands, e-mail: dev-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists




Re: Netbeans notifications API

Posted by Scott Palmer <sw...@gmail.com>.
> On May 18, 2020, at 9:54 AM, Neil C Smith <ne...@apache.org> wrote:
> 
> On Mon, 18 May 2020 at 14:37, Glenn Holmer <ce...@kolabnow.com.invalid> wrote:
>> Yes, they are. We want native notifications so we can have native
>> notifications.
> 
> You asked why it couldn't be done in pure Java.
> 
>> That's still not an answer. What is the use case?
> 
> Notifications that show up outside of the IDE, eg. pop up above
> another application when you've left the IDE doing something?  Of
> course, it's an interesting question of whether there's much overlap
> between notifications you'd want to show up in the IDE window and not?
> 
> Best wishes,
> 
> Neil

If the OS provides a notification mechanism, that is where notifications are expected and where notifications should go. 
However, this is really something that should be solved in the JDK desktop module, like the system tray…
e.g. this:
https://docs.oracle.com/javase/8/docs/api/java/awt/TrayIcon.html#displayMessage-java.lang.String-java.lang.String-java.awt.TrayIcon.MessageType-

Though if other non-system-tray notifications should be used, then it is still something that should be addressed by the desktop module and then used by NetBeans.

I suggest the efforts go towards generic notification support in OpenJDK and then come back to utilize it in NetBeans. ;-)

Cheers,

Scott
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@netbeans.apache.org
For additional commands, e-mail: dev-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists




Re: Netbeans notifications API

Posted by Neil C Smith <ne...@apache.org>.
On Mon, 18 May 2020 at 14:37, Glenn Holmer <ce...@kolabnow.com.invalid> wrote:
> Yes, they are. We want native notifications so we can have native
> notifications.

You asked why it couldn't be done in pure Java.

> That's still not an answer. What is the use case?

Notifications that show up outside of the IDE, eg. pop up above
another application when you've left the IDE doing something?  Of
course, it's an interesting question of whether there's much overlap
between notifications you'd want to show up in the IDE window and not?

Best wishes,

Neil

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@netbeans.apache.org
For additional commands, e-mail: dev-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists




Re: Netbeans notifications API

Posted by Glenn Holmer <ce...@kolabnow.com.INVALID>.
On 5/18/20 8:15 AM, Neil C Smith wrote:
> On Mon, 18 May 2020 at 13:49, Glenn Holmer <ce...@kolabnow.com.invalid> wrote:
>>
>> On 5/17/20 3:12 PM, Neil C Smith wrote:
>>> On Sun, 17 May 2020, 21:07 Glenn Holmer, <ce...@kolabnow.com.invalid> wrote:
>>>> What does it mean "native Linux notification system"? libnotify?
>>>> What does this try to achieve that can't be done in pure Java?
>>>>
>>>
>>> Show NetBeans notifications via the native OS desktop notifications.
>>
>> These are tautological answers.
> 
> Not really! ;-)

Yes, they are. We want native notifications so we can have native
notifications.

>> WHY do we want to "Show NetBeans
>> notifications via the native OS desktop notifications"?
> 
> Because some users want it and other tools do it?!

That's still not an answer. What is the use case?

-- 
Glenn Holmer (Linux registered user #16682)
"After the vintage season came the aftermath -- and Cenbe."


Re: Netbeans notifications API

Posted by Neil C Smith <ne...@apache.org>.
On Mon, 18 May 2020 at 13:49, Glenn Holmer <ce...@kolabnow.com.invalid> wrote:
>
> On 5/17/20 3:12 PM, Neil C Smith wrote:
> > On Sun, 17 May 2020, 21:07 Glenn Holmer, <ce...@kolabnow.com.invalid> wrote:
> >> What does it mean "native Linux notification system"? libnotify?
> >> What does this try to achieve that can't be done in pure Java?
> >>
> >
> > Show NetBeans notifications via the native OS desktop notifications.
>
> These are tautological answers.

Not really! ;-)

> WHY do we want to "Show NetBeans
> notifications via the native OS desktop notifications"?

Because some users want it and other tools do it?!

Personally I would probably have it switched off, but if there's a
call for it, someone wants to build it and it's not too much of a
hassle to implement and support, it would be a nice bit of desktop
integration.

Best wishes,

Neil

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@netbeans.apache.org
For additional commands, e-mail: dev-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists




Re: Netbeans notifications API

Posted by Glenn Holmer <ce...@kolabnow.com.INVALID>.
On 5/17/20 3:12 PM, Neil C Smith wrote:
> On Sun, 17 May 2020, 21:07 Glenn Holmer, <ce...@kolabnow.com.invalid> wrote:
> 
>> On 5/17/20 4:57 AM, Hector Espert wrote:
>>>>
>>>> Why does it need native code?
>>>
>>> I don't understand your question. When I mean the native notification
>>> system, it is the OS notification system.
>>
>> What does it mean "native Linux notification system"? libnotify?
>> What does this try to achieve that can't be done in pure Java?
>>
> 
> Show NetBeans notifications via the native OS desktop notifications.

These are tautological answers. WHY do we want to "Show NetBeans
notifications via the native OS desktop notifications"?

-- 
Glenn Holmer (Linux registered user #16682)
"After the vintage season came the aftermath -- and Cenbe."


Re: Netbeans notifications API

Posted by Neil C Smith <ne...@apache.org>.
On Sun, 17 May 2020, 21:07 Glenn Holmer, <ce...@kolabnow.com.invalid> wrote:

> On 5/17/20 4:57 AM, Hector Espert wrote:
> >>
> >> Why does it need native code?
> >
> > I don't understand your question. When I mean the native notification
> > system, it is the OS notification system.
>
> What does it mean "native Linux notification system"? libnotify?
> What does this try to achieve that can't be done in pure Java?
>

Show NetBeans notifications via the native OS desktop notifications.

Best wishes,

Neil

>

Re: Netbeans notifications API

Posted by Glenn Holmer <ce...@kolabnow.com.INVALID>.
On 5/17/20 4:57 AM, Hector Espert wrote:
>>
>> Why does it need native code?
> 
> I don't understand your question. When I mean the native notification
> system, it is the OS notification system.

What does it mean "native Linux notification system"? libnotify?
What does this try to achieve that can't be done in pure Java?

> On Sat, May 16, 2020, 15:31 Glenn Holmer <ce...@kolabnow.com.invalid> wrote:
> 
>> On 5/16/20 6:26 AM, Hector Espert wrote:
>>> After the first proposal to integrate the native linux notification
>> system
>>> https://github.com/apache/netbeans/pull/1948, I started to work in the
>>> notifications module to expose an API.
>>>
>>> My idea is to allow to extend the notifications system and integrate it
>>> with the native notifications system via a future module or a external
>>> plugin without break the current behavior.
>>
>> Why does it need native code?

-- 
Glenn Holmer (Linux registered user #16682)
"After the vintage season came the aftermath -- and Cenbe."


Re: Netbeans notifications API

Posted by Hector Espert <he...@gmail.com>.
>
> Why does it need native code?


I don't understand your question. When I mean the native notification
system, it is the OS notification system.

On Sat, May 16, 2020, 15:31 Glenn Holmer <ce...@kolabnow.com.invalid> wrote:

> On 5/16/20 6:26 AM, Hector Espert wrote:
> > After the first proposal to integrate the native linux notification
> system
> > https://github.com/apache/netbeans/pull/1948, I started to work in the
> > notifications module to expose an API.
> >
> > My idea is to allow to extend the notifications system and integrate it
> > with the native notifications system via a future module or a external
> > plugin without break the current behavior.
>
> Why does it need native code?
>
> --
> Glenn Holmer (Linux registered user #16682)
> "After the vintage season came the aftermath -- and Cenbe."
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@netbeans.apache.org
> For additional commands, e-mail: dev-help@netbeans.apache.org
>
> For further information about the NetBeans mailing lists, visit:
> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>
>

Re: Netbeans notifications API

Posted by Glenn Holmer <ce...@kolabnow.com.INVALID>.
On 5/16/20 6:26 AM, Hector Espert wrote:
> After the first proposal to integrate the native linux notification system
> https://github.com/apache/netbeans/pull/1948, I started to work in the
> notifications module to expose an API.
> 
> My idea is to allow to extend the notifications system and integrate it
> with the native notifications system via a future module or a external
> plugin without break the current behavior.

Why does it need native code?

-- 
Glenn Holmer (Linux registered user #16682)
"After the vintage season came the aftermath -- and Cenbe."


Re: Netbeans notifications API

Posted by Neil C Smith <ne...@apache.org>.
On Sun, 17 May 2020, 20:31 Matthias Bläsing, <mb...@doppel-helix.eu>
wrote:

> Everytime a java programm just
> execs an external programm "some how" handles its output and tries to
> do something intelligent with it, somewhere a small cute kitten dies.
>

:-)


> I think Hectors idea to hook into the library is the only feasible way,
> if some integration should happen. The hard part will be to adapt the
> complex cases, where a detail action is supplied and/or a component is
> passed in.
>

And to ensure we don't have memory leaks, which the previous PR had. As
does the Intellij code by the look of it. Happy to help with that, having
also worked a lot with GObjects and Java.

Best wishes,

Neil

>

Re: Netbeans notifications API

Posted by Jaroslav Tulach <ja...@gmail.com>.
Hello Hector.
I am not following the whole discussion, but here are my thoughts anyway:

In a long term, I would like to have the option to allow Netbeans use
> (optionally) the OS desktop notifications.
> But I have to recognize that it is a big challenge and probably it isn't a
> priority.
>

Using OS services, when available, is a great approach.


> For that reasons, my proposal is only focused in start to define and
> develop an API in the current notifications module that allows extend this
> module via plugins or new modules.
>

I believe we have an API:
https://bits.netbeans.org/12.0/javadoc/org-openide-awt/org/openide/awt/NotificationDisplayer.html
You don't need to change the current implementation at all - just replace
it. Implement modules to provide alternative implementations of the
`NotificationDisplayer`. Don't expose any new API or SPI in existing
modules.

My 2 Kč opinion.
-jt

Re: Netbeans notifications API

Posted by Hector Espert <he...@gmail.com>.
Hi everybody.


Thanks for your feedback.


In a long term, I would like to have the option to allow Netbeans use
(optionally) the OS desktop notifications.
But I have to recognize that it is a big challenge and probably it isn't a
priority.


There are a lot of questions for resolve, for example memory leaks with
GObjects or how implementen it other OSes.
For that reasons, my proposal is only focused in start to define and
develop an API in the current notifications module that allows extend this
module via plugins or new modules.

Best wishes,

Hector

El mar., 19 may. 2020 a las 0:03, Neil C Smith (<ne...@apache.org>)
escribió:

> On Mon, 18 May 2020, 22:00 Glenn Holmer, <ce...@kolabnow.com.invalid>
> wrote:
>
> > On 5/18/20 3:13 PM, Matthias Bläsing wrote:
> > >  * Yes, we are already down that road: on windows the NIO WatchService
> > >    cause massive regressions compared to the implementation against the
> > >    win32 API, so the switch was rolled back.
> >
> > That's one of the things I was wondering. Are there other places where
> > NetBeans uses native code?
> >
>
> Interacts with, yes, lots. Just search for JNA usage for a start. Luckily
> we've got Matthias on hand there! :-)
>
> Best wishes,
>
> Neil
>
> >
>

Re: Netbeans notifications API

Posted by Neil C Smith <ne...@apache.org>.
On Mon, 18 May 2020, 22:00 Glenn Holmer, <ce...@kolabnow.com.invalid> wrote:

> On 5/18/20 3:13 PM, Matthias Bläsing wrote:
> >  * Yes, we are already down that road: on windows the NIO WatchService
> >    cause massive regressions compared to the implementation against the
> >    win32 API, so the switch was rolled back.
>
> That's one of the things I was wondering. Are there other places where
> NetBeans uses native code?
>

Interacts with, yes, lots. Just search for JNA usage for a start. Luckily
we've got Matthias on hand there! :-)

Best wishes,

Neil

>

Re: Netbeans notifications API

Posted by Glenn Holmer <ce...@kolabnow.com.INVALID>.
On 5/18/20 3:13 PM, Matthias Bläsing wrote:
>  * Yes, we are already down that road: on windows the NIO WatchService
>    cause massive regressions compared to the implementation against the
>    win32 API, so the switch was rolled back.

That's one of the things I was wondering. Are there other places where
NetBeans uses native code?

-- 
Glenn Holmer (Linux registered user #16682)
"After the vintage season came the aftermath -- and Cenbe."


Re: Netbeans notifications API

Posted by Matthias Bläsing <mb...@doppel-helix.eu>.
Hi,

Am Montag, den 18.05.2020, 15:47 -0400 schrieb Tim Boudreau:
> A script failing can't take the JVM with it.

yeah it is really tough to catch an UnsatisfiedLinkError it tasks a
whole set of try{} catch{}...

Sorry, but could we give Hector a chance before we shoot his idea?

Seriously what is wrong here? 

 * Yes, there are more developers out there today and it got more
   diverse, so if we can (I raised my concers) cover the needed
   functions and give the option to choose the native notification
   system, why not?
 * Yes, a notification system could be pushed into the the desktop
   module of the JDK, but seriously? There is enough critisism here,
   what will happen when this is proposed for the JDK? It might make it
   by 2032
 * Yes, there are standard distributions out there, with a set of
   libraries, you can expect, and if not build in an unusual way
   provide stable function exports. If you build a custom version of
   java, gtk, the glibc or some other library the JDK relies on and
   NetBeans fails, noone will bother. Yes as long as we stay with the
   documentated API I expect it to be present, if it is not it is a bug
   of the library vendor.
 * Yes, we are already down that road: on windows the NIO WatchService
   cause massive regressions compared to the implementation against the
   win32 API, so the switch was rolled back.

Hector did good work to stabelize the the build by reactivating and
fixing unittests. So give him the benefit of a doubt. Neil already
indicated, that he has a critical eye on the native interface, so it
will not go in unreviewed.

Greetings

Matthias, who will stay with NB internal notifications and who likes
Metal LAF



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@netbeans.apache.org
For additional commands, e-mail: dev-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists




Re: Netbeans notifications API

Posted by Tim Boudreau <ni...@gmail.com>.
>
> I disagree with the "Much simpler". Everytime a java programm just
> execs an external programm "some how" handles its output and tries to
> do something intelligent with it, somewhere a small cute kitten dies.
>

As they do when you blindly assume some native library exists on a random
user's machine on an unknown version of Linux, is a version you know how to
talk to, and has kept binary compatibility with the way the IDE wants to
talk to it, and won't, say, segfault the JVM instead.  A script failing is
much less dramatic.

As someone who runs Gentoo Linux and configures my USE flags liberally to
de-bloat my OS by compiling common libraries with many features I have no
use for absent, I can tell you for sure that just because a library has the
same name as the one you're looking for does *not* mean it contains all the
calls a developer might think it does based on whatever happened to be on
their machine when they wrote a feature.

A script failing can't take the JVM with it.

-Tim

Re: Netbeans notifications API

Posted by Matthias Bläsing <mb...@doppel-helix.eu>.
Hi,

I disagree with the "Much simpler". Everytime a java programm just
execs an external programm "some how" handles its output and tries to
do something intelligent with it, somewhere a small cute kitten dies.

I think Hectors idea to hook into the library is the only feasible way,
if some integration should happen. The hard part will be to adapt the
complex cases, where a detail action is supplied and/or a component is
passed in. These are also the questions that IMHO need to be answered
before we can talk about integration. A half working notification API
is a no-go.

Greetings

Matthias

Am Sonntag, den 17.05.2020, 15:19 -0400 schrieb Tim Boudreau:
> If you're talking about notification-daemon, there is a command-line
> utility you could just exec, if present (maybe not as elegant, but
> also not
> as invasive or fragile).  As an example, the following is the script
> I put
> in /etc/acpi/actions to make the volume button turn up the volume on
> my
> laptop under Gentoo Linux:
> 
> export DISPLAY=:0
> VOLUME=`/usr/bin/amixer -c 0 set Master 5%+ | grep Playback | grep
> "Front
> Left:" | cut -b24-`
> eval "export $(egrep -z DBUS_SESSION_BUS_ADDRESS /proc/$(pgrep -u tim
> openbox)/environ)"
> NSOUT=`sudo -u tim /usr/bin/notify-send -t 750 --icon
> /usr/share/icons/gnome-human/32x32/status/audio-volume-high.png
> "Volume
> $VOLUME"`
> 
> which generates a nice notification with what the volume has been
> changed
> to.  What you need to do is simpler.  The relevant thing to call is
> /usr/bin/notify-send - *but *you will need $DISPLAY and
> $DBUS_SESSION_ADDRESS set correctly.  But unlike my situation, where
> the
> script runs as another user and I have to fish around for all that
> stuff,
> all you need to do is call /usr/bin/notify-send "Whatever you want to
> tell
> the user"
> 
> Much simpler.
> 
> -Tim
> 
> On Sat, May 16, 2020 at 7:26 AM Hector Espert <
> hectorespertpardo@gmail.com>
> wrote:
> 
> > Hi everybody.
> > 
> > After the first proposal to integrate the native linux notification
> > system
> > https://github.com/apache/netbeans/pull/1948, I started to work in
> > the
> > notifications module to expose an API.
> > 
> > 
> > My idea is to allow to extend the notifications system and
> > integrate it
> > with the native notifications system via a future module or a
> > external
> > plugin without break the current behavior.
> > 
> > 
> > I created a Draft PR with the first draft of the notifications API
> > to
> > receive your feedback about that.
> > https://github.com/apache/netbeans/pull/2142
> > 
> > 
> > Regards
> > 
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@netbeans.apache.org
For additional commands, e-mail: dev-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists




Re: Netbeans notifications API

Posted by Tim Boudreau <ni...@gmail.com>.
If you're talking about notification-daemon, there is a command-line
utility you could just exec, if present (maybe not as elegant, but also not
as invasive or fragile).  As an example, the following is the script I put
in /etc/acpi/actions to make the volume button turn up the volume on my
laptop under Gentoo Linux:

export DISPLAY=:0
VOLUME=`/usr/bin/amixer -c 0 set Master 5%+ | grep Playback | grep "Front
Left:" | cut -b24-`
eval "export $(egrep -z DBUS_SESSION_BUS_ADDRESS /proc/$(pgrep -u tim
openbox)/environ)"
NSOUT=`sudo -u tim /usr/bin/notify-send -t 750 --icon
/usr/share/icons/gnome-human/32x32/status/audio-volume-high.png "Volume
$VOLUME"`

which generates a nice notification with what the volume has been changed
to.  What you need to do is simpler.  The relevant thing to call is
/usr/bin/notify-send - *but *you will need $DISPLAY and
$DBUS_SESSION_ADDRESS set correctly.  But unlike my situation, where the
script runs as another user and I have to fish around for all that stuff,
all you need to do is call /usr/bin/notify-send "Whatever you want to tell
the user"

Much simpler.

-Tim

On Sat, May 16, 2020 at 7:26 AM Hector Espert <he...@gmail.com>
wrote:

> Hi everybody.
>
> After the first proposal to integrate the native linux notification system
> https://github.com/apache/netbeans/pull/1948, I started to work in the
> notifications module to expose an API.
>
>
> My idea is to allow to extend the notifications system and integrate it
> with the native notifications system via a future module or a external
> plugin without break the current behavior.
>
>
> I created a Draft PR with the first draft of the notifications API to
> receive your feedback about that.
> https://github.com/apache/netbeans/pull/2142
>
>
> Regards
>


-- 
http://timboudreau.com