当前位置:网站首页>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 .
边栏推荐
- 人均瑞数系列,瑞数 4 代 JS 逆向分析
- Analysis of DHCP dynamic host setting protocol
- Esp32 series column
- 【Presto Profile系列】Timeline使用
- clion mingw64中文乱码
- High end for 8 years, how is Yadi now?
- Pay close attention to the work of safety production and make every effort to ensure the safety of people's lives and property
- MATLAB中polarscatter函数使用
- 1、深拷贝 2、call apply bind 3、for of for in 区别
- QQ medicine, Tencent ticket
猜你喜欢
日本政企员工喝醉丢失46万信息U盘,公开道歉又透露密码规则
【学习笔记】AGC010
Practical example of propeller easydl: automatic scratch recognition of industrial parts
飞桨EasyDL实操范例:工业零件划痕自动识别
PACP学习笔记一:使用 PCAP 编程
Per capita Swiss number series, Swiss number 4 generation JS reverse analysis
MongoDB内部的存储原理
leecode3. 无重复字符的最长子串
《开源圆桌派》第十一期“冰与火之歌”——如何平衡开源与安全间的天然矛盾?
[learning notes] agc010
随机推荐
Grep of three swordsmen in text processing
Cinnamon 任务栏网速
[learning notes] zkw segment tree
基于鲲鹏原生安全,打造安全可信的计算平台
抓细抓实抓好安全生产各项工作 全力确保人民群众生命财产安全
About the problem of APP flash back after appium starts the app - (solved)
Ogre入门尝鲜
MongoDB的导入导出、备份恢复总结
我那“不好惹”的00后下属:不差钱,怼领导,抵制加班
记一次 .NET 某新能源系统 线程疯涨 分析
如何让join跑得更快?
飞桨EasyDL实操范例:工业零件划痕自动识别
Distributed transaction solution
一文读懂数仓中的pg_stat
php——laravel缓存cache
LIS 最长上升子序列问题(动态规划、贪心+二分)
Scrapy教程经典实战【新概念英语】
解决缓存击穿问题
DHCP 动态主机设置协议 分析
Analysis of DHCP dynamic host setting protocol