开发者

gnome shell extension stylesheet not loading

开发者 https://www.devze.com 2023-03-03 06:51 出处:网络
i\'m trying to develop a gnome shell extension and I\'ve created the \"Hello World\" extension which is created automatically with gnome-shell-开发者_如何学Goextension-tool --create-extension

i'm trying to develop a gnome shell extension and I've created the "Hello World" extension which is created automatically with gnome-shell-开发者_如何学Goextension-tool --create-extension It creates 3 files: example.js, metadata.json, stylesheet.css.

I reload gnome-shell and the extension works correcty. The problem is, the styling file is not working at all; here is the code:

// 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);
}

And here stylesheet.css:

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

I didn't know how to even get more information about this....any idea?


Try the following stylesheet:

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


I've finally worked it out :D The problem was that I had installed the "user-theme" extension wich creates conficts with the css management Hope can help someone

P.S. I'm using ArchLinux 32bit version

0

精彩评论

暂无评论...
验证码 换一张
取 消