Use Hammerspoon [0][1], it comes with a lot of macOS integrations out of the box and you write Lua, which takes zero effort to pick up and use. For me a big benefit is that you don't need to touch Xcode at all.
[0] https://www.hammerspoon.org
[1] https://www.hammerspoon.org/docs/hs.menubar.html