gnome shell扩展样式表没有加载

时间:2011-05-05 13:24:41

标签: gnome gnome-3 gnome-shell

我正在尝试开发一个gnome shell扩展,我创建了“Hello World”扩展,它是使用gnome-shell-extension-tool --create-extension自动创建的 它创建了3个文件:example.js,metadata.json,stylesheet.css。

我重新加载gnome-shell并且扩展程序正常工作。问题是,样式文件根本不起作用;这是代码:

// Sample extension code, makes clicking on the panel show a message
const St = imports.gi.St;
const Mainloop = imports.mainloop;

const Main = imports.ui.main;

function _showHello() {
    let text = new St.Label({  style_class: 'hello', text: "Hello, world!" });
    let monitor = global.get_primary_monitor();
    global.stage.add_actor(text);
    text.set_position(Math.floor (monitor.width / 2 - text.width / 2), Math.floor(monitor.height / 2 - text.height / 2));
    text.add_style_class_name("hello");
    Mainloop.timeout_add(6000, function () { text.destroy(); });
}

// Put your extension initialization code here
function main() {
    Main.panel.actor.reactive = true;
    Main.panel.actor.connect('button-release-event', _showHello);
}

这里的stylesheet.css:

/* Example stylesheet */
.hello {
    font-size: 360px;
    font-weight: bold;
    color: #ffffff;
    background-color: rgba(10,10,10,0.7);
    border-radius: 5px;
}

我不知道如何获得更多关于此的信息....任何想法?

2 个答案:

答案 0 :(得分:0)

尝试以下样式表:

.hello {
   font-size: 36px;
   font-weight: bold;
   color: #ffffff;
   background-color: rgba(10,10,10,0.7);
   border-radius: 15px;
   margin: 50px;
   padding: 50px;
}

答案 1 :(得分:0)

我终于解决了:D 问题是我安装了“用户主题”扩展,它与css管理产生了混淆 希望可以帮助别人

P.S。我正在使用ArchLinux 32位版本

相关问题