Initial commit
This commit is contained in:
40
extension.js
Normal file
40
extension.js
Normal file
@@ -0,0 +1,40 @@
|
||||
const St = imports.gi.St;
|
||||
const Main = imports.ui.main;
|
||||
const Gio = imports.gi.Gio;
|
||||
const PanelMenu = imports.ui.panelMenu;
|
||||
const PopupMenu = imports.ui.popupMenu;
|
||||
|
||||
class MyPanelButton extends PanelMenu.Button {
|
||||
constructor() {
|
||||
super(0.0, 'MyExtension');
|
||||
|
||||
let icon = new St.Icon({
|
||||
icon_name: 'face-smile-symbolic',
|
||||
style_class: 'system-status-icon'
|
||||
});
|
||||
|
||||
this.add_child(icon);
|
||||
|
||||
this.menu.addAction('Click Me', () => {
|
||||
Main.notify('Hello from MyExtension!');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
let myPanelButton;
|
||||
|
||||
function init() {
|
||||
// 初始化代码
|
||||
}
|
||||
|
||||
function enable() {
|
||||
myPanelButton = new MyPanelButton();
|
||||
Main.panel.addToStatusArea('my-extension', myPanelButton);
|
||||
}
|
||||
|
||||
function disable() {
|
||||
if (myPanelButton) {
|
||||
myPanelButton.destroy();
|
||||
myPanelButton = null;
|
||||
}
|
||||
}
|
||||
7
metadatat.json
Normal file
7
metadatat.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"shell-version": ["42", "43"],
|
||||
"uuid": "my-extension@domain",
|
||||
"name": "My Extension",
|
||||
"description": "A simple GNOME Shell extension.",
|
||||
"url": "https://github.com/yourusername/my-extension"
|
||||
}
|
||||
0
stylesheet.css
Normal file
0
stylesheet.css
Normal file
Reference in New Issue
Block a user