hammerspoon icon indicating copy to clipboard operation
hammerspoon copied to clipboard

hs.menubar, is it possible to add .find()?

Open agzam opened this issue 2 years ago • 3 comments

I'm surprised that hs.menubar doesn't have a method for finding and referring to existing items. There seems to be no way of getting back to a newly created menubar item without storing the reference to the object.

agzam avatar Jun 20 '22 01:06 agzam

As in, you basically want a getMenu, in addition to setMenu?

I feel like this might be an older module, where newer modules wouldn't have specific "get" and "set" methods, and rather just have a single menu() method which can both get and set.

latenitefilms avatar Jun 20 '22 01:06 latenitefilms

nevermind, I just realized - there's http://www.hammerspoon.org/docs/hs.application.html#findMenuItem

Apologies for the noise.

agzam avatar Jun 20 '22 01:06 agzam

Ah, no. I was wrong. findMenuItem still doesn't return the menuBarItem object. There's still no way of e.g., deleting an existing menu item.

agzam avatar Jun 20 '22 15:06 agzam