当前位置:网站首页>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 .
边栏推荐
- LeetCode_ Binary search_ Medium_ 153. Find the minimum value in the rotation sort array
- 数字ic设计——SPI
- [learning notes] agc010
- [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
- 飞桨EasyDL实操范例:工业零件划痕自动识别
- Vscode编辑器ESP32头文件波浪线不跳转彻底解决
- DETR介绍
- High end for 8 years, how is Yadi now?
- 单片机原理期末复习笔记
- JS slow motion animation principle teaching (super detail)
猜你喜欢

“新红旗杯”桌面应用创意大赛2022

【学习笔记】zkw 线段树

日本政企员工喝醉丢失46万信息U盘,公开道歉又透露密码规则

Sed of three swordsmen in text processing

Isprs2021/ remote sensing image cloud detection: a geographic information driven method and a new large-scale remote sensing cloud / snow detection data set

JS slow motion animation principle teaching (super detail)

Esp32 construction engineering add components

COSCon'22 社区召集令来啦!Open the World,邀请所有社区一起拥抱开源,打开新世界~

OSI seven layer model

【Presto Profile系列】Timeline使用
随机推荐
Differences between MySQL storage engine MyISAM and InnoDB
[untitled]
飞桨EasyDL实操范例:工业零件划痕自动识别
. Net ultimate productivity of efcore sub table sub database fully automated migration codefirst
高端了8年,雅迪如今怎么样?
Users, groups, and permissions
error LNK2019: 无法解析的外部符号
How to make the new window opened by electorn on the window taskbar
How to reset Google browser? Google Chrome restore default settings?
User management summary of mongodb
How to continue after handling chain interruption / sub chain error removed from scheduling
API query interface for free mobile phone number ownership
ESP32 ① 编译环境
RealBasicVSR测试图片、视频
MongoDB的用户管理总结
1、深拷贝 2、call apply bind 3、for of for in 区别
php——laravel缓存cache
分布式事务解决方案
Summary of import, export, backup and recovery of mongodb
简单好用的代码规范