JayStrictor
JayStrictor

Reputation: 488

How to start a GtkApplication from inside a gnome-shell-extension?

My goal is to start a new GtkApplication when the user presses a button in the topbar of Gnome. The button in the topbar can be done by a gnome-shell-extension, but I have difficulties opening up the GtkApplication.

Therefore, for now the following code should just start the GtkApplication.

Enabling this extension after putting the code inside ~/.local/share/gnome-shell/extensions/test@test/extension.js always results in a SIGSEGV signal of gnome-shell.

const Lang = imports.lang;
const Gtk = imports.gi.Gtk;
const TestApp = new Lang.Class({
    Name: 'TestApp',
    Extends: Gtk.Application,
    _init: function() {
        this.parent({ application_id: 'testapp.apptesttt' });
    },
    vfunc_activate: function() {
        //this.window.present();
    },
});
function init() {
}
let _app;
function enable() {
    _app = new TestApp();
    _app.register(null);
}
function disable() {
    _app.quit();
}

Upvotes: 1

Views: 216

Answers (1)

Elbenfreund
Elbenfreund

Reputation: 306

I am probably a bit late to the party, but in case someone else ends up here:

The answer most likely lies within imports.misc.util:

const Util = imports.misc.util;
Util.spawn()

Upvotes: 1

Related Questions