Hammerspoon / Spoons

The official repository of Spoon plugins
https://www.hammerspoon.org/Spoons/
448 stars 141 forks source link

EjectMenu: use of modifier keys is undocumented and broken if menu not open #279

Open von opened 2 years ago

von commented 2 years ago

EjectMenu's handling of modifiers keys is undocumented and distracting if the menu isn't open:

  1. If a menu item is selected while a modifier key is pressed, then instead of ejecting the volume, the volume is opened in the Finder (see execMenuItem(). This behavior is undocumented as far as I can tell.
  2. The menu icon responds to Command being pressed by changing its icon (see changeEjectMenuIcon()). However this happens even if the menu is not already open, which is distracting (especially since clicking on menu items with the Command key pressed does nothing).
von commented 2 years ago

Exploring the hs.menubar documentation I'm not finding any apparent way to only change the menubar icon when a modifier key is pressed if menu is being displayed. I could see starting a watcher when the menu is created and stopping that watcher when a menu item is selected, but I don't see any way of stopping the watcher if the menu is closed without an item being selected.

So I suspect that explains why the Spoon behaviors as it does with regarding to changing the icon all the time.