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

[Question about hs.menubar] How can I get all of the items in menubar ? #3100

Closed
fakeyanss opened this issue Jan 29, 2022 · 9 comments
Closed

Comments

@fakeyanss
Copy link

fakeyanss commented Jan 29, 2022

I want to write a script about menuber icon hider, something like Mortennn/Dozer or dwarvesf/hidden .

And I have read hammerspoon API documents Hammerspoon docs: hs.menubar . I found it is about to create new items in menubar, not to manage the existed items. Please tell me, how can I do it if I want hide items using hammerspoon.

I think it is able to use hs.menubar:removeFromMenuBar() to hide it if I get the lua object of menubar items before.

@fakeyanss
Copy link
Author

anyone helps?

@MuhammedZakir
Copy link
Contributor

[Question about hs.menubar] How can I get all of the items in menubar ?

I don't think it is possible with this app. I don't know if it will work, but you can give AppleScript a try.

I want to write a script about menuber icon hider, something like Mortennn/Dozer or dwarvesf/hidden .

See Mortennn/Dozer#69 (comment). To edti plist, use hs.plist[1] or defaults cli app.

[1] http://www.hammerspoon.org/docs/hs.plist.html

@cmsj
Copy link
Member

cmsj commented Feb 24, 2022

@MuhammedZakir is right, it's not possible with Hammerspoon to interact with menubar items from other apps. It would be an interesting feature to have, but it's not something I plan on working on (honestly, because I use Bartender and I don't think I could do anywhere near as good of a job as they do, especially with the amount of work it seems to require every year to stay compatible with newer macOS releases).

I'm going to close this issue, because I don't believe there is any work to be done on Hammerspoon, but please feel free to keep the discussion going if you want to :)

@cmsj cmsj closed this as completed Feb 24, 2022
@fakeyanss
Copy link
Author

Since I configuration Harmerspoon, I uninstall many application which I used before. Such as Alfred, dictionary and translater, and so on. So I try to do the same thiing with menubar items hider.
I really want to replace Bartender or Dozer with Harmerspoon ❤️

@cmsj
Copy link
Member

cmsj commented Mar 9, 2022

@fakeyanss understandable, a big part of why Hammerspoon exists is to replace lots of tiny little utilities for me, but unfortunately I think the menubar item interaction is a bit too big of a job for us to tackle in a good way. Sorry!

@muescha
Copy link
Contributor

muescha commented Mar 17, 2024

I am also looking for an api to query the existing menu icons.

Since I have some icons and the most are overlay with the menu of an app it is complicated to find an app icon in the menu bar. Also some apps only open the GUI when I click on the menu item, but when I open the app via Raycast, there is no GUI shown.

I like to have a API to list of apps running and having an menu bar icon. I like to search in Raycast for the icons, and when I selected, then it should hit the menu bar icon so that the GUI opens.

Example Apps with this behaviour:

  • Docker
  • Mountain Duck
  • Elgato Wave Link
  • Hammerspoon
    and more...

I have the workaround with the app "AccessMenuBarApps" but it is still complicated, because sometimes it hides the menu bar on the macbook screen (problem: no icons displayed left from the notch) or on the external screen (good, because icons are visible here). Sometimes the AccessMenuBarApps app is crashing.

I just want a search for the app and then simulate a click on the icon. when it clicked I can still use the keys to select an menu item from it.

@muescha
Copy link
Contributor

muescha commented Mar 17, 2024

Similar issues:

@muescha
Copy link
Contributor

muescha commented Mar 17, 2024

It would also ok to cycle through all running apps and check each hs.Application for an getMenuBar to return the hs.menubar object.

Where I can do more things, like check if it is visible with isInMenuBar or use the frame to simulate a mouseclick on the icon. Tthe best would be an hs.menubar:click to do a click on the icon

@muescha
Copy link
Contributor

muescha commented Mar 17, 2024

can we reopen this issue because it is not completed now :/

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

No branches or pull requests

4 participants