JitouchApp / Jitouch

A multi-touch extension for MacBook, Magic Mouse, and Magic Trackpad
GNU General Public License v3.0
391 stars 28 forks source link

No gestures working on Ventura #55

Open david-roquis opened 1 year ago

david-roquis commented 1 year ago

Hello,

First of all, thanks for your work on Jitouch, which has been an essential tool for me ever since I worked on a Mac.

I installed the latest release today on a 2017 MBP 15 inches on Ventura 13.1. Installation had no issue (I was using 2.74 before, which tended to crash at wakeup, but was overall working) and I don't think there are permission issues either. I uninstalled v2.74 before installing v2.82.1. Jitouch preference pane opens normally, I can add gestures or modify existing ones, but no gestures actually work. I was wondering if this could be a compatibility issue with Ventura. Any ideas?

Sincerely (and happy new year)

David

aaronkollasch commented 1 year ago

Happy new year, David!

Do you see the ji logo in your menu bar? If not, the Jitouch launch agent probably hasn't started, which might have something to do with Ventura's unified login items management. In System Settings > General > Login Items, is "Aaron Kollasch" enabled?

If it doesn't show up, you can also try reopening the Jitouch preferences and clicking the "On" toggle (even if it's selected).

david-roquis commented 1 year ago

Hi Aaron,

Thanks for your swift answer. I do see the JI logo in the menu bar, and Aaron Kollasch" is enabled as a login item. Reinstalling the old v2.74 works. I see no obvious issues, besides the fact that no gesture works. On my older macbook pro (mid-2010) on High Sierra, I have no issues with your latest release, so I suspect it might be something related to Ventura. Anything more I could do to troubleshoot?

Crazor commented 1 year ago

Hi David,

I suspect that for some reason, Jitouch is not able to open a CGEventTap because of some issue with AX API access/permissions.

First of all, you only ever should have just one instance of the Jitouch prefpane on your machine. To check, open a terminal and run: mdfind "kMDItemCFBundleIdentifier == *Jitouch*", which should result in exactly one bundle found: /Library/PreferencePanes/Jitouch.prefPane (assuming you installed with the default settings, that is for every user on the machine. If not, the result will be /Users/david/Library/PreferencePanes/Jitouch.prefPane. Both locations are fine as long as there is only one result.) If unsure, please remove all instances found, re-install from 2.82.1 and re-run the mdfind command.

Next, please make sure System Preferences is closed, run killall Jitouch ; tccutil reset All com.jitouch.Jitouch, which should return something like Successfully reset All approval status for com.jitouch.Jitouch, maybe more than once.

Now, open System Preferences again, click on the Jitouch icon, and a prompt should appear asking you to allow Accessibility access. If not, click on the On button in the lower left corner (even if it is already on), and this should finally give you the prompt. Head over to Security and Privacy preferences, unlock, and under Accessibility, make sure Jitouch and System Preferences are allowed to control your computer by ticking the checkboxes of both.

If gestures still are not working, make sure that the ji item has appeared and is not dimmed/transparent looking. If you click on it, the first menu entry should say "Turn Jitouch off". If it says "Turn Jitouch on", please click on it.

Let me know if this fixes your issues.

david-roquis commented 1 year ago

HI Crazor,

Thanks a lot for your clear and detailed message. I followed the procedure, but it does not solve my issue. Running the mdfind command returns /Library/PreferencePanes/Jitouch.prefPane, which is expected. No older version of jitouch, or leftovers, seem to be there.

killall (needs to be done twice) and tccutil do return expected output in the terminal. However, it seems tccutil only resets Jitouch gesture preferences (i.e. my custom gestures) and does not reset the pref system permissions at all (i.e. I don't get the accessibility prompt). In Ventura, the system preferences are quite different from the previous OS X versions and you can not "unlock" it as it was before. Nothing in "Accessibility" seems to be related to Jitouch, unlike it was in previous OS X versions. In "general"/"login items", "Aaron Kollasch" is approved though.

The Ji icon is indeed in my menu bar, and clicking on/off in the pref pane does not activate it (it was on by default).

I have no real clue what could be the problem, but I start to wonder if I should not redo a clean Ventura install to fix it. As I said, the previous version of jitouch (2.74) works when it is installed, but always becomes unresponsive after the computer wakes up (although I have a custom script to overcome that). This is one of the reason why I wanted to update Jitouch. If you have any other suggestions, I would gladly try them.

Crazor commented 1 year ago

David,

I am still running Monterey, but as far as I know, @aaronkollasch has been running Jitouch on Ventura successfully. Support was added in 2.82.0, have you tried that version?

I'm working on the 3.x branch (not availabe quite yet), and I will begin testing on Ventura soon. We're getting rid of the prefPane, and I have some workarounds in place to make achieving accessibility API access much easier. I will reply to this issue as soon as I have a test version ready with proven Ventura support.

aaronkollasch commented 1 year ago

In Ventura, under System Settings > Privacy & Security > Accessibility, you should see Jitouch listed. If not, perhaps you could try manually adding it. Click the + sign at the bottom of the list and then Cmd+Shift+G, then paste this path: /Library/PreferencePanes/Jitouch.prefPane/Contents/Resources and press Enter. (If you installed only for your user, add ~ before the path.) You should see the Jitouch application within this folder; click it and then click "Open" to add Jitouch to the list.

If Jitouch is already in that list, you could try removing it and then re-adding as I have described above.

Then, you will need to restart Jitouch. A simple killall Jitouch in the command line will do, or you can restart Jitouch by clicking "Quit Jitouch" in the Ji dropdown menu, then opening the Jitouch preferences and clicking "On".

Hope this helps.

david-roquis commented 1 year ago

Dear Aaron and Crazor,

I have tried a clean install of v2.82.0 and it works perfectly. It is way more stable than v2.74 (i.e. no random crash at wakeup or startup) and works smoothly. From there, I tried to upgrade to v2.82.1, and all the gestures stopped working again. Downgrading (i.e. reinstalling over v2.82.1 without a cleanup) to v2.82.0 makes it work again. It seems the issue I have on Ventura is specific to the latest release. I will stick to v2.82.0 for now, but I am totally available to help you troubleshooting the latest version if you need.

Thanks a lot for your responsive support, it helped solving my problem!

Sincerely

David

aaronkollasch commented 1 year ago

That's great, David, I'm glad to hear it!

Probably the only relevant difference between 2.82.0 and 2.82.1 is the way I schedule the (re)creation of the eventTap, though that shouldn't affect the first attempt at creating it. Would you be able to share your Jitouch logs from 2.82.1 and 2.82.0? (Your current log file probably has messages from both, though I might not know which version produced which messages) The file is at ~/Library/Logs/com.jitouch.Jitouch.log. If you can, please try restarting Jitouch with the log level set to "Debug". There may be messages related to creating the eventTap that could suggest what is happening.

I'll also try 2.82.1 in a clean install when I get the chance, as maybe it's only broken on new installs on Ventura? Strange...

Thanks, Aaron

david-roquis commented 1 year ago

Hi Aaron,

For debugging purpose, I redid a clean install of v2.82.1 this morning and I found the issue by looking in the log. As you suspected, there was a problem creating the eventTap:

2023-01-11 10:48:17.396 Jitouch[847:8404] Could not create CGEventTap. Allow Jitouch in System Preferences -> Privacy -> Accessibility. 2023-01-11 10:48:22.410 Jitouch[847:8404] Could not create CGEventTap (try 4) (this goes until try 127...)

What was weird, is that Jitouch was indeed allowed in System Preferences -> Privacy -> Accessibility, and opening the item in the folder pointed to the appropriate Jitouch app (within the content of Jitouch.prefPane). Funny thing, I could not disable it (i.e. if I wanted to slide the button left, it would automatically go back to right and stayed enabled). I manually removed Jitouch from System Preferences -> Privacy -> Accessibility and then add it manually again (the exact same app, at the same location, as the one I removed), and suddenly, it works.

2023-01-11 10:50:27.096 Jitouch[847:8404] CGEventTap created

Sliding the button left to disable the permission makes the System Preference window crash (if I re-open it, I can allow access again by sliding right and Jitouch works). Just after that, I did a clean install of v2.82.0, and in this case, no CGEventTap error in the log. Installing v2.82.1 over v2.82.0 worked without any problem and the gestures are working.

I suspect there was a bug in my System Preference pane, that the privacy>accessibility permission I had was working with the old v2.74 and v2.82.0, but for some reason was not working with v2.82.1. Removing this permission and resetting it manually from v.2.82.1 made it work (even though old and new permission pointed at the exact same file).

Thanks again for all your support. I can't imagine working on my mac without Jitouch, and your version is much more stable than the older one. It seems the problem came from my Ventura installation, and not your code, and I hope I didn't not waste too much of your time.

aaronkollasch commented 1 year ago

Thanks for trying all our suggestions David, this looks like a strange bug and I hope it doesn't pop up again.

It's always useful to see which stumbling blocks remain, as it's possible we can address them in the future.