我正在尝试开发一个gnome外壳扩展,我已经创建了"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;
}我甚至不知道如何获得更多关于this....any idea的信息?
发布于 2011-05-17 22:45:39
我终于解决了这个问题:D问题是我已经安装了“user- The”扩展,它用css管理创建conficts希望可以帮助某些人
附言:我使用的是ArchLinux 32位版本
发布于 2011-05-17 11:06:20
尝试以下样式表:
.hello {
font-size: 36px;
font-weight: bold;
color: #ffffff;
background-color: rgba(10,10,10,0.7);
border-radius: 15px;
margin: 50px;
padding: 50px;
}https://stackoverflow.com/questions/5898423
复制相似问题