@@ -49,7 +49,10 @@ MyDesklet.prototype = {
4949 this . settings . bindProperty ( Settings . BindingDirection . IN , "text-color" , "text_color" , this . on_setting_changed ) ;
5050 this . settings . bindProperty ( Settings . BindingDirection . IN , "design" , "design" , this . on_setting_changed ) ;
5151 this . settings . bindProperty ( Settings . BindingDirection . IN , "draw-free-space" , "draw_free_space" , this . on_setting_changed ) ;
52+ this . settings . bindProperty ( Settings . BindingDirection . IN , "fill-circle-background" , "fill_circle_background" , this . on_setting_changed ) ;
53+ this . settings . bindProperty ( Settings . BindingDirection . IN , "fill-circle-background-color" , "fill_circle_background_color" , this . on_setting_changed ) ;
5254 this . settings . bindProperty ( Settings . BindingDirection . IN , "circle-color" , "circle_color" , this . on_setting_changed ) ;
55+ this . settings . bindProperty ( Settings . BindingDirection . IN , "circle-color-free-space" , "circle_color_free_space" , this . on_setting_changed ) ;
5356 this . settings . bindProperty ( Settings . BindingDirection . IN , "use-own-circle-color" , "use_own_circle_color" , this . on_setting_changed ) ;
5457 this . settings . bindProperty ( Settings . BindingDirection . IN , "filesystem" , "filesystem" , this . on_setting_changed ) ;
5558 this . settings . bindProperty ( Settings . BindingDirection . IN , "type" , "type" , this . on_setting_changed ) ;
@@ -200,7 +203,7 @@ MyDesklet.prototype = {
200203 // canvas setup
201204 let canvas = new Clutter . Canvas ( ) ;
202205 canvas . set_size ( absoluteSize * global . ui_scale , absoluteSize * global . ui_scale ) ;
203- canvas . connect ( "draw" , function ( canvas , cr , width , height ) {
206+ canvas . connect ( "draw" , ( canvas , cr , width , height ) => {
204207 cr . save ( ) ;
205208 cr . setOperator ( Cairo . Operator . CLEAR ) ;
206209 cr . paint ( ) ;
@@ -213,9 +216,25 @@ MyDesklet.prototype = {
213216 let start = 0 - offset ;
214217 let end = ( ( use * ( Math . PI * 2 ) ) / size ) - offset ;
215218
219+ const free_space_colors = this . circle_color_free_space . match ( / \( ( .* ?) \) / ) [ 1 ] . split ( "," ) ; // get contents inside brackets: "rgb(...)"
220+ const free_space_color_r = this . use_own_circle_color ? parseInt ( free_space_colors [ 0 ] ) / 255 : 1 ;
221+ const free_space_color_g = this . use_own_circle_color ? parseInt ( free_space_colors [ 1 ] ) / 255 : 1 ;
222+ const free_space_color_b = this . use_own_circle_color ? parseInt ( free_space_colors [ 2 ] ) / 255 : 1 ;
223+ const free_space_color_a = this . use_own_circle_color ? ( free_space_colors . length >= 4 ? parseFloat ( free_space_colors [ 3 ] ) : 1.0 ) : 0.2 ;
224+
216225 if ( design == "thin" ) {
226+ if ( this . fill_circle_background ) {
227+ const bg_fill_colors = this . fill_circle_background_color . match ( / \( ( .* ?) \) / ) [ 1 ] . split ( "," ) ;
228+ const bg_fill_r = parseInt ( bg_fill_colors [ 0 ] ) / 255 ;
229+ const bg_fill_g = parseInt ( bg_fill_colors [ 1 ] ) / 255 ;
230+ const bg_fill_b = parseInt ( bg_fill_colors [ 2 ] ) / 255 ;
231+ const bg_fill_a = bg_fill_colors . length >= 4 ? parseFloat ( bg_fill_colors [ 3 ] ) : 1.0 ;
232+ cr . setSourceRGBA ( bg_fill_r , bg_fill_g , bg_fill_b , bg_fill_a ) ;
233+ cr . arc ( 0 , 0 , 0.45 - ( 0.045 / 2 ) , 0 , Math . PI * 2 ) ;
234+ cr . fill ( ) ;
235+ }
217236 if ( drawFreeSpace ) {
218- cr . setSourceRGBA ( 1 , 1 , 1 , 0.2 ) ;
237+ cr . setSourceRGBA ( free_space_color_r , free_space_color_g , free_space_color_b , free_space_color_a ) ;
219238 cr . setLineWidth ( 0.045 ) ;
220239 cr . arc ( 0 , 0 , 0.45 , 0 , Math . PI * 2 ) ;
221240 cr . stroke ( ) ;
@@ -229,7 +248,7 @@ MyDesklet.prototype = {
229248 }
230249 } else if ( design == "compact" ) {
231250 if ( drawFreeSpace ) {
232- cr . setSourceRGBA ( 1 , 1 , 1 , 0.2 ) ;
251+ cr . setSourceRGBA ( free_space_color_r , free_space_color_g , free_space_color_b , free_space_color_a ) ;
233252 cr . setLineWidth ( 0.4 ) ;
234253 cr . arc ( 0 , 0 , 0.2 , 0 , Math . PI * 2 ) ;
235254 cr . stroke ( ) ;
@@ -241,8 +260,18 @@ MyDesklet.prototype = {
241260 cr . stroke ( ) ;
242261 }
243262 } else { // classic design
263+ if ( this . fill_circle_background ) {
264+ const bg_fill_colors = this . fill_circle_background_color . match ( / \( ( .* ?) \) / ) [ 1 ] . split ( "," ) ;
265+ const bg_fill_r = parseInt ( bg_fill_colors [ 0 ] ) / 255 ;
266+ const bg_fill_g = parseInt ( bg_fill_colors [ 1 ] ) / 255 ;
267+ const bg_fill_b = parseInt ( bg_fill_colors [ 2 ] ) / 255 ;
268+ const bg_fill_a = bg_fill_colors . length >= 4 ? parseFloat ( bg_fill_colors [ 3 ] ) : 1.0 ;
269+ cr . setSourceRGBA ( bg_fill_r , bg_fill_g , bg_fill_b , bg_fill_a ) ;
270+ cr . arc ( 0 , 0 , 0.4 - ( 0.19 / 2 ) , 0 , Math . PI * 2 ) ;
271+ cr . fill ( ) ;
272+ }
244273 if ( drawFreeSpace ) {
245- cr . setSourceRGBA ( 1 , 1 , 1 , 0.2 ) ;
274+ cr . setSourceRGBA ( free_space_color_r , free_space_color_g , free_space_color_b , free_space_color_a ) ;
246275 cr . setLineWidth ( 0.19 ) ;
247276 cr . arc ( 0 , 0 , 0.4 , 0 , Math . PI * 2 ) ;
248277 cr . stroke ( ) ;
0 commit comments