Recent Anki updates, bundle ID change? Disabling App Nap (macOS/Anki-Connect)

Before the recent Anki updates, you could disable the macOS App nap feature for Anki to prevent Anki-Connect issues, like described here:

foosoft/anki-connect

Starting with Mac OS X Mavericks, a feature named App Nap has been introduced to the operating system. This feature causes certain applications which are open (but not visible) to be placed in a suspended state. As this behavior causes Anki-Connect to stop working while you have another window in the foreground, App Nap should be disabled for Anki

These previous commands no longer work though:

defaults write net.ankiweb.dtop NSAppSleepDisabled -bool true
defaults write net.ichi2.anki NSAppSleepDisabled -bool true
defaults write org.qt-project.Qt.QtWebEngineCore NSAppSleepDisabled -bool true

I am guessing there are some bundle ID changes or something in the recent updates of Anki? Anyone know what the commands are supposed to be now?

Thanks!

I’m also keenly interested in this issue as well.

It might have something to do with the changes to Qt in the recent update, shifting to Qt6.

The bundle ID changed. PopClip also didn’t work in Anki anymore and required updating.

1 Like

Okay, so checking osascript -e 'id of app "Anki"' returns net.ankiweb.launcher as the ID it seems. However, running:

defaults write net.ankiweb.launcher NSAppSleepDisabled -bool true

…doesn’t work either though.

I tried editing the plist directly instead:

sudo cp /Applications/Anki.app/Contents/Info.plist ~/Desktop/anki_plist_backup-Info.plist
sudo /usr/libexec/PlistBuddy -c "Add :LSAppNapIsDisabled bool true" /Applications/Anki.app/Contents/Info.plist
sudo /usr/libexec/PlistBuddy -c "Print :LSAppNapIsDisabled" /Applications/Anki.app/Contents/Info.plist

(And then re-signing the application since otherwise it won’t open):

sudo codesign --force --deep --sign - /Applications/Anki.app

Then resetting launch services and clearing caches, but it still doesn’t work. I’m not sure what to do. There must surely be a way though right?

In case anyone else is looking for a temporary workaround, disabling App Nap globally does work:

defaults write NSGlobalDomain NSAppSleepDisabled -bool YES

It’s not ideal though, but at least it makes Anki-Connect usable again.

(It can be reverted with defaults delete NSGlobalDomain NSAppSleepDisabled btw).

While definitely far from ideal, this work-around at least works if I can remember to enable/disable the global setting every time I sit down to read a book.

The next beta will expose a method that AnkiConnect can use to adjust this directly.

from aqt._macos_helper import macos_helper as h; h.disable_appnap()
2 Likes