DEV Community

Cover image for Displaying current VTEX account and workspace on Mac's Menu Bar with link to Store
Lucis
Lucis

Posted on

Displaying current VTEX account and workspace on Mac's Menu Bar with link to Store

Audience

  • Mac users who develop on VTEX IO

Prerequisites

  • Permission to install programs on your Mac
  • vtex official CLI installed
  • Basic command-line knowledge

When developing for VTEX IO, working across different accounts and workspaces can become confusing. Before committing actions like vtex install and vtex link, I'm always interested in checking if I'm logged in the right account and workspace.

If you use ZSH + Powerlevel, I've also created a simple customization to show such info on the shell

To help you (and myself) with that, I'm gonna show how to display that information on Mac's Menu Bar, so it'll be visible for you all the time!

The Menu Bar is the fixed top bar on your computer, which shows icons, menus and other information.

Let's go! For this to work you need to:

  1. Install BitBar.
  2. Select a folder of your preference to be the plugins' folder (you're prompted when installing).
  3. Create the file vtex.10s.sh on the folder you've selected on the last step.
  4. Paste and save the following content to vtex.10s.sh file:
  5. Inside the plugins folder on the terminal, run chmod +x vtex.10s.sh
  6. Click on BitBar menu item on the Top Bar and click "Refresh"

That's it! It should work just fine ✨

VTEX account and workspace on Mac Top Bar

If you want to display it colored like I've done, try this instead. I've removed it on the default snippet because some shells don't support it!

Extra: If you click on it, it opens that workspace's store on myvtex.com!

Note that you can do a lot more with BitBar. If you're interested in finding out how to create custom plugins, go to BitBar Github Page. On it's home page, there's already a ton of free plugins!

Some considerations

  • The script reruns every 10 seconds, so it'll update after vtex switch. If you want to configure this time, click here.
  • I've edited the Shebang to #!/bin/bash because most people use bash. If you use another shell (like zsh), update it accordingly.
  • I've added some color using ANSI codes. Click here to see other options.

Top comments (1)

Collapse
 
klzns profile image
Breno Calazans

Love this, I use it everyday! It's really handy.