我的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 });
关于gnome - 如何在Gnome Shell扩展中为St.Icon设置PNG文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20394840/