Apple - A way to run console commands in menu bar?
You can enable the Script menu from the built-in Script Editor.app: Preferences → General → Show Script menu in menu bar.
Then you can place any AppleScript in this menu by putting the script in your Scripts folder.
To add user-level scripts to the script menu, save them into the ~/Library/Scripts/ folder of your user directory. For quick access to this folder, select Open Scripts Folder > Open User Scripts Folder from the script menu. When you do this, the folder is automatically created if it doesn’t already exist.
https://developer.apple.com/library/archive/documentation/LanguagesUtilities/Conceptual/MacAutomationScriptingGuide/UsetheSystem-WideScriptMenu.html