私は gnome シェル拡張機能を開発しようとしており、自動的に作成される「Hello World」拡張機能を作成しました。gnome-shell-extension-tool --create-extension
これにより、example.js、metadata.json、stylesheet.css の 3 つのファイルが作成されます。
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;
}
これについてさらに情報を得る方法さえ知りませんでした....何か考えはありますか?