|
| 1 | +diff --git a/desklet.js b/desklet.js |
| 2 | +index bbcf4dc..44fce22 100644 |
| 3 | +--- a/desklet.js |
| 4 | ++++ b/desklet.js |
| 5 | +@@ -45,6 +45,7 @@ CpuLoadDesklet.prototype = { |
| 6 | + this.settings.bindProperty(Settings.BindingDirection.IN, 'static-theme-color', 'static_theme_color', this.on_setting_changed); |
| 7 | + this.settings.bindProperty(Settings.BindingDirection.IN, 'show-background', 'show_background', this.on_setting_changed); |
| 8 | + this.settings.bindProperty(Settings.BindingDirection.IN, 'hide-decorations', 'hide_decorations', this.on_setting_changed); |
| 9 | ++ this.settings.bindProperty(Settings.BindingDirection.IN, 'desklet-background-color', 'desklet_background_color', this.on_setting_changed); |
| 10 | + |
| 11 | + // Properties |
| 12 | + this.cpus_utilization = []; |
| 13 | +@@ -73,6 +74,7 @@ CpuLoadDesklet.prototype = { |
| 14 | + // Refresh the desklet window |
| 15 | + this.refreshScalingSizes(); |
| 16 | + this.toggleDecoration(); |
| 17 | ++ this.refreshBackground(); |
| 18 | + |
| 19 | + // Start the main desklet loop |
| 20 | + this.main(); |
| 21 | +@@ -89,6 +91,17 @@ CpuLoadDesklet.prototype = { |
| 22 | + this._updateDecoration(); |
| 23 | + }, |
| 24 | + |
| 25 | ++ /** |
| 26 | ++ * Apply the user-selected background color/transparency to the |
| 27 | ++ * desklet face. `this.content` is the St.Bin the base Desklet class |
| 28 | ++ * wraps our window in (see setContent() in ui/desklet.js) - styling |
| 29 | ++ * it, rather than this.window, covers the full desklet bounding box |
| 30 | ++ * instead of just the area behind the gauges. |
| 31 | ++ */ |
| 32 | ++ refreshBackground() { |
| 33 | ++ this.content.style = "background-color: " + this.desklet_background_color + ";"; |
| 34 | ++ }, |
| 35 | ++ |
| 36 | + /** |
| 37 | + * Refresh desklet scaling. |
| 38 | + */ |
| 39 | +@@ -621,6 +634,9 @@ CpuLoadDesklet.prototype = { |
| 40 | + // Update decoration settings |
| 41 | + this.toggleDecoration(); |
| 42 | + |
| 43 | ++ // Refresh background color/transparency |
| 44 | ++ this.refreshBackground(); |
| 45 | ++ |
| 46 | + // Refresh scaling sizes |
| 47 | + this.refreshScalingSizes(); |
| 48 | + |
| 49 | +diff --git a/settings-schema.json b/settings-schema.json |
| 50 | +index 62cd74c..064a96b 100644 |
| 51 | +--- a/settings-schema.json |
| 52 | ++++ b/settings-schema.json |
| 53 | +@@ -94,10 +94,17 @@ |
| 54 | + "type": "header", |
| 55 | + "description": "Background" |
| 56 | + }, |
| 57 | ++ "desklet-background-color": { |
| 58 | ++ "type": "colorchooser", |
| 59 | ++ "default": "rgba(0,0,0,0)", |
| 60 | ++ "description": "Desklet background", |
| 61 | ++ "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." |
| 62 | ++ }, |
| 63 | + "show-background": { |
| 64 | + "type": "checkbox", |
| 65 | +- "description": "Show background", |
| 66 | +- "default": true |
| 67 | ++ "description": "Show gauge track", |
| 68 | ++ "default": true, |
| 69 | ++ "tooltip": "Show a faint ring behind each CPU gauge. This is separate from the desklet background above." |
| 70 | + }, |
| 71 | + "hide-decorations": { |
| 72 | + "type": "checkbox", |
0 commit comments