QuickFolders – a BitBar plugin

I’m a big fan of BitBar, an application that allows you to “Put anything in your Mac OS X menu bar” (macOS nowadays). People have already created more than 250 plugins which allow you to show plenty of information in the menubar. Basically any script that can be executed on the terminal and has some kind of output can be used to display this output.

This is how my BitBar output looks at the moment:

It shows me (from left to right):

  • GitHub notifications
  • Bitcoin price at bitcoin.de
  • QuickFolders – the plugin this blog post is about
  • Online status of two remote servers I manage (plugin not published)
  • Battery status of Macbook, keyboard and trackpad

You can click on every item and depending on the plugin get to see more information.

QuickFolders is a plugin that might help if you often need files that are sorted in a certain kind of folder structure.

You specify a directory and using various kinds of bash commands the script outputs all subfolders below this directory that have files inside (empty subdirectories are omitted). You can also specify which kind of suffix you want to be considered (e.g. only pdf) and which files you want to ignore (e.g. everything starting with a dot). The plugin then only shows directories that match these criteria.

You could use it the following way (just an fictitious example):

Have a folder for each semester and inside this folder another one for every course you’re going to visit. Put all the course materials into the corresponding folders and add the path to the script

The actual folder structure looks like this:

The “Homework” folder doesn’t show up, because it contains only DOC files and I changed the plugin to only show folders with PDF files.

If you click on any of those subdirectories in the BitBar menu it will open the corresponding folder in the finder.

For now the plugin is available in the “quickfolders” branch (inside the “System” folder) of my fork of the bitbar-plugins repository. I’ve created a pull request, so hopefully it will be in the official bitbar repository soon.

Show Download and Upload speed on your LaMetric Time

Following a request at the LaMetric forum I wrote a small Python script for displaying your current download and upload speed  on a LaMetric Time. The script can run on your own laptop or server (preferred).

Basically you need to do two things:

  • Create an app for the LaMetric Time
  • run the script that performs the speed test and push the results to the device

1. Create an indicator app

This is quite an easy thing to do. You need an account for the LaMetric developer area (it’s free, so don’t worry). In the developer area you can create a new app – in this case select indicator application.

On the new page, you can create the layout of the app. You need two text frames, one for the download speed and one for the upload speed. Also choose an icon for each frame, I decided to use a green down and green up arrow. It’s important that you select “Push” so that you can send your information to the LaMetric Time.

My design looks like this, but I later decided to drop the “Mbit/s”. It made the text too long, which is ok, the text will scroll on the display, but it means you have to wait for the scrolling to end, before the next frame is displayed. Plus I know that it’s Mbit/s. I’m also thinking about dropping the “UL” and “DL” prefix, since the arrows give me enough information.

Next you need to enter some information about the app, that is displayed in the store. You nee an App name and a short description, also make sure to check the “Private app” field.

Click “Save” and the app is ready to be published. On the next page you will see the URLs and the access token that is needed to send data to the app. Copy the “Local Push URL” and “Access token”. You could also use the “Push URL” instead of the local one, but I prefer it that way. I find it unnecessary  to send the data from my server at home to the LaMetric servers from where it comes back to my LaMetric Time which stands 5m away from my server.

Hit “Publish” and after a few minutes you should get a mail telling you that your app is ready.

Now you can install the app on your LaMetric Time. The following four screenshots describe how to do this:

Now your LaMetric Time is ready to receive data.

2. Run the script periodically on your server to update the values

The script can be found on GitHub: lm_connection_speed – if you don’t know how to clone a repository, you can also directly download the files: Download

I recommend Python 3, but it should work (no guarantee) with Python 2. It has three dependencies (requests, json and speedtest-cli). Please make sure install those before running the script.

Open the connection_speed.py in an text editor and look for lines 21/22 and insert the access token and push url from above. Save the file and you are good to go.

If you remember I said that I don’t want to see the “Mbit/s” – if you want to see it, you need to change two more lines in the file:

dl_rate = "DL {:.2f}".format(DL / 1000 / 1000)
dl_icon = "i402"
ul_rate = "UL {:.2f}".format(UL / 1000 / 1000)
ul_icon = "i120"

needs to be:

dl_rate = "DL {:.2f} Mbit/s".format(DL / 1000 / 1000)
dl_icon = "i402"
ul_rate = "UL {:.2f} Mbit/s".format(UL / 1000 / 1000)
ul_icon = "i120"

Now you can run the script

python3 connection_speed.py

Have a look the remarks in the README and for running the script periodically please consult your preferred search engine.