当前位置:网站首页>Getting started with cinnamon applet
Getting started with cinnamon applet
2022-07-07 13:24:00 【Haitian Eagle】
file :
https://projects.linuxmint.com/reference/git/cinnamon-tutorials/write-applet.html
Cinnamon Applet route :
System :/usr/share/cinnamon/applets
user :~/.local/share/cinnamon/applets
1. Create folder [email protected]
2. newly build icon.png
3. newly build metadata.json
{
"uuid": "[email protected]",
"name": "CMDU",
"description": "Uptime, CPU usage, memory usage, download bytes, upload bytes, download speed, upload speed",
"icon": "force-exit"
}
4. newly build applet.js
const Applet = imports.ui.applet;
const Util = imports.misc.util;
const {GLib, Gio} = imports.gi;
function MyApplet(orientation, panel_height, instance_id) {
this._init(orientation, panel_height, instance_id);
}
MyApplet.prototype = {
__proto__: Applet.TextApplet.prototype,
_init: function(orientation, panel_height, instance_id) {
Applet.TextApplet.prototype._init.call(this, orientation, panel_height, instance_id);
this.set_applet_label("↑ 0KB/s\n↓ 0KB/s");
this.set_applet_tooltip(_("Uptime:\nCPU:\nMem:\nUp:\nDown:"));
//https://gjs.guide/guides/gjs/asynchronous-programming.html
GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, 1, () => {
var date = new Date();
var s = date.getFullYear() + "/" + (date.getMonth()+1) + "/" + date.getDate() + "\n" + date.getHours() + ":" + date.getMinutes()+ ":" + date.getSeconds();
this.set_applet_label(s);
this.set_applet_tooltip(_("Uptime: " + this.uptime() + "\nCPU:\nMem:\nUp:\nDown:"));
return true; // loop
});
},
on_applet_clicked: function() {
Util.spawnCommandLine("gnome-system-monitor");
}
};
function main(metadata, orientation, panel_height, instance_id) {
return new MyApplet(orientation, panel_height, instance_id);
}
5. Right click the taskbar - Problem solving - restart Cinnamon
advantage : No need to compile .
边栏推荐
- Realbasicvsr test pictures and videos
- “新红旗杯”桌面应用创意大赛2022
- Mongodb meets spark (for integration)
- Esp32 ① compilation environment
- Storage principle inside mongodb
- 飞桨EasyDL实操范例:工业零件划痕自动识别
- Coscon'22 community convening order is coming! Open the world, invite all communities to embrace open source and open a new world~
- 【学习笔记】zkw 线段树
- 单片机原理期末复习笔记
- JS function 返回多个值
猜你喜欢
Cmake learning and use notes (1)
Cinnamon 任务栏网速
Differences between MySQL storage engine MyISAM and InnoDB
单片机原理期末复习笔记
My "troublesome" subordinates after 00: not bad for money, against leaders, and resist overtime
QQ medicine, Tencent ticket
QQ的药,腾讯的票
Vscade editor esp32 header file wavy line does not jump completely solved
聊聊伪共享
我那“不好惹”的00后下属:不差钱,怼领导,抵制加班
随机推荐
Simple and easy-to-use code specification
DHCP 动态主机设置协议 分析
centso7 openssl 报错Verify return code: 20 (unable to get local issuer certificate)
LED light of single chip microcomputer learning notes
Cookie and session comparison
工具箱之 IKVM.NET 项目新进展
My "troublesome" subordinates after 00: not bad for money, against leaders, and resist overtime
Scrapy教程经典实战【新概念英语】
Some principles of mongodb optimization
Milkdown 控件图标
共创软硬件协同生态:Graphcore IPU与百度飞桨的“联合提交”亮相MLPerf
国泰君安证券开户怎么开的?开户安全吗?
How far can it go to adopt a cow by selling the concept to the market?
PACP学习笔记一:使用 PCAP 编程
COSCon'22 社区召集令来啦!Open the World,邀请所有社区一起拥抱开源,打开新世界~
[learning notes] segment tree selection
一文读懂数仓中的pg_stat
Grep of three swordsmen in text processing
Vscade editor esp32 header file wavy line does not jump completely solved
Cinnamon Applet 入门