@@ -133,6 +133,28 @@ const ResourceMonitor = GObject.registerClass(
133
133
this . _path = path ;
134
134
this . _metadata = metadata ;
135
135
136
+ this . _themeContext = St . ThemeContext . get_for_stage ( global . stage ) ;
137
+ this . _scaleFactor = 1 ;
138
+ this . _themeContextHandlerId = this . _themeContext . connect ( 'notify::scale-factor' , ( ) => {
139
+ this . _onScaleFactorChanged ( ) ;
140
+
141
+ console . error ( `Resource ${ this . _scaleFactor } ` )
142
+
143
+ this . _cpuWidthChanged ( ) ;
144
+ this . _cpuFrequencyWidthChanged ( ) ;
145
+ this . _cpuLoadAverageWidthChanged ( ) ;
146
+ this . _ramWidthChanged ( ) ;
147
+ this . _swapWidthChanged ( ) ;
148
+ this . _diskStatsWidthChanged ( ) ;
149
+ this . _diskSpaceWidthChanged ( ) ;
150
+ this . _netEthWidthChanged ( ) ;
151
+ this . _netWlanWidthChanged ( ) ;
152
+ this . _thermalCpuTemperatureWidthChanged ( ) ;
153
+ this . _thermalGpuTemperatureWidthChanged ( ) ;
154
+ this . _gpuWidthChanged ( )
155
+ } ) ;
156
+ this . _onScaleFactorChanged ( ) ;
157
+
136
158
// Variables
137
159
this . _handlerIds = [ ] ;
138
160
this . _handlerIdsCount = 0 ;
@@ -240,6 +262,8 @@ const ResourceMonitor = GObject.registerClass(
240
262
this . _handlerIds [ i ] = 0 ;
241
263
}
242
264
265
+ this . themeContext . disconnect ( this . _themeContextHandlerId ) ;
266
+
243
267
super . destroy ( ) ;
244
268
}
245
269
@@ -340,19 +364,25 @@ const ResourceMonitor = GObject.registerClass(
340
364
y_align : Clutter . ActorAlign . CENTER ,
341
365
text : "--" ,
342
366
} ) ;
343
- this . _cpuValue . set_style ( "text-align: right;" ) ;
367
+ this . _cpuValue . clutter_text . set ( {
368
+ x_align : Clutter . ActorAlign . END ,
369
+ } ) ;
344
370
345
371
this . _ramValue = new St . Label ( {
346
372
y_align : Clutter . ActorAlign . CENTER ,
347
373
text : "--" ,
348
374
} ) ;
349
- this . _ramValue . set_style ( "text-align: right;" ) ;
375
+ this . _ramValue . clutter_text . set ( {
376
+ x_align : Clutter . ActorAlign . END ,
377
+ } ) ;
350
378
351
379
this . _swapValue = new St . Label ( {
352
380
y_align : Clutter . ActorAlign . CENTER ,
353
381
text : "--" ,
354
382
} ) ;
355
- this . _swapValue . set_style ( "text-align: right;" ) ;
383
+ this . _swapValue . clutter_text . set ( {
384
+ x_align : Clutter . ActorAlign . END ,
385
+ } ) ;
356
386
357
387
this . _diskStatsBox = new DiskContainerStats ( ) ;
358
388
this . _diskSpaceBox = new DiskContainerSpace ( ) ;
@@ -361,39 +391,65 @@ const ResourceMonitor = GObject.registerClass(
361
391
y_align : Clutter . ActorAlign . CENTER ,
362
392
text : "--|--" ,
363
393
} ) ;
364
- this . _ethValue . set_style ( "text-align: right;" ) ;
394
+ this . _ethValue . clutter_text . set ( {
395
+ x_align : Clutter . ActorAlign . END ,
396
+ } ) ;
365
397
366
398
this . _wlanValue = new St . Label ( {
367
399
y_align : Clutter . ActorAlign . CENTER ,
368
400
text : "--|--" ,
369
401
} ) ;
370
- this . _wlanValue . set_style ( "text-align: right;" ) ;
402
+ this . _wlanValue . clutter_text . set ( {
403
+ x_align : Clutter . ActorAlign . END ,
404
+ } ) ;
371
405
406
+ this . _cpuTemperatureBracketStart = new St . Label ( {
407
+ y_align : Clutter . ActorAlign . CENTER ,
408
+ text : "[" ,
409
+ } ) ;
372
410
this . _cpuTemperatureValue = new St . Label ( {
373
411
y_align : Clutter . ActorAlign . CENTER ,
374
- text : "[ --" ,
412
+ text : "--" ,
375
413
} ) ;
376
- this . _cpuTemperatureValueBracket = new St . Label ( {
414
+ this . _cpuTemperatureValue . clutter_text . set ( {
415
+ x_align : Clutter . ActorAlign . END ,
416
+ } ) ;
417
+ this . _cpuTemperatureBracketEnd = new St . Label ( {
377
418
y_align : Clutter . ActorAlign . CENTER ,
378
419
text : "]" ,
379
420
} ) ;
380
- this . _cpuTemperatureValue . set_style ( "text-align: right;" ) ;
381
421
422
+ this . _cpuFrequencyBracketStart = new St . Label ( {
423
+ y_align : Clutter . ActorAlign . CENTER ,
424
+ text : "[" ,
425
+ } ) ;
382
426
this . _cpuFrequencyValue = new St . Label ( {
383
427
y_align : Clutter . ActorAlign . CENTER ,
384
- text : "[--" ,
428
+ text : "--" ,
429
+ } ) ;
430
+ this . _cpuFrequencyValue . clutter_text . set ( {
431
+ x_align : Clutter . ActorAlign . END ,
385
432
} ) ;
386
- this . _cpuFrequencyValueBracket = new St . Label ( {
433
+ this . _cpuFrequencyBracketEnd = new St . Label ( {
387
434
y_align : Clutter . ActorAlign . CENTER ,
388
435
text : "]" ,
389
436
} ) ;
390
- this . _cpuFrequencyValue . set_style ( "text-align: right;" ) ;
391
437
438
+ this . _cpuLoadAverageBracketStart = new St . Label ( {
439
+ y_align : Clutter . ActorAlign . CENTER ,
440
+ text : "[" ,
441
+ } ) ;
392
442
this . _cpuLoadAverageValue = new St . Label ( {
393
443
y_align : Clutter . ActorAlign . CENTER ,
394
- text : "[--]" ,
444
+ text : "--" ,
445
+ } ) ;
446
+ this . _cpuLoadAverageValue . clutter_text . set ( {
447
+ x_align : Clutter . ActorAlign . END ,
448
+ } ) ;
449
+ this . _cpuLoadAverageBracketEnd = new St . Label ( {
450
+ y_align : Clutter . ActorAlign . CENTER ,
451
+ text : "]" ,
395
452
} ) ;
396
- this . _cpuLoadAverageValue . set_style ( "text-align: right;" ) ;
397
453
398
454
this . _gpuBox = new GpuContainer ( ) ;
399
455
}
@@ -411,13 +467,17 @@ const ResourceMonitor = GObject.registerClass(
411
467
this . _box . add_child ( this . _cpuValue ) ;
412
468
this . _box . add_child ( this . _cpuUnit ) ;
413
469
470
+ this . _box . add_child ( this . _cpuTemperatureBracketStart ) ;
414
471
this . _box . add_child ( this . _cpuTemperatureValue ) ;
415
472
this . _box . add_child ( this . _cpuTemperatureUnit ) ;
416
- this . _box . add_child ( this . _cpuTemperatureValueBracket ) ;
473
+ this . _box . add_child ( this . _cpuTemperatureBracketEnd ) ;
474
+ this . _box . add_child ( this . _cpuFrequencyBracketStart ) ;
417
475
this . _box . add_child ( this . _cpuFrequencyValue ) ;
418
476
this . _box . add_child ( this . _cpuFrequencyUnit ) ;
419
- this . _box . add_child ( this . _cpuFrequencyValueBracket ) ;
477
+ this . _box . add_child ( this . _cpuFrequencyBracketEnd ) ;
478
+ this . _box . add_child ( this . _cpuLoadAverageBracketStart ) ;
420
479
this . _box . add_child ( this . _cpuLoadAverageValue ) ;
480
+ this . _box . add_child ( this . _cpuLoadAverageBracketEnd ) ;
421
481
422
482
break ;
423
483
@@ -483,13 +543,17 @@ const ResourceMonitor = GObject.registerClass(
483
543
this . _box . add_child ( this . _cpuValue ) ;
484
544
this . _box . add_child ( this . _cpuUnit ) ;
485
545
546
+ this . _box . add_child ( this . _cpuTemperatureBracketStart ) ;
486
547
this . _box . add_child ( this . _cpuTemperatureValue ) ;
487
548
this . _box . add_child ( this . _cpuTemperatureUnit ) ;
488
- this . _box . add_child ( this . _cpuTemperatureValueBracket ) ;
549
+ this . _box . add_child ( this . _cpuTemperatureBracketEnd ) ;
550
+ this . _box . add_child ( this . _cpuFrequencyBracketStart ) ;
489
551
this . _box . add_child ( this . _cpuFrequencyValue ) ;
490
552
this . _box . add_child ( this . _cpuFrequencyUnit ) ;
491
- this . _box . add_child ( this . _cpuFrequencyValueBracket ) ;
553
+ this . _box . add_child ( this . _cpuFrequencyBracketEnd ) ;
554
+ this . _box . add_child ( this . _cpuLoadAverageBracketStart ) ;
492
555
this . _box . add_child ( this . _cpuLoadAverageValue ) ;
556
+ this . _box . add_child ( this . _cpuLoadAverageBracketEnd ) ;
493
557
this . _box . add_child ( this . _cpuIcon ) ;
494
558
495
559
break ;
@@ -564,23 +628,23 @@ const ResourceMonitor = GObject.registerClass(
564
628
this . _itemsPosition = this . _settings . get_strv ( ITEMS_POSITION ) ;
565
629
566
630
this . _cpuStatus = this . _settings . get_boolean ( CPU_STATUS ) ;
567
- this . _cpuWidth = this . _settings . get_int ( CPU_WIDTH ) ;
631
+ this . _cpuWidth = this . _settings . get_int ( CPU_WIDTH ) * this . _scaleFactor ;
568
632
this . _cpuColors = this . _settings . get_strv ( CPU_COLORS ) ;
569
633
this . _cpuFrequencyStatus =
570
634
this . _settings . get_boolean ( CPU_FREQUENCY_STATUS ) ;
571
- this . _cpuFrequencyWidth = this . _settings . get_int ( CPU_FREQUENCY_WIDTH ) ;
635
+ this . _cpuFrequencyWidth = this . _settings . get_int ( CPU_FREQUENCY_WIDTH ) * this . _scaleFactor ;
572
636
this . _cpuFrequencyColors = this . _settings . get_strv ( CPU_FREQUENCY_COLORS ) ;
573
637
this . _cpuFrequencyUnitMeasure = this . _settings . get_string (
574
638
CPU_FREQUENCY_UNIT_MEASURE
575
639
) ;
576
640
this . _cpuLoadAverageStatus = this . _settings . get_boolean (
577
641
CPU_LOADAVERAGE_STATUS
578
642
) ;
579
- this . _cpuLoadAverageWidth = this . _settings . get_int ( CPU_LOADAVERAGE_WIDTH ) ;
643
+ this . _cpuLoadAverageWidth = this . _settings . get_int ( CPU_LOADAVERAGE_WIDTH ) * this . _scaleFactor ;
580
644
this . _cpuLoadAverageColors = this . _settings . get_strv ( CPU_LOADAVERAGE_COLORS ) ;
581
645
582
646
this . _ramStatus = this . _settings . get_boolean ( RAM_STATUS ) ;
583
- this . _ramWidth = this . _settings . get_int ( RAM_WIDTH ) ;
647
+ this . _ramWidth = this . _settings . get_int ( RAM_WIDTH ) * this . _scaleFactor ;
584
648
this . _ramColors = this . _settings . get_strv ( RAM_COLORS ) ;
585
649
this . _ramUnitType = this . _settings . get_string ( RAM_UNIT ) ;
586
650
this . _ramUnitMeasure = this . _settings . get_string ( RAM_UNIT_MEASURE ) ;
@@ -589,7 +653,7 @@ const ResourceMonitor = GObject.registerClass(
589
653
this . _ramAlertThreshold = this . _settings . get_int ( RAM_ALERT_THRESHOLD ) ;
590
654
591
655
this . _swapStatus = this . _settings . get_boolean ( SWAP_STATUS ) ;
592
- this . _swapWidth = this . _settings . get_int ( SWAP_WIDTH ) ;
656
+ this . _swapWidth = this . _settings . get_int ( SWAP_WIDTH ) * this . _scaleFactor ;
593
657
this . _swapColors = this . _settings . get_strv ( SWAP_COLORS ) ;
594
658
this . _swapUnitType = this . _settings . get_string ( SWAP_UNIT ) ;
595
659
this . _swapUnitMeasure = this . _settings . get_string ( SWAP_UNIT_MEASURE ) ;
@@ -598,14 +662,14 @@ const ResourceMonitor = GObject.registerClass(
598
662
this . _swapAlertThreshold = this . _settings . get_int ( SWAP_ALERT_THRESHOLD ) ;
599
663
600
664
this . _diskStatsStatus = this . _settings . get_boolean ( DISK_STATS_STATUS ) ;
601
- this . _diskStatsWidth = this . _settings . get_int ( DISK_STATS_WIDTH ) ;
665
+ this . _diskStatsWidth = this . _settings . get_int ( DISK_STATS_WIDTH ) * this . _scaleFactor ;
602
666
this . _diskStatsColors = this . _settings . get_strv ( DISK_STATS_COLORS ) ;
603
667
this . _diskStatsMode = this . _settings . get_string ( DISK_STATS_MODE ) ;
604
668
this . _diskStatsUnitMeasure = this . _settings . get_string (
605
669
DISK_STATS_UNIT_MEASURE
606
670
) ;
607
671
this . _diskSpaceStatus = this . _settings . get_boolean ( DISK_SPACE_STATUS ) ;
608
- this . _diskSpaceWidth = this . _settings . get_int ( DISK_SPACE_WIDTH ) ;
672
+ this . _diskSpaceWidth = this . _settings . get_int ( DISK_SPACE_WIDTH ) * this . _scaleFactor ;
609
673
this . _diskSpaceColors = this . _settings . get_strv ( DISK_SPACE_COLORS ) ;
610
674
this . _diskSpaceUnitType = this . _settings . get_string ( DISK_SPACE_UNIT ) ;
611
675
this . _diskSpaceUnitMeasure = this . _settings . get_string (
@@ -620,10 +684,10 @@ const ResourceMonitor = GObject.registerClass(
620
684
this . _netUnit = this . _settings . get_string ( NET_UNIT ) ;
621
685
this . _netUnitMeasure = this . _settings . get_string ( NET_UNIT_MEASURE ) ;
622
686
this . _netEthStatus = this . _settings . get_boolean ( NET_ETH_STATUS ) ;
623
- this . _netEthWidth = this . _settings . get_int ( NET_ETH_WIDTH ) ;
687
+ this . _netEthWidth = this . _settings . get_int ( NET_ETH_WIDTH ) * this . _scaleFactor ;
624
688
this . _netEthColors = this . _settings . get_strv ( NET_ETH_COLORS ) ;
625
689
this . _netWlanStatus = this . _settings . get_boolean ( NET_WLAN_STATUS ) ;
626
- this . _netWlanWidth = this . _settings . get_int ( NET_WLAN_WIDTH ) ;
690
+ this . _netWlanWidth = this . _settings . get_int ( NET_WLAN_WIDTH ) * this . _scaleFactor ;
627
691
this . _netWlanColors = this . _settings . get_strv ( NET_WLAN_COLORS ) ;
628
692
629
693
this . _thermalTemperatureUnit = this . _settings . get_string (
@@ -634,7 +698,7 @@ const ResourceMonitor = GObject.registerClass(
634
698
) ;
635
699
this . _thermalCpuTemperatureWidth = this . _settings . get_int (
636
700
THERMAL_CPU_TEMPERATURE_WIDTH
637
- ) ;
701
+ ) * this . _scaleFactor ;
638
702
this . _thermalCpuColors = this . _settings . get_strv ( THERMAL_CPU_COLORS ) ;
639
703
this . _thermalCpuTemperatureDevicesList = this . _settings . get_strv (
640
704
THERMAL_CPU_TEMPERATURE_DEVICES_LIST
@@ -644,14 +708,14 @@ const ResourceMonitor = GObject.registerClass(
644
708
) ;
645
709
this . _thermalGpuTemperatureWidth = this . _settings . get_int (
646
710
THERMAL_GPU_TEMPERATURE_WIDTH
647
- ) ;
711
+ ) * this . _scaleFactor ;
648
712
this . _thermalGpuColors = this . _settings . get_strv ( THERMAL_GPU_COLORS ) ;
649
713
this . _thermalGpuTemperatureDevicesList = this . _settings . get_strv (
650
714
THERMAL_GPU_TEMPERATURE_DEVICES_LIST
651
715
) ;
652
716
653
717
this . _gpuStatus = this . _settings . get_boolean ( GPU_STATUS ) ;
654
- this . _gpuWidth = this . _settings . get_int ( GPU_WIDTH ) ;
718
+ this . _gpuWidth = this . _settings . get_int ( GPU_WIDTH ) * this . _scaleFactor ;
655
719
this . _gpuColors = this . _settings . get_strv ( GPU_COLORS ) ;
656
720
this . _gpuMemoryColors = this . _settings . get_strv ( GPU_MEMORY_COLORS ) ;
657
721
this . _gpuMemoryUnitType = this . _settings . get_string ( GPU_MEMORY_UNIT ) ;
@@ -966,6 +1030,10 @@ const ResourceMonitor = GObject.registerClass(
966
1030
}
967
1031
968
1032
// HANDLERS
1033
+ _onScaleFactorChanged ( ) {
1034
+ this . _scaleFactor = St . ThemeContext . get_for_stage ( global . stage ) . scale_factor
1035
+ }
1036
+
969
1037
_clickManager ( actor , event ) {
970
1038
switch ( event . get_button ( ) ) {
971
1039
case 3 : // Right Click
@@ -1190,7 +1258,7 @@ const ResourceMonitor = GObject.registerClass(
1190
1258
_cpuWidthChanged ( ) {
1191
1259
this . _cpuWidth = this . _settings . get_int ( CPU_WIDTH ) ;
1192
1260
1193
- this . _basicItemWidth ( this . _cpuWidth , this . _cpuValue ) ;
1261
+ this . _basicItemWidth ( this . _cpuWidth * this . _scaleFactor , this . _cpuValue ) ;
1194
1262
}
1195
1263
1196
1264
_cpuColorsChanged ( ) {
@@ -1213,14 +1281,15 @@ const ResourceMonitor = GObject.registerClass(
1213
1281
this . _cpuIcon ,
1214
1282
this . _cpuFrequencyValue ,
1215
1283
this . _cpuFrequencyUnit ,
1216
- this . _cpuFrequencyValueBracket
1284
+ this . _cpuFrequencyBracketStart ,
1285
+ this . _cpuFrequencyBracketEnd
1217
1286
) ;
1218
1287
}
1219
1288
1220
1289
_cpuFrequencyWidthChanged ( ) {
1221
1290
this . _cpuFrequencyWidth = this . _settings . get_int ( CPU_FREQUENCY_WIDTH ) ;
1222
1291
1223
- this . _basicItemWidth ( this . _cpuFrequencyWidth , this . _cpuFrequencyValue ) ;
1292
+ this . _basicItemWidth ( this . _cpuFrequencyWidth * this . _scaleFactor , this . _cpuFrequencyValue ) ;
1224
1293
}
1225
1294
1226
1295
_cpuFrequencyColorsChanged ( ) {
@@ -1252,15 +1321,17 @@ const ResourceMonitor = GObject.registerClass(
1252
1321
! this . _thermalCpuTemperatureStatus &&
1253
1322
! this . _cpuFrequencyStatus ,
1254
1323
this . _cpuIcon ,
1255
- this . _cpuLoadAverageValue
1324
+ this . _cpuLoadAverageValue ,
1325
+ this . _cpuLoadAverageBracketStart ,
1326
+ this . _cpuLoadAverageBracketEnd
1256
1327
) ;
1257
1328
}
1258
1329
1259
1330
_cpuLoadAverageWidthChanged ( ) {
1260
1331
this . _cpuLoadAverageWidth = this . _settings . get_int ( CPU_LOADAVERAGE_WIDTH ) ;
1261
1332
1262
1333
this . _basicItemWidth (
1263
- this . _cpuLoadAverageWidth ,
1334
+ this . _cpuLoadAverageWidth * this . _scaleFactor ,
1264
1335
this . _cpuLoadAverageValue
1265
1336
) ;
1266
1337
}
@@ -1288,7 +1359,7 @@ const ResourceMonitor = GObject.registerClass(
1288
1359
_ramWidthChanged ( ) {
1289
1360
this . _ramWidth = this . _settings . get_int ( RAM_WIDTH ) ;
1290
1361
1291
- this . _basicItemWidth ( this . _ramWidth , this . _ramValue ) ;
1362
+ this . _basicItemWidth ( this . _ramWidth * this . _scaleFactor , this . _ramValue ) ;
1292
1363
}
1293
1364
1294
1365
_ramColorsChanged ( ) {
@@ -1346,7 +1417,7 @@ const ResourceMonitor = GObject.registerClass(
1346
1417
_swapWidthChanged ( ) {
1347
1418
this . _swapWidth = this . _settings . get_int ( SWAP_WIDTH ) ;
1348
1419
1349
- this . _basicItemWidth ( this . _swapWidth , this . _swapValue ) ;
1420
+ this . _basicItemWidth ( this . _swapWidth * this . _scaleFactor , this . _swapValue ) ;
1350
1421
}
1351
1422
1352
1423
_swapColorsChanged ( ) {
@@ -1403,7 +1474,7 @@ const ResourceMonitor = GObject.registerClass(
1403
1474
_diskStatsWidthChanged ( ) {
1404
1475
this . _diskStatsWidth = this . _settings . get_int ( DISK_STATS_WIDTH ) ;
1405
1476
1406
- this . _diskStatsBox . set_element_width ( this . _diskStatsWidth ) ;
1477
+ this . _diskStatsBox . set_element_width ( this . _diskStatsWidth * this . _scaleFactor ) ;
1407
1478
}
1408
1479
1409
1480
_diskStatsColorsChanged ( ) {
@@ -1444,7 +1515,7 @@ const ResourceMonitor = GObject.registerClass(
1444
1515
_diskSpaceWidthChanged ( ) {
1445
1516
this . _diskSpaceWidth = this . _settings . get_int ( DISK_SPACE_WIDTH ) ;
1446
1517
1447
- this . _diskSpaceBox . set_element_width ( this . _diskSpaceWidth ) ;
1518
+ this . _diskSpaceBox . set_element_width ( this . _diskSpaceWidth * this . _scaleFactor ) ;
1448
1519
}
1449
1520
1450
1521
_diskSpaceColorsChanged ( ) {
@@ -1494,29 +1565,22 @@ const ResourceMonitor = GObject.registerClass(
1494
1565
const mountPoint = it [ 1 ] ;
1495
1566
const stats = it [ 2 ] === "true" ;
1496
1567
const space = it [ 3 ] === "true" ;
1497
-
1498
- let label = "" ;
1499
-
1500
- if ( filesystem . match ( / ( \/ \w + ) + / ) ) {
1501
- label = filesystem . split ( "/" ) . pop ( ) ;
1502
- } else {
1503
- label = filesystem ;
1504
- }
1568
+ const displayName = it [ 4 ] ;
1505
1569
1506
1570
if ( stats ) {
1507
- this . _diskStatsBox . add_element ( filesystem , label ) ;
1571
+ this . _diskStatsBox . add_element ( filesystem , displayName ) ;
1508
1572
}
1509
1573
1510
1574
if ( space ) {
1511
- this . _diskSpaceBox . add_element ( filesystem , label ) ;
1575
+ this . _diskSpaceBox . add_element ( filesystem , displayName ) ;
1512
1576
}
1513
1577
} ) ;
1514
1578
1515
1579
this . _diskStatsBox . add_single ( ) ;
1516
1580
this . _diskStatsBox . update_mode ( this . _diskStatsMode ) ;
1517
1581
1518
- this . _diskStatsBox . set_element_width ( this . _diskStatsWidth ) ;
1519
- this . _diskSpaceBox . set_element_width ( this . _diskSpaceWidth ) ;
1582
+ this . _diskStatsBox . set_element_width ( this . _diskStatsWidth * this . _scaleFactor ) ;
1583
+ this . _diskSpaceBox . set_element_width ( this . _diskSpaceWidth * this . _scaleFactor ) ;
1520
1584
}
1521
1585
1522
1586
_netAutoHideStatusChanged ( ) {
@@ -1580,7 +1644,7 @@ const ResourceMonitor = GObject.registerClass(
1580
1644
_netEthWidthChanged ( ) {
1581
1645
this . _netEthWidth = this . _settings . get_int ( NET_ETH_WIDTH ) ;
1582
1646
1583
- this . _basicItemWidth ( this . _netEthWidth , this . _ethValue ) ;
1647
+ this . _basicItemWidth ( this . _netEthWidth * this . _scaleFactor , this . _ethValue ) ;
1584
1648
}
1585
1649
1586
1650
_netEthColorsChanged ( ) {
@@ -1607,7 +1671,7 @@ const ResourceMonitor = GObject.registerClass(
1607
1671
_netWlanWidthChanged ( ) {
1608
1672
this . _netWlanWidth = this . _settings . get_int ( NET_WLAN_WIDTH ) ;
1609
1673
1610
- this . _basicItemWidth ( this . _netWlanWidth , this . _wlanValue ) ;
1674
+ this . _basicItemWidth ( this . _netWlanWidth * this . _scaleFactor , this . _wlanValue ) ;
1611
1675
}
1612
1676
1613
1677
_netWlanColorsChanged ( ) {
@@ -1631,7 +1695,8 @@ const ResourceMonitor = GObject.registerClass(
1631
1695
this . _cpuIcon ,
1632
1696
this . _cpuTemperatureValue ,
1633
1697
this . _cpuTemperatureUnit ,
1634
- this . _cpuTemperatureValueBracket
1698
+ this . _cpuTemperatureBracketStart ,
1699
+ this . _cpuTemperatureBracketEnd ,
1635
1700
) ;
1636
1701
}
1637
1702
@@ -1641,7 +1706,7 @@ const ResourceMonitor = GObject.registerClass(
1641
1706
) ;
1642
1707
1643
1708
this . _basicItemWidth (
1644
- this . _thermalCpuTemperatureWidth ,
1709
+ this . _thermalCpuTemperatureWidth * this . _scaleFactor ,
1645
1710
this . _cpuTemperatureValue
1646
1711
) ;
1647
1712
}
@@ -1693,7 +1758,7 @@ const ResourceMonitor = GObject.registerClass(
1693
1758
THERMAL_GPU_TEMPERATURE_WIDTH
1694
1759
) ;
1695
1760
1696
- this . _gpuBox . set_element_thermal_width ( this . _thermalGpuTemperatureWidth ) ;
1761
+ this . _gpuBox . set_element_thermal_width ( this . _thermalGpuTemperatureWidth * this . _scaleFactor ) ;
1697
1762
}
1698
1763
1699
1764
_thermalGpuColorsChanged ( ) {
@@ -1727,7 +1792,7 @@ const ResourceMonitor = GObject.registerClass(
1727
1792
_gpuWidthChanged ( ) {
1728
1793
this . _gpuWidth = this . _settings . get_int ( GPU_WIDTH ) ;
1729
1794
1730
- this . _gpuBox . set_element_width ( this . _gpuWidth ) ;
1795
+ this . _gpuBox . set_element_width ( this . _gpuWidth * this . _scaleFactor ) ;
1731
1796
}
1732
1797
1733
1798
_gpuColorsChanged ( ) {
@@ -1789,9 +1854,10 @@ const ResourceMonitor = GObject.registerClass(
1789
1854
const it = element . split ( GPU_DEVICES_LIST_SEPARATOR ) ;
1790
1855
1791
1856
const uuid = it [ 0 ] ;
1792
- const name = this . _gpuDisplayDeviceName ? it [ 1 ] : null ;
1857
+ const name = it [ 1 ] ;
1793
1858
const usage = it [ 2 ] === "true" && this . _gpuStatus ;
1794
1859
const memory = it [ 3 ] === "true" && this . _gpuStatus ;
1860
+ const displayName = this . _gpuDisplayDeviceName ? it [ 4 ] : null
1795
1861
let thermal = false ;
1796
1862
1797
1863
if ( this . _thermalGpuTemperatureStatus ) {
@@ -1804,10 +1870,10 @@ const ResourceMonitor = GObject.registerClass(
1804
1870
} ) ;
1805
1871
}
1806
1872
1807
- this . _gpuBox . add_element ( uuid , name , usage , memory , thermal ) ;
1873
+ this . _gpuBox . add_element ( uuid , displayName , usage , memory , thermal ) ;
1808
1874
} ) ;
1809
1875
1810
- this . _gpuBox . set_element_width ( this . _gpuWidth ) ;
1876
+ this . _gpuBox . set_element_width ( this . _gpuWidth * this . _scaleFactor ) ;
1811
1877
}
1812
1878
1813
1879
_refreshHandler ( ) {
@@ -3052,9 +3118,9 @@ const ResourceMonitor = GObject.registerClass(
3052
3118
}
3053
3119
3054
3120
if ( this . _decimalsStatus ) {
3055
- this . _cpuFrequencyValue . text = `[ ${ value . toFixed ( 2 ) } ` ;
3121
+ this . _cpuFrequencyValue . text = `${ value . toFixed ( 2 ) } ` ;
3056
3122
} else {
3057
- this . _cpuFrequencyValue . text = `[ ${ value . toFixed ( 0 ) } ` ;
3123
+ this . _cpuFrequencyValue . text = `${ value . toFixed ( 0 ) } ` ;
3058
3124
}
3059
3125
} ) ;
3060
3126
}
@@ -3083,7 +3149,7 @@ const ResourceMonitor = GObject.registerClass(
3083
3149
this . _cpuLoadAverageValue . style = "" ;
3084
3150
}
3085
3151
3086
- this . _cpuLoadAverageValue . text = "[" + l0 + " " + l1 + " " + l2 + "]" ;
3152
+ this . _cpuLoadAverageValue . text = ` ${ l0 } ${ l1 } ${ l2 } ` ;
3087
3153
} ) ;
3088
3154
}
3089
3155
@@ -3150,11 +3216,11 @@ const ResourceMonitor = GObject.registerClass(
3150
3216
}
3151
3217
3152
3218
if ( this . _decimalsStatus ) {
3153
- this . _cpuTemperatureValue . text = `[ ${ this . _cpuTemperatures . toFixed (
3219
+ this . _cpuTemperatureValue . text = `${ this . _cpuTemperatures . toFixed (
3154
3220
1
3155
3221
) } `;
3156
3222
} else {
3157
- this . _cpuTemperatureValue . text = `[ ${ this . _cpuTemperatures . toFixed (
3223
+ this . _cpuTemperatureValue . text = `${ this . _cpuTemperatures . toFixed (
3158
3224
0
3159
3225
) } `;
3160
3226
}
@@ -3164,12 +3230,12 @@ const ResourceMonitor = GObject.registerClass(
3164
3230
}
3165
3231
} ) ;
3166
3232
} else {
3167
- this . _cpuTemperatureValue . text = _ ( "[ Temperature Error" ) ;
3233
+ this . _cpuTemperatureValue . text = _ ( "Temperature Error" ) ;
3168
3234
this . _cpuTemperatureUnit . text = "" ;
3169
3235
}
3170
3236
}
3171
3237
} else {
3172
- this . _cpuTemperatureValue . text = _ ( "[ --" ) ;
3238
+ this . _cpuTemperatureValue . text = _ ( "--" ) ;
3173
3239
}
3174
3240
}
3175
3241
@@ -3337,7 +3403,7 @@ const ResourceMonitor = GObject.registerClass(
3337
3403
const item = this . _gpuMemoryColors [ i ] ;
3338
3404
const values = item . split ( COLOR_LIST_SEPARATOR ) ;
3339
3405
3340
- if ( usage <= parseFloat ( values [ 0 ] ) ) {
3406
+ if ( value <= parseFloat ( values [ 0 ] ) ) {
3341
3407
styleM = `color: rgb(${ ( parseFloat ( values [ 1 ] ) * 255 ) . toFixed ( 0 ) } , ${ ( parseFloat ( values [ 2 ] ) * 255 ) . toFixed ( 0 ) } , ${ ( parseFloat ( values [ 3 ] ) * 255 ) . toFixed ( 0 ) } );` ;
3342
3408
break ;
3343
3409
}
@@ -3352,7 +3418,7 @@ const ResourceMonitor = GObject.registerClass(
3352
3418
const item = this . _thermalGpuColors [ i ] ;
3353
3419
const values = item . split ( COLOR_LIST_SEPARATOR ) ;
3354
3420
3355
- if ( usage <= parseFloat ( values [ 0 ] ) ) {
3421
+ if ( valueT <= parseFloat ( values [ 0 ] ) ) {
3356
3422
styleT = `color: rgb(${ ( parseFloat ( values [ 1 ] ) * 255 ) . toFixed ( 0 ) } , ${ ( parseFloat ( values [ 2 ] ) * 255 ) . toFixed ( 0 ) } , ${ ( parseFloat ( values [ 3 ] ) * 255 ) . toFixed ( 0 ) } );` ;
3357
3423
break ;
3358
3424
}
@@ -3538,7 +3604,9 @@ const DiskContainerStats = GObject.registerClass(
3538
3604
y_align : Clutter . ActorAlign . CENTER ,
3539
3605
text : "--|--" ,
3540
3606
} ) ;
3541
- this . _elementsValue [ "single" ] . set_style ( "text-align: right;" ) ;
3607
+ this . _elementsValue [ "single" ] . clutter_text . set ( {
3608
+ x_align : Clutter . ActorAlign . END ,
3609
+ } ) ;
3542
3610
3543
3611
this . _elementsUnit [ "single" ] = new St . Label ( {
3544
3612
y_align : Clutter . ActorAlign . CENTER ,
@@ -3565,7 +3633,9 @@ const DiskContainerStats = GObject.registerClass(
3565
3633
y_align : Clutter . ActorAlign . CENTER ,
3566
3634
text : "--|--" ,
3567
3635
} ) ;
3568
- this . _elementsValue [ filesystem ] . set_style ( "text-align: right;" ) ;
3636
+ this . _elementsValue [ filesystem ] . clutter_text . set ( {
3637
+ x_align : Clutter . ActorAlign . END ,
3638
+ } ) ;
3569
3639
3570
3640
this . _elementsUnit [ filesystem ] = new St . Label ( {
3571
3641
y_align : Clutter . ActorAlign . CENTER ,
@@ -3659,7 +3729,9 @@ const DiskContainerSpace = GObject.registerClass(
3659
3729
y_align : Clutter . ActorAlign . CENTER ,
3660
3730
text : "--" ,
3661
3731
} ) ;
3662
- this . _elementsValue [ filesystem ] . set_style ( "text-align: right;" ) ;
3732
+ this . _elementsValue [ filesystem ] . clutter_text . set ( {
3733
+ x_align : Clutter . ActorAlign . END ,
3734
+ } ) ;
3663
3735
3664
3736
this . _elementsUnit [ filesystem ] = new St . Label ( {
3665
3737
y_align : Clutter . ActorAlign . CENTER ,
@@ -3776,7 +3848,9 @@ const GpuContainer = GObject.registerClass(
3776
3848
y_align : Clutter . ActorAlign . CENTER ,
3777
3849
text : "--" ,
3778
3850
} ) ;
3779
- this . _elementsValue [ uuid ] . set_style ( "text-align: right;" ) ;
3851
+ this . _elementsValue [ uuid ] . clutter_text . set ( {
3852
+ x_align : Clutter . ActorAlign . END ,
3853
+ } ) ;
3780
3854
3781
3855
this . _elementsUnit [ uuid ] = new St . Label ( {
3782
3856
y_align : Clutter . ActorAlign . CENTER ,
@@ -3806,7 +3880,9 @@ const GpuContainer = GObject.registerClass(
3806
3880
y_align : Clutter . ActorAlign . CENTER ,
3807
3881
text : "--" ,
3808
3882
} ) ;
3809
- this . _elementsMemoryValue [ uuid ] . set_style ( "text-align: right;" ) ;
3883
+ this . _elementsMemoryValue [ uuid ] . clutter_text . set ( {
3884
+ x_align : Clutter . ActorAlign . END ,
3885
+ } ) ;
3810
3886
3811
3887
this . _elementsMemoryUnit [ uuid ] = new St . Label ( {
3812
3888
y_align : Clutter . ActorAlign . CENTER ,
@@ -3836,7 +3912,9 @@ const GpuContainer = GObject.registerClass(
3836
3912
y_align : Clutter . ActorAlign . CENTER ,
3837
3913
text : "--" ,
3838
3914
} ) ;
3839
- this . _elementsThermalValue [ uuid ] . set_style ( "text-align: right;" ) ;
3915
+ this . _elementsThermalValue [ uuid ] . clutter_text . set ( {
3916
+ x_align : Clutter . ActorAlign . END ,
3917
+ } ) ;
3840
3918
3841
3919
this . _elementsThermalUnit [ uuid ] = new St . Label ( {
3842
3920
y_align : Clutter . ActorAlign . CENTER ,
@@ -3864,23 +3942,23 @@ const GpuContainer = GObject.registerClass(
3864
3942
update_element_value ( uuid , value , unit , style = "" ) {
3865
3943
if ( this . _elementsValue [ uuid ] ) {
3866
3944
this . _elementsValue [ uuid ] . text = value ;
3867
- this . _elementsValue [ filesystem ] . style = style ;
3945
+ this . _elementsValue [ uuid ] . style = style ;
3868
3946
this . _elementsUnit [ uuid ] . text = unit ;
3869
3947
}
3870
3948
}
3871
3949
3872
3950
update_element_memory_value ( uuid , value , unit , style = "" ) {
3873
3951
if ( this . _elementsMemoryValue [ uuid ] ) {
3874
3952
this . _elementsMemoryValue [ uuid ] . text = value ;
3875
- this . _elementsValue [ filesystem ] . style = style ;
3953
+ this . _elementsMemoryValue [ uuid ] . style = style ;
3876
3954
this . _elementsMemoryUnit [ uuid ] . text = unit ;
3877
3955
}
3878
3956
}
3879
3957
3880
3958
update_element_thermal_value ( uuid , value , unit , style = "" ) {
3881
3959
if ( this . _elementsThermalValue [ uuid ] ) {
3882
3960
this . _elementsThermalValue [ uuid ] . text = value ;
3883
- this . _elementsValue [ filesystem ] . style = style ;
3961
+ this . _elementsThermalValue [ uuid ] . style = style ;
3884
3962
this . _elementsThermalUnit [ uuid ] . text = unit ;
3885
3963
}
3886
3964
}
0 commit comments