当前位置:网站首页>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 .
边栏推荐
- shell 批量文件名(不含扩展名)小写改大写
- Introduce six open source protocols in detail (instructions for programmers)
- Analysis of DHCP dynamic host setting protocol
- 记一次 .NET 某新能源系统 线程疯涨 分析
- COSCon'22 社区召集令来啦!Open the World,邀请所有社区一起拥抱开源,打开新世界~
- 单片机原理期末复习笔记
- 提升树莓派性能的方法
- Pcap learning notes II: pcap4j source code Notes
- Awk of three swordsmen in text processing
- JNA learning notes 1: Concepts
猜你喜欢

【黑马早报】华为辟谣“军师”陈春花;恒驰5预售价17.9万元;周杰伦新专辑MV 3小时播放量破亿;法华寺回应万元月薪招人...
![[dark horse morning post] Huawei refutes rumors about](/img/d7/4671b5a74317a8f87ffd36be2b34e1.jpg)
[dark horse morning post] Huawei refutes rumors about "military master" Chen Chunhua; Hengchi 5 has a pre-sale price of 179000 yuan; Jay Chou's new album MV has played more than 100 million in 3 hours

Cloud detection 2020: self attention generation countermeasure network for cloud detection in high-resolution remote sensing images

【Presto Profile系列】Timeline使用

error LNK2019: 无法解析的外部符号

Esp32 construction engineering add components

Distributed transaction solution

基于鲲鹏原生安全,打造安全可信的计算平台

Per capita Swiss number series, Swiss number 4 generation JS reverse analysis

leecode3. 无重复字符的最长子串
随机推荐
单片机学习笔记之点亮led 灯
MongoDB命令汇总
如何让join跑得更快?
ESP32 ① 编译环境
一文读懂数仓中的pg_stat
【黑马早报】华为辟谣“军师”陈春花;恒驰5预售价17.9万元;周杰伦新专辑MV 3小时播放量破亿;法华寺回应万元月薪招人...
Some principles of mongodb optimization
日本政企员工喝醉丢失46万信息U盘,公开道歉又透露密码规则
飞桨EasyDL实操范例:工业零件划痕自动识别
滑轨步进电机调试(全国海洋航行器大赛)(STM32主控)
Esp32 construction engineering add components
[untitled]
Cookie and session comparison
[learning notes] zkw segment tree
JS function 返回多个值
10 张图打开 CPU 缓存一致性的大门
自定义线程池拒绝策略
Write it down once Net a new energy system thread surge analysis
高端了8年,雅迪如今怎么样?
About how appium closes apps (resolved)