Search code examples
gnomegnome-shellgnome-shell-extensions

Gnome shell extensions, preventing the call of `disable` when the screen gets locked


When the screen gets locked, my gnome shell extension is disabled. The shell calls disable function of the extension and enable is called again when the lock is released. Can I prevent this behavior? My extension needs to do something in background and it must not stop when screen is locked. I want disable is called only when the extension is disabled explicitly by the user.


Solution

  • Nope, you could totally ignore disable() but your extension would be rejected on the extensions website (for obvious reasons). The only way to address this is to run some manner of daemon in the background, like the Drop Down Terminal extension does.

    The easiest way to do this is to write a simple Gio.Application and spawn it during enable() using GLib.spawn_command_line_async. See also: HowDoI/GtkApplication