Xbar and SwiftBar plugin¶
The Meta Package Manager project is actively maintaining a plugin that is both compatible with Xbar and SwiftBar.
The plugin is written in Python and is a small wrapper around the mpm
CLI.
Hint
I recommend SwiftBar, because Xbar has 2 outstanding issues:
Configuration¶
The plugin is configurable with these environment variables:
Variable name |
Description |
Type |
Defaults |
SwiftBar support |
Xbar support |
---|---|---|---|---|---|
|
Group packages into a sub-menu for each manager. |
Boolean |
|
✅ |
✅ |
|
Aligns package names and versions in a table for easier visual parsing. |
Boolean |
|
✅ |
✅ |
|
Default font to use for non-monospaced text. |
String |
Empty |
✅ |
|
|
Default configuration for monospace fonts, including errors. Is used for table rendering. |
String |
|
✅ |
Screenshots¶
SwiftBar¶
VAR_SUBMENU_LAYOUT = False
VAR_TABLE_RENDERING = False
VAR_SUBMENU_LAYOUT = False
VAR_TABLE_RENDERING = True
(default)VAR_SUBMENU_LAYOUT = True
VAR_TABLE_RENDERING = True
VAR_SUBMENU_LAYOUT = True
VAR_TABLE_RENDERING = False
Xbar¶
VAR_SUBMENU_LAYOUT = False
VAR_TABLE_RENDERING = False
VAR_SUBMENU_LAYOUT = False
VAR_TABLE_RENDERING = True
(default)VAR_SUBMENU_LAYOUT = True
VAR_TABLE_RENDERING = True
VAR_SUBMENU_LAYOUT = True
VAR_TABLE_RENDERING = False
Location¶
A copy of the latest stable version of the plugin is available on Xbar website and plugin repository.
Once mpm
is installed on your system, it can dynamiccaly be located with the dedicated --xbar-plugin-path
option:
$ mpm --bar-plugin-path
~/Library/Python/3.10/lib/python/site-packages/meta_package_manager/bar_plugin.py
This option is handy for deployment and initial configuration of Xbar/SwiftBar. I personally use this in my dotfiles to symlink the plugin to its latest version:
$ ln -sf "$(mpm --bar-plugin-path)" "${HOME}/Library/Application Support/xbar/plugins/mpm.7h.py"
Python >=3.8
required¶
Xbar plugins are self-contained scripts. As such, it needs to be able to run without any extra dependency, on the pre-installed Python distribution that ships with macOS.
With Python 3.7 being EOL and not receiving any security updates as of 2023-06-27, the plugin requires Python 3.8 or newer.
For reference:
Xbar itself requires macOS Catalina or newer (>= 10.15)
Python 2.x is deprecated since macOS Catalina (10.15) and has been removed in macOS Monterey 12.3
It looks like since Monterey (macOS), there is no default Python version installed anymore, and the
python
CLI is a stub that points to the App Store to install Xcode:$ python3 --version xcode-select: note: no developer tools were found at '/Applications/Xcode.app', requesting install. Choose an option in the dialog to download the command line developer tools.
Development workflow¶
Active development of the plugin is happening here, as a side-project of mpm itself.
Releases of the plugin is synchronized with the package. Both share the exact same version to simplify management. This explain why the plugin could appears jumping ahead a couple of major/minor versions while providing tiny or no changes at all.
A release is ready when both the package and the plugin reach a stable state.
If the plugin has been changed between releases, a
copy of the plugin is pushed
under the name meta_package_manager.7h.py
, to the
official Xbar plugin repository.
Release process¶
Fork the official Xbar plugin repository.
Fetch a local copy of the fork:
$ git clone https://github.com/kdeldycke/xbar-plugins $ cd xbar-plugins
Create a new branch and switch to it:
$ git branch "meta-package-manager-v4.13.1" $ git checkout "meta-package-manager-v4.13.1"
Replace existing copy of the plugin with the latest tagged version:
$ wget https://raw.githubusercontent.com/kdeldycke/meta-package-manager/v4.13.1/meta_package_manager/bar_plugin.py $ mv ./bar_plugin.py ./Dev/meta_package_manager.7h.py $ chmod 755 ./Dev/meta_package_manager.7h.py
Commit the new plugin:
$ git add ./Dev/meta_package_manager.7h.py $ git commit -m "Upgrade to Meta Package Manager plugin v4.13.1"
Push new branch:
$ git push --set-upstream origin "meta-package-manager-v4.13.1"
Create a pull-request in the original repository.