Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Ability to add Custom Items to Dock Icon Contextual Menu #1350

Open
latenitefilms opened this issue Apr 21, 2017 · 7 comments
Open

Add Ability to add Custom Items to Dock Icon Contextual Menu #1350

latenitefilms opened this issue Apr 21, 2017 · 7 comments

Comments

@latenitefilms
Copy link
Contributor

Apps can have custom menu items when you right click on them on the dock. For example, attached is what happens when you right click on the Mail dock icon.

It would be great if this could be controlled via an API in Hammerspoon. Maybe as part of hs.dockicon?

screen shot 2017-04-22 at 1 36 00 am

@latenitefilms
Copy link
Contributor Author

@latenitefilms
Copy link
Contributor Author

@cmsj & @asmagill - You could probably just add a function that allows you to "attach" a hs.menubar (or multiple menus?) to the Dock Icon (in a similar way to how you attach toolbars to webviews).

@cmsj
Copy link
Member

cmsj commented Apr 25, 2017

Looking at the docs, it's not so much about attaching the menu object to the dock, more that our AppDelegate will get a callback when a dock menu object is needed.

It seems like we can re-use hs.menubar objects, we'll just need some hs.menubar API to register one of them with MJAppDelegate so it can return the menu to the Dock as needed. Then there's figuring out how the messages get back to us, and down into the Lua callbacks, when someone clicks on a menu item.

@latenitefilms
Copy link
Contributor Author

Sweet! Sounds good! If you have the time to give it a bash, that would be amazing. Otherwise, I'm happy to give it a shot sometime over the next few weeks, and you can review (although I'll definitely need some help on the old IRC at some point I'd imagine!). Thank you!

@latenitefilms
Copy link
Contributor Author

@asmagill - If you do ever go back to hs.menubar, this issue would be awesome to keep in mind too.

@latenitefilms
Copy link
Contributor Author

I'd still love to tackle this at some point too...

@asmagill
Copy link
Member

I know I've been MIA for a bit, but hopefully over the next couple of weeks, I'll have time to actually contribute again and work on the spoons like I proposed 😬

I've revisited my gui toolkit recently, for which the menubar stuff was totally redone from scratch. With the new module, its very easy to create menus to attach to other things, like controls (combo buttons, tabs, etc.) so I don't think this should be too hard. I need to flesh out the documentation and then can give this a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants