我的目标是当用户按下Gnome顶栏中的按钮时启动一个新的GtkApplication。顶部栏中的按钮可以通过gnome-shell-extension来完成,但我在打开GtkApplication时遇到了困难。
因此,现在,下面的代码应该只启动GtkApplication。
在将代码放入~/.local/share/gnome-shell/extensions/test@test/extension.js之后启用此扩展始终会导致gnome-shell的SIGSEGV信号。
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();
}发布于 2016-09-22 16:09:41
我来派对可能有点晚了,但以防其他人来了:
答案很可能就在imports.misc.util中
const Util = imports.misc.util;
Util.spawn()https://stackoverflow.com/questions/31963902
复制相似问题