Skip to content

Commit

Permalink
fix for macOS Monterey
Browse files Browse the repository at this point in the history
close #17
  • Loading branch information
bmunoz89 committed May 22, 2022
1 parent 635ba1e commit 2ad90d3
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 24 deletions.
30 changes: 28 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,32 @@ And then run this command on a terminal:
brew install blueutil
```

Now [download][last release link] ⏬ the last release and open it 😎. That's all!!
## Python 2 and macOS Monterrey

https://www.alfredapp.com/help/kb/python-2-monterey/

This is the recommended solution by Alfred and the solution implemented from release 3.0.0 and above, therefore I don't recommend to upgrade your workflow if you don't have macOS Monterrey.

```bash
export PATH="/opt/homebrew/bin:/usr/local/bin:${PATH}"
eval "$(brew shellenv)"
brew install pyenv
pyenv install 2.7.18
ln -s "${HOME}/.pyenv/versions/2.7.18/bin/python2.7" "${HOMEBREW_PREFIX}/bin/python"
```

Which should lead to have linked the python bin to this path `/usr/local/bin/python`.
To check if all the previous commands were successful, run this command:

```bash
/usr/local/bin/python --version
# Which should print this "Python 2.7.18"
```

## Download the release according to your OS version

macOS Monterey: [download][monterey last release link]
previous macOS: [download][last release link]

# 📸 Screenshots

Expand Down Expand Up @@ -80,4 +105,5 @@ Copy both results and follow the steps in the next point.

Easy peasy! 😋

[last release link]: https://github.com/bmunoz89/alfred-wf-bluetooth-manager/releases/latest/download/Bluetooth.manager.alfredworkflow
[monterey last release link]: https://github.com/bmunoz89/alfred-wf-bluetooth-manager/releases/latest/download/Bluetooth.manager.alfredworkflow
[last release link]: https://github.com/bmunoz89/alfred-wf-bluetooth-manager/releases/download/2.4.1/Bluetooth.manager.alfredworkflow
2 changes: 1 addition & 1 deletion bluetooth.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/local/bin/python
# -*- coding: utf-8 -*-
import json
import os
Expand Down
22 changes: 11 additions & 11 deletions info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@
<key>escaping</key>
<integer>102</integer>
<key>script</key>
<string>/usr/bin/python bluetooth.py connect</string>
<string>/usr/local/bin/python bluetooth.py connect</string>
<key>scriptargtype</key>
<integer>1</integer>
<key>scriptfile</key>
Expand Down Expand Up @@ -347,7 +347,7 @@
<key>runningsubtext</key>
<string>Loading devices</string>
<key>script</key>
<string>/usr/bin/python bluetooth.py list_devices</string>
<string>/usr/local/bin/python bluetooth.py list_devices</string>
<key>scriptargtype</key>
<integer>1</integer>
<key>scriptfile</key>
Expand Down Expand Up @@ -376,7 +376,7 @@
<key>escaping</key>
<integer>102</integer>
<key>script</key>
<string>/usr/bin/python bluetooth.py notification "Set a device first"</string>
<string>/usr/local/bin/python bluetooth.py notification "Set a device first"</string>
<key>scriptargtype</key>
<integer>1</integer>
<key>scriptfile</key>
Expand All @@ -399,7 +399,7 @@
<key>escaping</key>
<integer>102</integer>
<key>script</key>
<string>/usr/bin/python bluetooth.py set_device "{query}"</string>
<string>/usr/local/bin/python bluetooth.py set_device "{query}"</string>
<key>scriptargtype</key>
<integer>0</integer>
<key>scriptfile</key>
Expand Down Expand Up @@ -483,7 +483,7 @@
<key>escaping</key>
<integer>102</integer>
<key>script</key>
<string>/usr/bin/python bluetooth.py disconnect</string>
<string>/usr/local/bin/python bluetooth.py disconnect</string>
<key>scriptargtype</key>
<integer>1</integer>
<key>scriptfile</key>
Expand Down Expand Up @@ -547,7 +547,7 @@
<key>runningsubtext</key>
<string>Loading devices</string>
<key>script</key>
<string>/usr/bin/python bluetooth.py list_devices</string>
<string>/usr/local/bin/python bluetooth.py list_devices</string>
<key>scriptargtype</key>
<integer>1</integer>
<key>scriptfile</key>
Expand Down Expand Up @@ -576,7 +576,7 @@
<key>escaping</key>
<integer>102</integer>
<key>script</key>
<string>/usr/bin/python bluetooth.py connect "{query}"</string>
<string>/usr/local/bin/python bluetooth.py connect "{query}"</string>
<key>scriptargtype</key>
<integer>0</integer>
<key>scriptfile</key>
Expand Down Expand Up @@ -650,7 +650,7 @@
<key>runningsubtext</key>
<string>Loading devices</string>
<key>script</key>
<string>/usr/bin/python bluetooth.py list_devices</string>
<string>/usr/local/bin/python bluetooth.py list_devices</string>
<key>scriptargtype</key>
<integer>1</integer>
<key>scriptfile</key>
Expand Down Expand Up @@ -710,7 +710,7 @@
<key>escaping</key>
<integer>102</integer>
<key>script</key>
<string>/usr/bin/python bluetooth.py disconnect "{query}"</string>
<string>/usr/local/bin/python bluetooth.py disconnect "{query}"</string>
<key>scriptargtype</key>
<integer>0</integer>
<key>scriptfile</key>
Expand All @@ -733,7 +733,7 @@
<key>escaping</key>
<integer>102</integer>
<key>script</key>
<string>/usr/bin/python bluetooth.py manager "{query}"</string>
<string>/usr/local/bin/python bluetooth.py manager "{query}"</string>
<key>scriptargtype</key>
<integer>0</integer>
<key>scriptfile</key>
Expand Down Expand Up @@ -776,7 +776,7 @@
<key>runningsubtext</key>
<string>Checking bluetooth status</string>
<key>script</key>
<string>/usr/bin/python bluetooth.py manager</string>
<string>/usr/local/bin/python bluetooth.py manager</string>
<key>scriptargtype</key>
<integer>1</integer>
<key>scriptfile</key>
Expand Down
2 changes: 1 addition & 1 deletion workflow/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/local/bin/python
# encoding: utf-8
#
# Copyright (c) 2014 Dean Jackson <deanishe@deanishe.net>
Expand Down
4 changes: 2 additions & 2 deletions workflow/background.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/local/bin/python
# encoding: utf-8
#
# Copyright (c) 2014 deanishe@deanishe.net
Expand Down Expand Up @@ -230,7 +230,7 @@ def run_in_background(name, args, **kwargs):
_log().debug('[%s] command cached: %s', name, argcache)

# Call this script
cmd = ['/usr/bin/python', __file__, name]
cmd = ['/usr/local/bin/python', __file__, name]
_log().debug('[%s] passing job to background runner: %r', name, cmd)
retcode = subprocess.call(cmd)

Expand Down
2 changes: 1 addition & 1 deletion workflow/notify.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/local/bin/python
# encoding: utf-8
#
# Copyright (c) 2015 deanishe@deanishe.net
Expand Down
4 changes: 2 additions & 2 deletions workflow/update.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/local/bin/python
# encoding: utf-8
#
# Copyright (c) 2014 Fabio Niephaus <fabio.niephaus@gmail.com>,
Expand Down Expand Up @@ -263,7 +263,7 @@ def _parse(self, vstr):
# Build info
idx = suffix.find('+')
if idx > -1:
self.build = suffix[idx+1:]
self.build = suffix[idx + 1:]
suffix = suffix[:idx]
if suffix:
if not suffix.startswith('-'):
Expand Down
2 changes: 1 addition & 1 deletion workflow/util.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/local/bin/python
# encoding: utf-8
#
# Copyright (c) 2017 Dean Jackson <deanishe@deanishe.net>
Expand Down
6 changes: 3 additions & 3 deletions workflow/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -2330,7 +2330,7 @@ def check_update(self, force=False):
update_script = os.path.join(os.path.dirname(__file__),
b'update.py')

cmd = ['/usr/bin/python', update_script, 'check', repo, version]
cmd = ['/usr/local/bin/python', update_script, 'check', repo, version]

if self.prereleases:
cmd.append('--prereleases')
Expand Down Expand Up @@ -2369,7 +2369,7 @@ def start_update(self):
update_script = os.path.join(os.path.dirname(__file__),
b'update.py')

cmd = ['/usr/bin/python', update_script, 'install', repo, version]
cmd = ['/usr/local/bin/python', update_script, 'install', repo, version]

if self.prereleases:
cmd.append('--prereleases')
Expand Down Expand Up @@ -2718,7 +2718,7 @@ def fold_to_ascii(self, text):
return text
text = ''.join([ASCII_REPLACEMENTS.get(c, c) for c in text])
return unicode(unicodedata.normalize('NFKD',
text).encode('ascii', 'ignore'))
text).encode('ascii', 'ignore'))

def dumbify_punctuation(self, text):
"""Convert non-ASCII punctuation to closest ASCII equivalent.
Expand Down

0 comments on commit 2ad90d3

Please sign in to comment.