diff --git a/RELEASES.md b/RELEASES.md index e3356d3..03bcc09 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -5,6 +5,8 @@ ### Bug fixes - Fixed graph and layout rendering in Gnome 46 alpha [[#40](https://github.com/AstraExt/astra-monitor/issues/40)] +- Fixed labels rendering for Dash To Panel and narrow panels [[#30](https://github.com/AstraExt/astra-monitor/issues/30)] [[#42](https://github.com/AstraExt/astra-monitor/issues/42)] +- Fixed sensors list column split when the list is too long [[#43](https://github.com/AstraExt/astra-monitor/issues/43)] # Astra Monitor 8 - January 25 2024 diff --git a/po/de.po b/po/de.po index b353c06..7748f6b 100644 --- a/po/de.po +++ b/po/de.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Astra Monitor 8\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-01-27 14:02+0100\n" +"POT-Creation-Date: 2024-01-28 16:14+0100\n" "PO-Revision-Date: 2024-01-21 12:11+0100\n" "Last-Translator: Philipp Kiemle \n" "Language-Team: \n" @@ -19,134 +19,134 @@ msgstr "" "Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Generator: Poedit 3.4.2\n" -#: src/processor/processorMenu.js:42 prefs.js:276 +#: src/processor/processorMenu.js:41 prefs.js:276 msgid "CPU" msgstr "CPU" -#: src/processor/processorMenu.js:115 +#: src/processor/processorMenu.js:103 msgid "CPU info" msgstr "CPU-Info" -#: src/processor/processorMenu.js:202 src/memory/memoryMenu.js:58 +#: src/processor/processorMenu.js:190 src/memory/memoryMenu.js:58 #: src/memory/memoryMenu.js:398 msgid "Total:" msgstr "Gesamt:" -#: src/processor/processorMenu.js:208 +#: src/processor/processorMenu.js:196 msgid "User:" msgstr "Benutzer:" -#: src/processor/processorMenu.js:214 +#: src/processor/processorMenu.js:202 msgid "System:" msgstr "System:" -#: src/processor/processorMenu.js:245 +#: src/processor/processorMenu.js:233 msgid "CPU Category Usage Raw Info" msgstr "" -#: src/processor/processorMenu.js:248 +#: src/processor/processorMenu.js:236 msgid "User" msgstr "Benutzer" -#: src/processor/processorMenu.js:256 +#: src/processor/processorMenu.js:244 msgid "Nice" msgstr "Nice" -#: src/processor/processorMenu.js:264 +#: src/processor/processorMenu.js:252 msgid "System" msgstr "System" -#: src/processor/processorMenu.js:272 +#: src/processor/processorMenu.js:260 msgid "Idle" msgstr "" -#: src/processor/processorMenu.js:280 +#: src/processor/processorMenu.js:268 msgid "I/O wait" msgstr "I/O wait" -#: src/processor/processorMenu.js:288 +#: src/processor/processorMenu.js:276 msgid "IRQ" msgstr "IRQ" -#: src/processor/processorMenu.js:296 +#: src/processor/processorMenu.js:284 msgid "Soft IRQ" msgstr "Soft IRQ" -#: src/processor/processorMenu.js:304 +#: src/processor/processorMenu.js:292 msgid "Steal" msgstr "" -#: src/processor/processorMenu.js:375 +#: src/processor/processorMenu.js:363 msgid "CPU Cores Usage Info" msgstr "" -#: src/processor/processorMenu.js:417 +#: src/processor/processorMenu.js:405 msgid "GHz" msgstr "GHz" -#: src/processor/processorMenu.js:434 src/processor/processorMenu.js:488 +#: src/processor/processorMenu.js:422 src/processor/processorMenu.js:476 #: src/storage/storageMenu.js:110 src/storage/storageMenu.js:224 #: src/memory/memoryMenu.js:262 src/memory/memoryMenu.js:320 msgid "Top processes" msgstr "" -#: src/processor/processorMenu.js:520 prefs.js:281 +#: src/processor/processorMenu.js:508 prefs.js:281 msgid "GPU" msgstr "GPU" -#: src/processor/processorMenu.js:532 +#: src/processor/processorMenu.js:520 msgid "No GPU found" msgstr "Keine GPU gefunden" -#: src/processor/processorMenu.js:545 +#: src/processor/processorMenu.js:533 msgid "GPUs" msgstr "GPUs" -#: src/processor/processorMenu.js:602 +#: src/processor/processorMenu.js:590 msgid "GPU info" msgstr "GPU-Info" -#: src/processor/processorMenu.js:610 +#: src/processor/processorMenu.js:598 msgid "Name" msgstr "Name" -#: src/processor/processorMenu.js:618 +#: src/processor/processorMenu.js:606 msgid "Subsystem" msgstr "Subsystem" -#: src/processor/processorMenu.js:629 +#: src/processor/processorMenu.js:617 msgid "Vendor" msgstr "Hersteller" -#: src/processor/processorMenu.js:638 +#: src/processor/processorMenu.js:626 msgid "Vendor ID" msgstr "Hersteller-ID" -#: src/processor/processorMenu.js:648 +#: src/processor/processorMenu.js:636 msgid "Product ID" msgstr "Produkt-ID" -#: src/processor/processorMenu.js:657 +#: src/processor/processorMenu.js:645 msgid "Domain" msgstr "Domain" -#: src/processor/processorMenu.js:665 +#: src/processor/processorMenu.js:653 msgid "Bus" msgstr "Bus" -#: src/processor/processorMenu.js:673 +#: src/processor/processorMenu.js:661 msgid "Slot" msgstr "Slot" -#: src/processor/processorMenu.js:682 +#: src/processor/processorMenu.js:670 msgid "Drivers" msgstr "Treiber" -#: src/processor/processorMenu.js:692 +#: src/processor/processorMenu.js:680 msgid "Modules" msgstr "Module" -#: src/processor/processorMenu.js:704 +#: src/processor/processorMenu.js:692 msgid "System uptime" msgstr "Systembetriebszeit" diff --git a/po/monitor@astraext.pot b/po/monitor@astraext.pot index 01e1263..49985db 100644 --- a/po/monitor@astraext.pot +++ b/po/monitor@astraext.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Astra Monitor 11\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-01-27 16:34+0100\n" +"POT-Creation-Date: 2024-01-28 16:14+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -18,134 +18,134 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" -#: src/processor/processorMenu.js:42 prefs.js:276 +#: src/processor/processorMenu.js:41 prefs.js:276 msgid "CPU" msgstr "" -#: src/processor/processorMenu.js:115 +#: src/processor/processorMenu.js:103 msgid "CPU info" msgstr "" -#: src/processor/processorMenu.js:202 src/memory/memoryMenu.js:58 +#: src/processor/processorMenu.js:190 src/memory/memoryMenu.js:58 #: src/memory/memoryMenu.js:398 msgid "Total:" msgstr "" -#: src/processor/processorMenu.js:208 +#: src/processor/processorMenu.js:196 msgid "User:" msgstr "" -#: src/processor/processorMenu.js:214 +#: src/processor/processorMenu.js:202 msgid "System:" msgstr "" -#: src/processor/processorMenu.js:245 +#: src/processor/processorMenu.js:233 msgid "CPU Category Usage Raw Info" msgstr "" -#: src/processor/processorMenu.js:248 +#: src/processor/processorMenu.js:236 msgid "User" msgstr "" -#: src/processor/processorMenu.js:256 +#: src/processor/processorMenu.js:244 msgid "Nice" msgstr "" -#: src/processor/processorMenu.js:264 +#: src/processor/processorMenu.js:252 msgid "System" msgstr "" -#: src/processor/processorMenu.js:272 +#: src/processor/processorMenu.js:260 msgid "Idle" msgstr "" -#: src/processor/processorMenu.js:280 +#: src/processor/processorMenu.js:268 msgid "I/O wait" msgstr "" -#: src/processor/processorMenu.js:288 +#: src/processor/processorMenu.js:276 msgid "IRQ" msgstr "" -#: src/processor/processorMenu.js:296 +#: src/processor/processorMenu.js:284 msgid "Soft IRQ" msgstr "" -#: src/processor/processorMenu.js:304 +#: src/processor/processorMenu.js:292 msgid "Steal" msgstr "" -#: src/processor/processorMenu.js:375 +#: src/processor/processorMenu.js:363 msgid "CPU Cores Usage Info" msgstr "" -#: src/processor/processorMenu.js:417 +#: src/processor/processorMenu.js:405 msgid "GHz" msgstr "" -#: src/processor/processorMenu.js:434 src/processor/processorMenu.js:488 +#: src/processor/processorMenu.js:422 src/processor/processorMenu.js:476 #: src/storage/storageMenu.js:110 src/storage/storageMenu.js:224 #: src/memory/memoryMenu.js:262 src/memory/memoryMenu.js:320 msgid "Top processes" msgstr "" -#: src/processor/processorMenu.js:520 prefs.js:281 +#: src/processor/processorMenu.js:508 prefs.js:281 msgid "GPU" msgstr "" -#: src/processor/processorMenu.js:532 +#: src/processor/processorMenu.js:520 msgid "No GPU found" msgstr "" -#: src/processor/processorMenu.js:545 +#: src/processor/processorMenu.js:533 msgid "GPUs" msgstr "" -#: src/processor/processorMenu.js:602 +#: src/processor/processorMenu.js:590 msgid "GPU info" msgstr "" -#: src/processor/processorMenu.js:610 +#: src/processor/processorMenu.js:598 msgid "Name" msgstr "" -#: src/processor/processorMenu.js:618 +#: src/processor/processorMenu.js:606 msgid "Subsystem" msgstr "" -#: src/processor/processorMenu.js:629 +#: src/processor/processorMenu.js:617 msgid "Vendor" msgstr "" -#: src/processor/processorMenu.js:638 +#: src/processor/processorMenu.js:626 msgid "Vendor ID" msgstr "" -#: src/processor/processorMenu.js:648 +#: src/processor/processorMenu.js:636 msgid "Product ID" msgstr "" -#: src/processor/processorMenu.js:657 +#: src/processor/processorMenu.js:645 msgid "Domain" msgstr "" -#: src/processor/processorMenu.js:665 +#: src/processor/processorMenu.js:653 msgid "Bus" msgstr "" -#: src/processor/processorMenu.js:673 +#: src/processor/processorMenu.js:661 msgid "Slot" msgstr "" -#: src/processor/processorMenu.js:682 +#: src/processor/processorMenu.js:670 msgid "Drivers" msgstr "" -#: src/processor/processorMenu.js:692 +#: src/processor/processorMenu.js:680 msgid "Modules" msgstr "" -#: src/processor/processorMenu.js:704 +#: src/processor/processorMenu.js:692 msgid "System uptime" msgstr "" diff --git a/po/ru.po b/po/ru.po index 3a16026..1630644 100644 --- a/po/ru.po +++ b/po/ru.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: AstraMonitor 1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-01-27 14:02+0100\n" +"POT-Creation-Date: 2024-01-28 16:14+0100\n" "PO-Revision-Date: 2024-01-22 12:09+0300\n" "Last-Translator: Aleksandr Melman \n" "Language-Team: ru\n" @@ -20,134 +20,134 @@ msgstr "" "n%10<=4 && (n%100<12 || n%100>14) ? 1 : 2);\n" "X-Generator: Poedit 3.4.2\n" -#: src/processor/processorMenu.js:42 prefs.js:276 +#: src/processor/processorMenu.js:41 prefs.js:276 msgid "CPU" msgstr "ЦП" -#: src/processor/processorMenu.js:115 +#: src/processor/processorMenu.js:103 msgid "CPU info" msgstr "Информация о ЦП" -#: src/processor/processorMenu.js:202 src/memory/memoryMenu.js:58 +#: src/processor/processorMenu.js:190 src/memory/memoryMenu.js:58 #: src/memory/memoryMenu.js:398 msgid "Total:" msgstr "Всего:" -#: src/processor/processorMenu.js:208 +#: src/processor/processorMenu.js:196 msgid "User:" msgstr "Пользователь:" -#: src/processor/processorMenu.js:214 +#: src/processor/processorMenu.js:202 msgid "System:" msgstr "Система:" -#: src/processor/processorMenu.js:245 +#: src/processor/processorMenu.js:233 msgid "CPU Category Usage Raw Info" msgstr "Информация о категории использования ЦП" -#: src/processor/processorMenu.js:248 +#: src/processor/processorMenu.js:236 msgid "User" msgstr "Пользователь" -#: src/processor/processorMenu.js:256 +#: src/processor/processorMenu.js:244 msgid "Nice" msgstr "Уступчивость" -#: src/processor/processorMenu.js:264 +#: src/processor/processorMenu.js:252 msgid "System" msgstr "Система" -#: src/processor/processorMenu.js:272 +#: src/processor/processorMenu.js:260 msgid "Idle" msgstr "Бездействие" -#: src/processor/processorMenu.js:280 +#: src/processor/processorMenu.js:268 msgid "I/O wait" msgstr "Ожидание ввода/вывода" -#: src/processor/processorMenu.js:288 +#: src/processor/processorMenu.js:276 msgid "IRQ" msgstr "Прерывание" -#: src/processor/processorMenu.js:296 +#: src/processor/processorMenu.js:284 msgid "Soft IRQ" msgstr "Программное прерывание" -#: src/processor/processorMenu.js:304 +#: src/processor/processorMenu.js:292 msgid "Steal" msgstr "Steal" -#: src/processor/processorMenu.js:375 +#: src/processor/processorMenu.js:363 msgid "CPU Cores Usage Info" msgstr "Информация об использовании ядер ЦП" -#: src/processor/processorMenu.js:417 +#: src/processor/processorMenu.js:405 msgid "GHz" msgstr "ГГц" -#: src/processor/processorMenu.js:434 src/processor/processorMenu.js:488 +#: src/processor/processorMenu.js:422 src/processor/processorMenu.js:476 #: src/storage/storageMenu.js:110 src/storage/storageMenu.js:224 #: src/memory/memoryMenu.js:262 src/memory/memoryMenu.js:320 msgid "Top processes" msgstr "Наибольшие процессы" -#: src/processor/processorMenu.js:520 prefs.js:281 +#: src/processor/processorMenu.js:508 prefs.js:281 msgid "GPU" msgstr "ГП" -#: src/processor/processorMenu.js:532 +#: src/processor/processorMenu.js:520 msgid "No GPU found" msgstr "ГП не найден" -#: src/processor/processorMenu.js:545 +#: src/processor/processorMenu.js:533 msgid "GPUs" msgstr "ГП" -#: src/processor/processorMenu.js:602 +#: src/processor/processorMenu.js:590 msgid "GPU info" msgstr "Информация о ГП" -#: src/processor/processorMenu.js:610 +#: src/processor/processorMenu.js:598 msgid "Name" msgstr "Название" -#: src/processor/processorMenu.js:618 +#: src/processor/processorMenu.js:606 msgid "Subsystem" msgstr "Подсистема" -#: src/processor/processorMenu.js:629 +#: src/processor/processorMenu.js:617 msgid "Vendor" msgstr "Производитель" -#: src/processor/processorMenu.js:638 +#: src/processor/processorMenu.js:626 msgid "Vendor ID" msgstr "ID производителя" -#: src/processor/processorMenu.js:648 +#: src/processor/processorMenu.js:636 msgid "Product ID" msgstr "ID товара" -#: src/processor/processorMenu.js:657 +#: src/processor/processorMenu.js:645 msgid "Domain" msgstr "Домен" -#: src/processor/processorMenu.js:665 +#: src/processor/processorMenu.js:653 msgid "Bus" msgstr "Шина" -#: src/processor/processorMenu.js:673 +#: src/processor/processorMenu.js:661 msgid "Slot" msgstr "Слот" -#: src/processor/processorMenu.js:682 +#: src/processor/processorMenu.js:670 msgid "Drivers" msgstr "Драйвера" -#: src/processor/processorMenu.js:692 +#: src/processor/processorMenu.js:680 msgid "Modules" msgstr "Модули" -#: src/processor/processorMenu.js:704 +#: src/processor/processorMenu.js:692 msgid "System uptime" msgstr "Время работы системы" diff --git a/src/processor/processorMenu.js b/src/processor/processorMenu.js index 5b3959b..4799368 100644 --- a/src/processor/processorMenu.js +++ b/src/processor/processorMenu.js @@ -20,7 +20,6 @@ import St from 'gi://St'; import Clutter from 'gi://Clutter'; -import Mtk from 'gi://Mtk'; import {gettext as _} from 'resource:///org/gnome/shell/extensions/extension.js'; @@ -74,23 +73,12 @@ export class ProcessorMenu extends MenuBase { if(this.cpuInfoPopup) { this.cpuInfoPopup.open(true); - const display = global.display; let actorBox = this.cpuInfoPopup.box.get_allocation_box(); - // @ts-ignore - let rect = new Mtk.Rectangle({ - x: actorBox.x1, - y:actorBox.y1, - width: actorBox.x2 - actorBox.x1, - height: actorBox.y2 - actorBox.y1 - }); - let monitorIndex = display.get_monitor_index_for_rect(rect); - if(monitorIndex === -1) - monitorIndex = display.get_primary_monitor(); - let geometry = display.get_monitor_geometry(monitorIndex); + let monitorSize = Utils.getMonitorSize(actorBox); const height = this.cpuInfoPopup.box.get_preferred_height(-1)[1]; - if(height > geometry.height * 0.8) { + if(height > monitorSize.height * 0.8) { for(const { key, value, reference } of this.cpuInfoPopup['hideable']) { key.visible = false; value.visible = false; diff --git a/src/sensors/sensorsMenu.js b/src/sensors/sensorsMenu.js index adb37f6..2778358 100644 --- a/src/sensors/sensorsMenu.js +++ b/src/sensors/sensorsMenu.js @@ -140,21 +140,39 @@ export class SensorsMenu extends MenuBase { //{ const popup = new MenuBase(container, 0.05, St.Side.RIGHT); + const valueTreeExtimatedHeight = Utils.valueTreeExtimatedHeight(valueTree); + let actorBox = popup.box.get_allocation_box(); + let monitorSize = Utils.getMonitorSize(actorBox); + + let cols = 1; + if(valueTreeExtimatedHeight > monitorSize.height * 0.8) + cols = 2; + const popupGrid = new Grid({ - numCols: 2, + numCols: cols*2, styleClass: 'astra-monitor-menu-subgrid', x_expand: true, }); const categories = new Map(); + let num = 0; for(const [categoryName, category] of valueTree.entries()) { + let style = ''; + if(cols === 2) { + if(num % 2 === 0) + style = 'margin-right:1em;'; + else + style = 'margin-left:1em;'; + } + const categoryGrid = new Grid({ numCols: 3, styleClass: 'astra-monitor-menu-subgrid', + style: style, x_expand: true, }); - + const categoryLabel = new St.Label({ text: '', style_class: 'astra-monitor-menu-sensors-category', @@ -188,6 +206,7 @@ export class SensorsMenu extends MenuBase { categoryGrid.addToGrid(value); values.set(valueId, { icon, name, value }); + num++; } popupGrid.addToGrid(categoryGrid, 2); diff --git a/src/utils/utils.js b/src/utils/utils.js index 720227b..aa58c16 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -1,5 +1,7 @@ import GLib from 'gi://GLib'; import Gio from 'gi://Gio'; +import Mtk from 'gi://Mtk'; + import Config from '../config.js'; export default class Utils { @@ -1447,4 +1449,36 @@ export default class Utils { } return color; } + + /** + * + * @param {Map} valueTree + */ + static valueTreeExtimatedHeight(valueTree) { + let length = valueTree.size; + for(const value of valueTree.values()) + length += value.length; + return length *= 20; + } + + /** + * + * @param {import('@girs/clutter-12').ActorBox} actorBox + * @returns {{width: number, height: number}} + */ + static getMonitorSize(actorBox) { + const display = global.display; + // @ts-ignore + let rect = new Mtk.Rectangle({ + x: actorBox.x1, + y:actorBox.y1, + width: actorBox.x2 - actorBox.x1, + height: actorBox.y2 - actorBox.y1 + }); + let monitorIndex = display.get_monitor_index_for_rect(rect); + if(monitorIndex === -1) + monitorIndex = display.get_primary_monitor(); + let geometry = display.get_monitor_geometry(monitorIndex); + return {width: geometry.width, height: geometry.height}; + } }