Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get MacOS working as well as we can. #905

Merged
merged 6 commits into from
Mar 13, 2021
Merged

Conversation

Athanasius
Copy link
Contributor

  1. pyobjc in requirements.txt
  2. Bug with darwin config.delete() not respecting suppress argument fixed.
  3. Only actually JournalLock.release_lock() if we actually hold a lock. Enables changing Journals location from non-existent to another without a fatal exception.

There's still an issue with the whole hotkey code not working because the application needs a MacOS permission to generally monitor keyboard input. The old way to grant this has changed in Catalina. There's "Input Monitoring" but I can't find any way to add an arbitrary app to it. We might need to find how to get the EDMC code to explicitly make the request so that the user can grant it.

And even then I'm not sure the current way of doing hotkeys on darwin is the recommended way on Catalina. It's going to take a lot of study of the code to discern what is just the tk input monitoring and what is specifici MacOS calls.

Else the blind deletion of the shipyard key at startup causes a fatal
exception.
In the scenario of the default Journals location not even existing the
user needs might update it to a network mount.  When they do so we
attempt, and fail, to unlock the old location, despite it not being
locked.

So now we have this boolean so we know if we should even attempt
unlocking.
@Athanasius
Copy link
Contributor Author

NB: There was also something weird with a loooooooooong delay before it popped up Safari for the Frontier Authorisation after I'd changed the Journals location. That may well not be MacOS-specific though.

On darwin this comes back with the type `__NSCFArray`, which I can't
find the definition of (in order to test against it).  So instead let's
check that `res` is not-None, and not one of `str` or `int`, because
then it should be (meant to be) `list`.

Yes, this is weird given the pre-rewrite code is:

```python
        def get(self, key: str) -> Union[None, list, str]:
            """Look up a string configuration value."""
            val = self.settings.get(key)
            if val is None:
                return None

            elif isinstance(val, str):
                return str(val)

            elif isinstance(val, list):
                return list(val)  # make writeable

            else:
                return None
```
But maybe something changed since 3.43 was tested and built.
config.py Outdated Show resolved Hide resolved
@Athanasius Athanasius merged commit a8240f1 into develop Mar 13, 2021
@Athanasius Athanasius deleted the fix/670/macos-requirements branch March 13, 2021 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants