Re: [growl-discuss] Display plugin written in Objective-C - documentation?

28 views
Skip to first unread message

Chris Forsythe

unread,
Mar 31, 2013, 1:32:19 AM3/31/13
to growld...@googlegroups.com
We have a brand new bit of work in Growl 2 and the accompanying SDK that should be a good start. Look in the 2.0.1 SDK at the Plugin Development directory. Let us know if you have any questions.

I don't know how you would address this with a webkit display either.

-- 
Chris Forsythe

On Saturday, March 30, 2013 at 6:47 AM, Thomas Schlosser wrote:

On this page (http://growl.info/documentation/webkit.php) I found out that besides the CSS-based display styles there must be another one based on Objective.C.

I couldn't find any examples, how-tos or documemtation about this.
I have seen some examples integrating Growl via the API / framework into existing Cocoa applications, but I just want to have better control on the output.

Any places you could me point to?


FYI: What I want to do? 
Basically I want at least to have control about formatting (at least line breaks and spacing) in the text part of the notification.
Example from terminal: cal | growlnotifier -t Calendar
All the blanks are not displayed as HTML does not render them. But I can't just replace them with   because these are escaped and displayed as text.
Any hints on this are also very welcome!

Thanks
Thomas

--
You received this message because you are subscribed to the Google Groups "Growl Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to growldiscuss...@googlegroups.com.
To post to this group, send email to growld...@googlegroups.com.
Visit this group at http://groups.google.com/group/growldiscuss?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Thomas Schlosser

unread,
Mar 31, 2013, 7:00:15 AM3/31/13
to growld...@googlegroups.com
Hi Chris,
sorry, I don't want to crosspost too much - there is a conversation in Twitter (@GrowlMac) as well.

I downloaded SDK 2.0.1 and found the Plugin Dev folder. 
But after reading the readme's twice (not yet trying what happens in Xcode) I feel very uncomfortable with this. I don't understand the basic structure yet (basically I would expect some main method which the plugin has to implement to receive calls from Growl to display a notification; delegation pattern), what has to be produced in the Xcode product finally and how it is "linked" to Growl (installation).
I have never seen this template technique before (but maybe it shows up like the Apple preinstalled templates - which would be great).

For my special way to approach similar things it would be phantastic to have a minimal (!) Xcode project which ideally works out of the box. Maybe the preferences part isn't even needed for this (optional?).

And/or a walk through like for Webkit based style "plugin".

Thanks
Thomas

Chris Forsythe

unread,
Mar 31, 2013, 8:06:41 AM3/31/13
to growld...@googlegroups.com
Let's keep the conversation here. You should have plenty of examples by simply downloading the Growl source through mercurial. :)

--
Chris Forsythe

Daniel Siemer

unread,
Mar 31, 2013, 10:12:19 AM3/31/13
to Growl Discuss
So, when we rewrote the plugin system in 2.0, I created a project
template you can install to make a plugin xcode project. However,
said template never had its display side finished, only the action
side was. The display plugin should still create the utter basics,
however it will not create any of the classes needed except the
preference pane. Cocoa displays aren't terribly common from third
parties, so it just wasn't a priority (and Displays weren't as fully
rewritten and abstracted as they should have been, which makes
implementing them annoying still). As Chris said, you can look at the
main code base for plenty of examples.

Basics of our plugin system. Plugin bundles get installed to our
container in ~/Library/Containers/com.Growl.GrowlHelperApp/Library/
Application Support/Growl/Plugin, and simply double clicking the
bundle will have us install it in the right place. Growl supports two
different bundle types, growlstyle (CSS/HTML) and growlview (Cocoa/Obj-
C). In Growl 2.0, cocoa plugins need to link against our
GrowlPlugins.framework, which has all the base classes, and a lot of
different code you might need. You should *not* bundle this framework
with your plugin, Growl bundles this and links it, and we have a
Info.plist key that you need to use to declare the version of the
framework you linked against so we can disable your plugin if we break
something in a future version.

Display plugins main class doesn't have much in it, and inherits from
GrowlDisplayPlugin, there are a couple things it needs to do. First
is to set the windowControllerClass is the class where more of the
magic really happens. Next is to set the prefsDomain, and finally is
to optionally provide a preferencePane.

GrowlDisplayWindowController subclass is where you set up the window,
and again, this is where looking at the plugins in Growl itself is
probably a good idea, as a lot happens in the init method.
GrowlNotificationView subclass is where the big stuff really happens,
a bunch of layout related code is there.

On Mar 31, 7:06 am, Chris Forsythe <ch...@growl.info> wrote:
> Let's keep the conversation here. You should have plenty of examples by simply downloading the Growl source through mercurial. :)
>
> --
> Chris Forsythe
>
>
>
>
>
>
>
> On Sunday, March 31, 2013 at 6:00 AM, Thomas Schlosser wrote:
> > Hi Chris,
> > sorry, I don't want to crosspost too much - there is a conversation in Twitter (@GrowlMac) as well.
>
> > I downloaded SDK 2.0.1 and found the Plugin Dev folder.
> > But after reading the readme's twice (not yet trying what happens in Xcode) I feel very uncomfortable with this. I don't understand the basic structure yet (basically I would expect some main method which the plugin has to implement to receive calls from Growl to display a notification; delegation pattern), what has to be produced in the Xcode product finally and how it is "linked" to Growl (installation).
> > I have never seen this template technique before (but maybe it shows up like the Apple preinstalled templates - which would be great).
>
> > For my special way to approach similar things it would be phantastic to have a minimal (!) Xcode project which ideally works out of the box. Maybe the preferences part isn't even needed for this (optional?).
>
> > And/or a walk through like for Webkit based style "plugin".
>
> > Thanks
> > Thomas
>
> > On Sunday, March 31, 2013 7:32:19 AM UTC+2, Christopher Forsythe wrote:
> > > We have a brand new bit of work in Growl 2 and the accompanying SDK that should be a good start. Look in the 2.0.1 SDK at the Plugin Development directory. Let us know if you have any questions.
>
> > > I don't know how you would address this with a webkit display either.
>
> > > --
> > > Chris Forsythe
> > > @The_Tick (http://twitter.com/The_Tick)
>
> > > On Saturday, March 30, 2013 at 6:47 AM, Thomas Schlosser wrote:
>
> > > > On this page (http://growl.info/documentation/webkit.php) I found out that besides the CSS-based display styles there must be another one based on Objective.C.
>
> > > > I couldn't find any examples, how-tos or documemtation about this.
> > > > I have seen some examples integrating Growl via the API / framework into existing Cocoa applications, but I just want to have better control on the output.
>
> > > > Any places you could me point to?
>
> > > > FYI: What I want to do?
> > > > Basically I want at least to have control about formatting (at least line breaks and spacing) in the text part of the notification.
> > > > Example from terminal: cal | growlnotifier -t Calendar
> > > > All the blanks are not displayed as HTML does not render them. But I can't just replace them with &nbsp; because these are escaped and displayed as text.
> > > > Any hints on this are also very welcome!
>
> > > > Thanks
> > > > Thomas
>
> > > > --
> > > > You received this message because you are subscribed to the Google Groups "Growl Discuss" group.
> > > > To unsubscribe from this group and stop receiving emails from it, send an email to growldiscuss...@googlegroups.com.
> > > > To post to this group, send email to growld...@googlegroups.com.
> > > > Visit this group athttp://groups.google.com/group/growldiscuss?hl=en.
> > > > For more options, visithttps://groups.google.com/groups/opt_out.

Thomas Schlosser

unread,
Apr 1, 2013, 5:23:07 AM4/1/13
to growld...@googlegroups.com
Is Growl Open Source? I did not see a reference to a repository.
Does Growl itself use the same plugin technique for the display styles or could I just learn from it how the view is filled with content?

On style section (http://growl.info/styles) there are dozens of styles, but I could only find HTML/CSS based ones.

Currently it seems too much "research" for me without having a single working example project.
I just found one in Github, which seems to use the API to receive the Growl notifications but does copy them into NSUserNotificationCenter instead of displaying it. https://github.com/stigi/MountainGrowl
SO I think I can learn the plugin technique from this but not how to fill the frame for the Growl display.


2013/3/31 Chris Forsythe <ch...@growl.info>

--
You received this message because you are subscribed to a topic in the Google Groups "Growl Discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/growldiscuss/8MiYy1BdUUw/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to growldiscuss...@googlegroups.com.

Christopher Forsythe

unread,
Apr 1, 2013, 9:36:18 AM4/1/13
to growld...@googlegroups.com
Yes, Growl is open source. If you click on the Help link in our menu bar at the top, hit cmd+f and then type "source" you will find the link to how to pull source from our repo. I'm not sure how this is "too much research". Besides that, you have the project lead and one of the main developers replying to you on this thread, so if you have any questions we're happy to answer. But drop the defeatist attitude man. You have a task you want to complete, a goal in mind, get to it.

Like Daniel said, we really don't have a lot of people making actual visual displays in cocoa. Mostly because the webkit based displays cover about 95% of the use cases. You have an exception to that which, which is fine, but if you want to get it done you're going to have to do a little legwork on your own. This is how open source works outside of github. Let us know what questions you have, we're happy to help so long as we keep things positive here.

Chris
Chris Forsythe

Thomas Schlosser

unread,
Apr 2, 2013, 1:26:54 AM4/2/13
to growld...@googlegroups.com
Hi Daniel,
thanks for writing this introductionary documentation!

Do you see another way (based on HTML/CSS) to send text to the notification which preserves a layout?
At least the commandline tool seems to escape embedded HTML and blanks are not rendered.
As an example think of the output "cal" piped to growlnotify.

Where can I find the Growl source code?

Thanks
Thomas
Reply all
Reply to author
Forward
0 new messages