pallotron / yubiswitch

OSX status bar application to enable/disable Yubikey Nano
Other
871 stars 65 forks source link

Various fixes #108

Closed reaperhulk closed 2 years ago

reaperhulk commented 2 years ago

This PR makes a variety of changes to the project, some of which may be desirable, some of which could be better. I've tried to separate each commit so they can be cherry-picked or improved as you desire. šŸ˜„

The changes:

1) Resized the menu bar images so they appear the correct size. When the new images were committed several years ago they were apparently contributed at 100px/200px/300px height. This looks great, but macOS (at least as of Xcode 13.2.1 in macOS 12.1) doesn't properly scale them. So instead we scale them to 22px/44px/66px respectively. 2) Fix the submodule commit hash (and extraneous submodule that used a relative path) to point at an existing commit that is compatible with the current project source. I did not upgrade to latest here. 3) Added a bit of debug code in various places just so I could understand the errors I was seeing better. 4) Switched from xpc_connection_send_message_with_reply to xpc_connection_send_message_with_reply_sync because it appeared there was a race condition in the async code in the action selector assuming xpc_connection_send_message_with_reply immediately returns. Maybe I'm wrong about this though (please let me know if so!) 5) Updated a few calls to non-deprecated versions. There are a variety of other project settings that Xcode would like to update, but that's a much larger change so I've deferred it for now. 6) Fixed helper crashes caused by multiple calls to IOHIDManagerScheduleWithRunLoop with the same hidManager. In macOS 10.15+ this causes an assertion failure. 7) Added a very primitive dialog that tells you yubiswitch requires Accessibility enabled to function (which then redirects you to the correct System Preferences pane and tab).

As a consequence of these changes yubiswitch does now properly disable on start (previously I had to toggle it on and off a few times to reliably get it to disable).

stevenharman commented 2 years ago

@reaperhulk Thank you so much for this! I hope @pallotron has a chance to incorporate these and cut a new build šŸ”œ. I've got an M1 personal machine and we've started to move to M1s for work as well. I really miss YubiSwitcher on my M1!

pallotron commented 2 years ago

Thanks! Sorry about late merge. I don't have much time to dedicate to personal projects.

In fact I should probably seek a new owner for this project :)

reaperhulk commented 2 years ago

You might want to shift this repo to its own GitHub org to make it easier to expand maintainers and manage it. Iā€™m not familiar with best practices for managing an OSS project that also needs an apple developer subscription for signing/notarizarion though. I would be willing to help out (although I emphasize that I am not an objective-C developer, I was just motivated to get this working šŸ˜‚)

davidrothera commented 2 years ago

I can help out and have a developer account to perform releases.

erikdw commented 1 year ago

@reaperhulk : thanks so much for this fix, I'm looking forward to taking advantage of it. @davidrothera : would you be able to somehow create a new image with this fix in it?

davidrothera commented 1 year ago

Sure thing, I'll do it this evening.

pallotron commented 1 year ago

Let me add you as maintainer on this project. Thanks @davidrothera