我的Gnome Shell扩展程序有一个文件夹'icons',里面有一个名为'MyIcon.png'的图标文件.我想把它作为St.Icon对象的参数.
let icon = new St.Icon({ /* I need what to code here*/ });
谢谢你的帮助.
塞尔丘克.
这是GnomeShell v3.8.4的解决方案:
const St = imports.gi.St; const Me = imports.misc.extensionUtils.getCurrentExtension(); const Gio = imports.gi.Gio; let gicon = Gio.icon_new_for_string(Me.path + "/icons/my_icon.png"); icon = new St.Icon({ gicon });