我正在尝试使用本指南中的代码运行 gnome 扩展 https://gjs.guide/extensions/upgrading/legacy-documentation.html#extensionUbuntu 22.04、GNOME 42.9、waylandcontents 扩展...
我正在尝试使用本指南中的代码运行 gnome 扩展 https://gjs.guide/extensions/upgrading/legacy-documentation.html#extension Ubuntu 22.04、GNOME 42.9、wayland
extension.js 的内容(从上面的链接复制):
const St = imports.gi.St;
const ExtensionUtils = imports.misc.extensionUtils;
const Me = ExtensionUtils.getCurrentExtension();
const Main = imports.ui.main;
const PanelMenu = imports.ui.panelMenu;
const {
gettext: _,
} = ExtensionUtils;
class Extension {
enable() {
// Create a panel button
this._indicator = new PanelMenu.Button(0.0, Me.metadata.name, false);
// Add an icon
const icon = new St.Icon({
icon_name: 'face-laugh-symbolic',
style_class: 'system-status-icon',
});
this._indicator.add_child(icon);
// Add the indicator to the panel
Main.panel.addToStatusArea(Me.metadata.uuid, this._indicator);
// Add a menu item to open the preferences window
this._indicator.menu.addAction(_('Preferences'),
() => ExtensionUtils.openPrefs());
this._count = 0;
}
disable() {
if (this._indicator) {
this._indicator.destroy();
this._indicator = null;
}
}
}
function init() {
ExtensionUtils.initTranslations();
return new Extension();
}
metadata.json的内容:
{
"uuid": "[email protected]",
"name": "Example Extension",
"description": "An example extension",
"shell-version": [ "42.9" ],
"url": "https://gjs.guide/extensions"
}
错误: