Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 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
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,8 @@ SystemMonitorGraph.prototype = {
let down_speed_formatted = this.format_network_speed(this.net_down_speed);
let up_speed_formatted = this.format_network_speed(this.net_up_speed);

text2 = "↓ " + down_speed_formatted;
text3 = "↑ " + up_speed_formatted;
text2 = "";
text3 = "↓ " + down_speed_formatted + " ↑ " + up_speed_formatted;
break;
}

Expand Down Expand Up @@ -389,19 +389,11 @@ SystemMonitorGraph.prototype = {
Math.round((2.5 * unit_size) - this.text2.get_height())
);
this.text3.set_text(text3);
if (this.type !== "network") {
this.text3.style = "font-size: " + text3_size + "px;"
+ "color: " + this.text_color + ";";
this.text3.set_position(
Math.round((21 * unit_size) - this.text3.get_width()),
Math.round((2.5 * unit_size) - this.text3.get_height()));
} else {
this.text3.style = "font-size: " + text2_size + "px;"
+ "color: " + this.text_color + ";";
this.text3.set_position(
Math.round(this.text1.get_width() + (9 * unit_size)),
Math.round((2.5 * unit_size) - this.text3.get_height()));
}
this.text3.style = "font-size: " + text3_size + "px;"
+ "color: " + this.text_color + ";";
this.text3.set_position(
Math.round((21 * unit_size) - this.text3.get_width()),
Math.round((2.5 * unit_size) - this.text3.get_height()));


// update canvas
Expand Down Expand Up @@ -522,15 +514,34 @@ SystemMonitorGraph.prototype = {
format_network_speed: function(speed_bytes_per_sec) {
// Enhanced error handling for speed formatting
if (!speed_bytes_per_sec || isNaN(speed_bytes_per_sec) || !isFinite(speed_bytes_per_sec) || speed_bytes_per_sec < 0) {
return "0 " + _("B") + "/s";
if (this.data_prefix_network == 2) {
return "0 " + _("b") + "/s";
} else {
return "0 " + _("B") + "/s";
}
}

// Convert bytes per second to appropriate units
let speed = speed_bytes_per_sec;
let unit = "";

if (this.data_prefix_network == 1) {
// Decimal prefix (1000-based)
if (this.data_prefix_network == 2) {
// Decimal prefix (1000-based) bit
speed = speed * 8;
if (speed >= 1000000000) {
speed = speed / 1000000000;
unit = _("Gb") + "/s";
} else if (speed >= 1000000) {
speed = speed / 1000000;
unit = _("Mb") + "/s";
} else if (speed >= 1000) {
speed = speed / 1000;
unit = _("Kb") + "/s";
} else {
unit = _("b") + "/s";
}
} else if (this.data_prefix_network == 1) {
// Decimal prefix (1000-based) bytes
if (speed >= 1000000000) {
speed = speed / 1000000000;
unit = _("GB") + "/s";
Expand All @@ -544,7 +555,7 @@ SystemMonitorGraph.prototype = {
unit = _("B") + "/s";
}
} else {
// Binary prefix (1024-based)
// Binary prefix (1024-based) bytes
if (speed >= 1073741824) { // 1024^3
speed = speed / 1073741824;
unit = _("GiB") + "/s";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ msgstr "Einheiten-Präfix für Swap-Größe."
#. settings-schema.json->network-interface->description
#, fuzzy
msgid "Network interface to monitor"
msgstr "Wählen Sie die anzuzeigende GPU-Variable."
msgstr "Zu überwachendes Netzwerkinterface"

#. settings-schema.json->network-interface->tooltip
msgid ""
Expand Down Expand Up @@ -348,12 +348,12 @@ msgstr "GPU-Linienfarbe"
#. settings-schema.json->line-color-network-down->description
#, fuzzy
msgid "Line color Network Download"
msgstr "Swap-Linienfarbe"
msgstr "Netzwerk-Download-Linienfarbe"

#. settings-schema.json->line-color-network-up->description
#, fuzzy
msgid "Line color Network Upload"
msgstr "Swap-Linienfarbe"
msgstr "Netzwerk-Upload-Linienfarbe"

#. settings-schema.json->midline-color->description
msgid "Grid color"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,9 @@
"type": "combobox",
"default": 0,
"options": {
"Binary prefix or IEC (1 KiB = 1024 bytes)" : 0,
"Decimal prefix (1 KB = 1000 bytes)" : 1
"Bytes - Binary prefix or IEC (1 KiB = 1024 bytes)" : 0,
"Bytes - Decimal prefix (1 KB = 1000 bytes)" : 1,
"Bits - Decimal prefix (1 Kb = 1000 bits)" : 2
},
"description": "Prefix for data units",
"tooltip": "Unit prefix for network speed.",
Expand Down