2

Is there any trick to run my "destructor" code in an extension when Gnome Shell is closing (e.g. computer turning off)? I need to save some state variables to load them again in init() on start.

I need something like function enable() or disable(). Maybe there is some signal being fired which I could connect my code to?

Jens Erat
  • 37,523
  • 16
  • 80
  • 96
Bobas
  • 23
  • 2

1 Answers1

0

The disable()-function inside the extension.js-file is called when:

  • The user disables an extension in a running shell
  • The shell shuts down or restarts

Keep in mind that it's meant to do UI-manipulation, so you should finish it fast (no heavy lifting).

Lukas Knuth
  • 25,449
  • 15
  • 83
  • 111
  • My experience regarding this topic. disable() is **not** called on system shutdown. Just tested it on ubuntu18 with GNOME Shell 3.34.1. Logout and screen lock **is** triggering it. – wormhit Mar 26 '20 at 14:49