Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions cpuload@kimse/files/cpuload@kimse/desklet.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ CpuLoadDesklet.prototype = {
this.settings.bindProperty(Settings.BindingDirection.IN, 'static-theme-color', 'static_theme_color', this.on_setting_changed);
this.settings.bindProperty(Settings.BindingDirection.IN, 'show-background', 'show_background', this.on_setting_changed);
this.settings.bindProperty(Settings.BindingDirection.IN, 'hide-decorations', 'hide_decorations', this.on_setting_changed);
this.settings.bindProperty(Settings.BindingDirection.IN, 'desklet-background-color', 'desklet_background_color', this.on_setting_changed);

// Properties
this.cpus_utilization = [];
Expand Down Expand Up @@ -73,6 +74,7 @@ CpuLoadDesklet.prototype = {
// Refresh the desklet window
this.refreshScalingSizes();
this.toggleDecoration();
this.refreshBackground();

// Start the main desklet loop
this.main();
Expand All @@ -89,6 +91,17 @@ CpuLoadDesklet.prototype = {
this._updateDecoration();
},

/**
* Apply the user-selected background color/transparency to the
* desklet face. `this.content` is the St.Bin the base Desklet class
* wraps our window in (see setContent() in ui/desklet.js) - styling
* it, rather than this.window, covers the full desklet bounding box
* instead of just the area behind the gauges.
*/
refreshBackground() {
this.content.style = "background-color: " + this.desklet_background_color + ";";
},

/**
* Refresh desklet scaling.
*/
Expand Down Expand Up @@ -621,6 +634,9 @@ CpuLoadDesklet.prototype = {
// Update decoration settings
this.toggleDecoration();

// Refresh background color/transparency
this.refreshBackground();

// Refresh scaling sizes
this.refreshScalingSizes();

Expand Down
5 changes: 3 additions & 2 deletions cpuload@kimse/files/cpuload@kimse/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"description": "Displays CPU load",
"name": "CPU Load",
"version": "0.8",
"uuid": "cpuload@kimse"
}
"uuid": "cpuload@kimse",
"author": "schorschii"
}
11 changes: 9 additions & 2 deletions cpuload@kimse/files/cpuload@kimse/settings-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,17 @@
"type": "header",
"description": "Background"
},
"desklet-background-color": {
"type": "colorchooser",
"default": "rgba(0,0,0,0)",
"description": "Desklet background",
"tooltip": "Background color for the whole desklet face. Use the alpha slider in the color picker to set transparency - alpha 0 keeps it fully see-through, matching the old behavior."
},
"show-background": {
"type": "checkbox",
"description": "Show background",
"default": true
"description": "Show gauge track",
"default": true,
"tooltip": "Show a faint ring behind each CPU gauge. This is separate from the desklet background above."
},
"hide-decorations": {
"type": "checkbox",
Expand Down
Loading