Prevent auto updates (refresh) of my app when it is running


I am the developer of Super Productivity which is an open source app mainly distributed as snap. The app is based on electron and uses IndexedDB as a data-source. Unfortunately there is an issue: Whenever snapd automatically tries update the app the database connection is lost and there is no way to recover from it (apart from restarting the app). Is there anyway to prevent this updates when the app is running (from the app itself, as most of my users probably just run snap as it is configured out of the box)?

i believe

is soon becoming a default so that apps should not refresh while running but notify the user to close and update it …

until it is fully there you can advise your users to enable the experimental feature via

snap set system experimental.refresh-app-awareness=true

(probably show them a popup on first start of the app to tell them about it)

1 Like

Thank you very much for the reply!

Is there maybe some way to work around this issue by using the pre-refresh hook?

no, the hooks run as root and are usually quietened for anything interactive unless they fail …

while you could add something like logger -t $SNAP_NAME "please enable foo" to the hook, that would only end up in the journal…

you could either add something to electron that gets shown on startup like:

or use a command-chain script, ship something like yad in your snap and do it like:

(also see the snapcraft.yaml, how yad is shipped (in the init-checks part) and how the command wrapper is used )

Alright! Thank you very much for the quick and extensive help! Much appreciated (didn’t expect this tbh :))! I’ll stick with informing my users about this then.