tilmanginzel / alfred-bluetooth-workflow

Yet another Alfred workflow to connect / disconnect Bluetooth devices
MIT License
189 stars 8 forks source link

Breaks on macOS 12.3 #32

Closed datenreisender closed 2 years ago

datenreisender commented 2 years ago

macOS 12.3 removed Python 2 which breaks the script filter. So, on a normal macOS 12.3 no Bluetooth devices show up in this workflow anymore. :-( And since homebrew also removed support for Python 2 two years ago it is not so simple to install Python 2 any longer.

There are descriptions how to still install Python 2 but of course Python 2 was sunsetted already two years ago, so it is a bit risky to continue to use it.

tilmanginzel commented 2 years ago

Hi @datenreisender, thanks for opening the issue. I have been following the discussions on deanishe/alfred-workflow for a while now, and so far have not been happy with any of the solutions:

  1. Force users to install python2 (as you mentioned, not really recommended anymore). The workflow would lose its "just works" charm, as it also includes other dependencies like blueutil and terminal-notifier. This makes it easier for non-developers to use the workflow.
  2. Upgrade to a fork of deanishe/alfred-workflow with python3 support. There are now multiple forks floating around. Using one, I would have to review the complete changeset, and it would take quite some time.

Some other options I have considered:

  1. Get rid of deanishe/alfred-workflow altogether. It is only used for the automatic update, maybe this feature is not worth all the hassle, as there are rarely updates necessary. Migrating the custom code to python3 should be no big deal I suppose.
  2. Use something else than python which is more "stable". We again would lose the update feature though (maybe there are other libraries, similiar like deanishe/alfred-workflow, which have this feature. I have not researched this yet). Of course, also a bit more work.

I am currently leaning towards solution 2, as the workflow will just continue to work for all users after an update. Maybe I will find some time today to at least look into it, to get a better feel for the work to be done.

datenreisender commented 2 years ago

If alfred-workflow is used only for a small part (automatic update) is it possible to have it degrade gracefully?

Like, if there is only python3 then still have the code running that returns the list of devices and if there is python2 then additionally also run the code for automatic updates? Or would implementing that be too hard?

tilmanginzel commented 2 years ago

Hm, good idea, that should work I suppose. 👍

All the custom python code is in alfred_bluetooth_workflow.py. I could copy most of it to a python3 script, without the alfred-workflow dependency. The surrounding script filter should be able to decide if the python2 or python3 script must be invoked.

If the migration to a new alfred-workflow fork is too much work, this could be a good temporary solution.

tilmanginzel commented 2 years ago

Turns out, the migration is rather straightforward. :) Should be able to publish a macOS 12.3 / python3 compatible version today.

tilmanginzel commented 2 years ago

@datenreisender I have just published version 0.12.0 which is now Python 3 compatible (Python 2 support has been dropped). I tested the workflow on MacOS 12.3 and MacOS 12.2.1, without issues.

Can you please test if it works again as expected? You can force the update via blt workflow:update.

datenreisender commented 2 years ago

I wasn't able to use blt workflow:update because Alfred did not offer me any bluetooth actions for that string (because the script filter for blt failed. But I was able to install the new version manually and now it works again for me (probably because I have also Python 3 installed). Thanks for the quick help!

tilmanginzel commented 2 years ago

Glad to hear that it works! 👍 Yes, python3 is a prerequisite now. According to some comments I saw, Apple should prompt the user automatically to install it via Developer Tools, if it is not yet installed. Couldn't test this though.