Question

i'm trying to develop a gnome shell extension and I've created the "Hello World" extension which is created automatically with gnome-shell-extension-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?

Was it helpful?

Solution 2

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

OTHER TIPS

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;
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top