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.

LaMetric Firmware 1.7.5

A new firmware for the LaMetric Time is out – version 1.7.5 has some nice things to offer for those of us who would like to use the device in home automation (sadly the documentation is not yet updated). While this has been announced in the change log for 1.7.4, there have been some bugs and there are still one or two things that needs fixing, but that’s just minor stuff.

So, lets dive right in: You can control the LaMetric time nearly completely via the REST-API. You can

  • switch between apps (previous or next, just like hitting the buttons on the device)
  • switch directly to a specific app
  • control the radio (on, off, switch channel – but not add or edit channels)
  • set alarms and enable or disable them
  • start/stop/reset the stopwatch
  • start/stop/reset/set the countdown

This is all on top off the already existing features (accessing device information about WiFi, Bluetooth, volume, display etc.)

This means nearly everything that had to be done using the iOS/Android app before, can now be done using any programming language you want.

I explained in my previous articles how to sent notifications – and it’s basically the same with the new controls. I’ve used PHP in the articles, because it’s what most people in the forum requested, but personally I use Python.

Until now I had written some scripts, without a specific library,  just a bunch of requests in a file which did the things I wanted. But when I discovered the new features I chose to clean my code and maybe make a Python package out of it –  at least a simple class for interacting with the device.

As any programmer should do, I did a search on GitHub to see if there are already some libraries. And of course I found one – lmnotify was relatively up to date and so I forked it and added some new code. Today I sent my pull request and it was already merged. This package is also available via PIP and it  supports all the features that I mentioned above.

Feel free to use this package, sent bugs, feature requests, pull requests.

 

Next I’ll be working on adding support for the LaMetric Time to Home Assistant – a platform for home automation that I’ve been using for a while and I think I already saw something LaMetric related, but without the features from the new firmware it’s useless for me.