Gnome 3.12 Applications Menu 添加 Logo

效果图:

Screenshot from 2014-10-05 11:10:16

扩展地址:apps-menu@gnome-shell-extensions.gcampax.github.com

步骤:

一、

先找一张 png 格式的 logo: http://download.easyicon.net/png/1068656/256/ 转换为 svg 格式(注意路径):

mogrify -format svg -resize 48x48 '/usr/share/icons/Numix-Circle/scalable/apps/archlogo.png'

没有 mogrify 命令的话先安装: pacman -S imagemagick

二、

参照以下代码修改 /usr/share/gnome-shell/extensions/apps-menu@gnome-shell-extensions.gcampax.github.com/extension.js:

    this.actor.accessible_role = Atk.Role.LABEL;
    let hbox = new St.BoxLayout({ style_class: 'panel-status-menu-box' });
    // this._label = new St.Label({ text: _("Applications"),
    //                             y_expand: true,
    //                             y_align: Clutter.ActorAlign.CENTER });

    this._box = new St.BoxLayout();
    this._iconBox = new St.Bin();
    this._box.add(this._iconBox, { y_align: St.Align.MIDDLE, y_fill: false });
    let logo = new St.Icon({ icon_name: 'archlogo', style_class: 'applications-menu-button-icon', icon_size: 22 });
    this._iconBox.child = logo;
    let label = new St.Label({ text: " " });
    this._box.add(label, { y_align: St.Align.MIDDLE, y_fill: false });
    this._label = new St.Label({ text: _("Applications") });
    this._box.add(this._label, { y_align: St.Align.MIDDLE, y_fill: false });
    this.actor.add_actor(this._box);

    hbox.add_child(this._label);
    hbox.add_child(new St.Label({ text: 'u25BE',
    y_expand: true,
    y_align: Clutter.ActorAlign.CENTER }));

    this.actor.add_actor(hbox);
    this.actor.name = 'panelApplications';
    ....

三、

重启 gnome-shell。