transparent background

This commit is contained in:
sonichy
2025-05-22 22:59:13 +08:00
parent 47fd32872d
commit 35c07f413b
3 changed files with 13 additions and 7 deletions

View File

@@ -41,7 +41,7 @@ export default class CMUDExtension extends Extension {
//this._indicator.menu.addMenuItem(menuItem); //this._indicator.menu.addMenuItem(menuItem);
this.label_tooltip = new St.Label({ text: '' }); this.label_tooltip = new St.Label({ text: '' });
this.label_tooltip.set_style('background:#222; padding:10px; border:1px solid #aaa; border-radius:10px;'); this.label_tooltip.set_style('background:rgba(10,10,10,0.8); padding:10px; border:1px solid #aaa; border-radius:10px; font-family:Noto Mono');
global.stage.add_child(this.label_tooltip); global.stage.add_child(this.label_tooltip);
this.label_tooltip.hide(); this.label_tooltip.hide();
this._indicator.connect('notify::hover', () => { this._indicator.connect('notify::hover', () => {
@@ -50,10 +50,10 @@ export default class CMUDExtension extends Extension {
if (x == 0 && y != 0) //LEFT if (x == 0 && y != 0) //LEFT
this.label_tooltip.set_position(x + this._indicator.width + 1, y); this.label_tooltip.set_position(x + this._indicator.width + 1, y);
else if (x != 0 && y == 0) //TOP else if (x != 0 && y == 0) //TOP
this.label_tooltip.set_position(x, y + this._indicator.height + 1); this.label_tooltip.set_position(x - this.label_tooltip.width / 2 + this._indicator.width / 2, y + this._indicator.height + 1);
else else
if (this._indicator.height == Main.panel.height) //BOTTOM if (this._indicator.height == Main.panel.height) //BOTTOM
this.label_tooltip.set_position(x, y - this.label_tooltip.height - 1); this.label_tooltip.set_position(x - this.label_tooltip.width / 2 + this._indicator.width / 2, y - this.label_tooltip.height - 1);
else //RIGHT else //RIGHT
this.label_tooltip.set_position(x - this.label_tooltip.width - 1, y); this.label_tooltip.set_position(x - this.label_tooltip.width - 1, y);
if (this._indicator.hover) if (this._indicator.hover)
@@ -69,7 +69,7 @@ export default class CMUDExtension extends Extension {
area_mem.queue_repaint(); area_mem.queue_repaint();
this.cpu(); this.cpu();
area_cpu.queue_repaint(); area_cpu.queue_repaint();
var s = 'Uptime: ' + this.uptime() + '\nCPU: ' + cp + '%\nMem: ' + this.mem() + '\nUp: ' + this.B2G(net.ub) + '\nDown: ' + this.B2G(net.db); var s = 'UPT: ' + this.uptime() + '\nCPU: ' + cp + '%\nMEM: ' + this.mem() + '\nUPB: ' + this.B2G(net.ub) + '\nDNB: ' + this.B2G(net.db);
//menuItem.label.text = s; //menuItem.label.text = s;
this.label_tooltip.text = s; this.label_tooltip.text = s;
// Run as loop, not once. // Run as loop, not once.

View File

@@ -1,9 +1,15 @@
{ {
"_generated": "Generated by SweetTooth, do not edit",
"author": "sonichy", "author": "sonichy",
"description": "Display uptime, cpu, memory, upload, download on GNOME taskbar.", "description": "Display uptime, cpu, memory, upload, download on GNOME taskbar.",
"name": "CMUD", "name": "CMUD",
"shell-version": [ "45", "46", "47", "48" ], "shell-version": [
"45",
"46",
"47",
"48"
],
"url": "https://github.com/sonichy/GNOME_extension", "url": "https://github.com/sonichy/GNOME_extension",
"uuid": "CMUD@sonichy", "uuid": "CMUD@sonichy",
"version": 1.1 "version": 7
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 127 KiB

After

Width:  |  Height:  |  Size: 135 KiB