Skip to content

crankd doesn't handle nsdistributednotifications, now it does #2

@acdha

Description

@acdha

From @GoogleCodeExporter on May 20, 2015 16:39

I have GeekTool installed(v3 is applescriptable. In particular, you can
tell it to refresh certain geeklets, allowing one to update a geeklet on an
event supported by crankd) and I wanted a way to avoid polling for iTunes
track information because that drained my macbook's battery pretty quickly
so I took a look at crankd.  I quickly realized that it didn't support
NSDistributedNotifications so I wrote in support for that particular
notification type.
When the initial patch was finished, I discovered that there might be a
quirk(maybe this "quirk" is by design, I don't know) with the way the
NSDistributedNotificationCenter handles an application launch/quit.  I
found that if you're subscribed to an event and the application emitting
that event quits and subsequently relaunches, the handler will never be
called again.
I wrote another patch to fix this problem.  It adds a config option for
NSDistrbutedNotifications, process, that tells crankd to subscribe to
ApplicationDidLaunch events with a special handler, do_reload.  When an
application is launched, the do_reload handler is called and checks the
process name against the config option.  If they match, the
DistNotification is reloaded and hence the handler is valid once again. 
This handler won't replace any existing appdidlaunch events.

The patched version of crankd is attached to this issue with changes marked
by the comment "# distnot patch: change" (where change is what was added).
 FYI: All spaces were converted to tabs.

btw, I wanted to take this opportunity to thank you for crankd, it's been
working amazingly well for me :D.

Original issue reported on code.google.com by [email protected] on 10 Dec 2009 at 9:34

Attachments:

Copied from original issue: #2

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions