Re: Inserting a button into another application's toolbar
Re: Inserting a button into another application's toolbar
- Subject: Re: Inserting a button into another application's toolbar
- From: Jack Brindle <email@hidden>
- Date: Mon, 18 Sep 2017 22:01:53 -0700
Actually, there may be a way. It all depends on exactly where in the menu bar
you want to place the menu item.
If you want to add it on the right side as a status item, then you need to
check out NSStatusBar. This would
allow you to add a separate application (more likely a user Agent which can be
launched when the user logs in).
You can place normal menu items in the NSStatusBar menu which refer to things
in your app. It, of course,
would communicate with the target app using Apple Events. I would add an extra
touch to determine when
the target app is active and have the status bar item (along with its UI)
enabled then, disabling it when the
target app is not active (either launched or frontmost).
Note that running your app as a user agent also means there is no main menu or
dock icon, which is probably
a good thing. You will also want to treat the windows and controls carefully so
that they can accept clicks
but do not take over as the frontmost application, instead leaving the target
app as the frontmost application.
This may not be exactly what you want - like others I don’t know of any
legitimate way to add an item to
the left side of an apps menu bar, but it certainly is doable, and is even
within the security guidelines, as
long as using AppleEvents works with the target app.
- Jack
> On Sep 18, 2017, at 4:15 PM, Jens Alfke <email@hidden> wrote:
>
>
>
>> On Sep 18, 2017, at 2:35 PM, Nick <email@hidden> wrote:
>>
>> adding/injecting a toolbar icon
>> with a custom handler code into the main window of the application.
>
> Sorry, there's no reasonable way to do that if the app doesn't already
> support plugins. There used to be some awful hacks that patched into the
> app-launching mechanism and made it possible to inject code into other apps,
> but that approach causes stability problems and is in general terrible for
> security.
>
> —Jens
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden