I am trying to get the keyboard to focus the right menu bar (Bartender 3 has this exact same feature). In System Preference, Shortcut, Keyboard there is a shortcut but it works only for the left menu.

I've tried some AppleScript but I am total noob.

tell application "System Events" to tell process "SystemUIServer"
    tell (activate menu bar 2)
    end tell
end tell

this is with a shortcut from bartender 3. Basically get the focus on the first menu (on the menu bar on the top right) so I can move with the keyboard.

bartender 3 shortcut example1]

It could work if I click the menu with the mouse (so scripting applescript to click) but I believe that I need to know the position of the last menu or the name. Since those menu dont really have an order they might change (they are created with Hammerspoon so I might delete them, change them etc.)

Sure I could just click the menu that is always there and move from there but I would like to know how to recreate Bartender 3 shortcut.

  • The activate command only acts on applications, not processes and you cannot activate a menu by saying activate menu bar 2. – user3439894 Jan 2 at 2:37
  • apple.stackexchange.com/questions/249606/… you can use this to click on an empty area or double click on an icon, either way you get focus. – ankii Jan 2 at 8:09
  • Focus where in the right menu bar ? You're targeting SystemUIServer, which is largely associated with menu bar 1, and not menu bar 2, even though its on the right-hand-side. menu bar 2 is where icons belonging to user-installed applications exist, such as Dropbox, or Bartender 3's icon, even though they appear to share the same physical space as the system icons from menu bar 1. – CJK Jan 6 at 7:10
  • I've added some other info in the post. but yes the applescript I tried is just what I could gather by looking around the web. I thought that menu bar 2 is the menu on the right and I've seen other using theSystemUIServer to click so I gave it a try. – Virgil Sisoe Jan 14 at 17:41

You must log in to answer this question.

Browse other questions tagged .