Skip to content

Commit a68ec13

Browse files
committed
fix(thermal): decouple widget click from sort state; add tab-aware routing via PopoutService
- CpuTemperature/GpuTemperature: remove DgopService.setSortBy() from click - GpuTemperature bugfix: was calling setSortBy('cpu') not 'gpu' - DankBarContent: replace 20-line manual popout positioning with PopoutService.toggleProcessListModal(tabIndex) - ProcessListModal: add tabIndex to show()/toggle(), clampTab() validator - PopoutService: showProcessListModal/toggleProcessListModal with tab routing Fixes: none (no upstream issue; found during fork audit)
1 parent bed11fe commit a68ec13

5 files changed

Lines changed: 24 additions & 43 deletions

File tree

quickshell/Modals/ProcessListModal.qml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,18 @@ FloatingWindow {
2121

2222
signal closingModal
2323

24-
function show() {
24+
function clampTab(tabIndex) {
25+
if (tabIndex === undefined || tabIndex === null)
26+
return currentTab;
27+
return Math.max(0, Math.min(3, tabIndex));
28+
}
29+
30+
function show(tabIndex) {
2531
if (!DgopService.dgopAvailable) {
2632
log.warn("dgop is not available");
2733
return;
2834
}
35+
currentTab = clampTab(tabIndex);
2936
visible = true;
3037
}
3138

@@ -35,12 +42,18 @@ FloatingWindow {
3542
processContextMenu.close();
3643
}
3744

38-
function toggle() {
45+
function toggle(tabIndex) {
3946
if (!DgopService.dgopAvailable) {
4047
log.warn("dgop is not available");
4148
return;
4249
}
43-
visible = !visible;
50+
const targetTab = clampTab(tabIndex);
51+
if (visible && currentTab === targetTab) {
52+
hide();
53+
return;
54+
}
55+
currentTab = targetTab;
56+
visible = true;
4457
}
4558

4659
function focusOrToggle() {

quickshell/Modules/DankBar/DankBarContent.qml

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1180,22 +1180,7 @@ Item {
11801180
parentScreen: barWindow.screen
11811181
widgetData: parent.widgetData
11821182
onCpuTempClicked: {
1183-
processListPopoutLoader.active = true;
1184-
if (!processListPopoutLoader.item) {
1185-
return;
1186-
}
1187-
const effectiveBarConfig = topBarContent.barConfig;
1188-
const barPosition = barWindow.axis?.edge === "left" ? 2 : (barWindow.axis?.edge === "right" ? 3 : (barWindow.axis?.edge === "top" ? 0 : 1));
1189-
if (processListPopoutLoader.item.setBarContext) {
1190-
processListPopoutLoader.item.setBarContext(barPosition, effectiveBarConfig?.bottomGap ?? 0);
1191-
}
1192-
if (processListPopoutLoader.item.setTriggerPosition) {
1193-
const globalPos = cpuTempWidget.mapToItem(null, 0, 0);
1194-
const pos = SettingsData.getPopupTriggerPosition(globalPos, barWindow.screen, barWindow.effectiveBarThickness, cpuTempWidget.width, effectiveBarConfig?.spacing ?? 4, barPosition, effectiveBarConfig);
1195-
const widgetSection = topBarContent.getWidgetSection(parent) || "right";
1196-
processListPopoutLoader.item.setTriggerPosition(pos.x, pos.y, pos.width, widgetSection, barWindow.screen, barPosition, barWindow.effectiveBarThickness, effectiveBarConfig?.spacing ?? 4, effectiveBarConfig);
1197-
}
1198-
PopoutManager.requestPopout(processListPopoutLoader.item, undefined, "cpu_temp");
1183+
PopoutService.toggleProcessListModal(1);
11991184
}
12001185
}
12011186
}
@@ -1213,22 +1198,7 @@ Item {
12131198
parentScreen: barWindow.screen
12141199
widgetData: parent.widgetData
12151200
onGpuTempClicked: {
1216-
processListPopoutLoader.active = true;
1217-
if (!processListPopoutLoader.item) {
1218-
return;
1219-
}
1220-
const effectiveBarConfig = topBarContent.barConfig;
1221-
const barPosition = barWindow.axis?.edge === "left" ? 2 : (barWindow.axis?.edge === "right" ? 3 : (barWindow.axis?.edge === "top" ? 0 : 1));
1222-
if (processListPopoutLoader.item.setBarContext) {
1223-
processListPopoutLoader.item.setBarContext(barPosition, effectiveBarConfig?.bottomGap ?? 0);
1224-
}
1225-
if (processListPopoutLoader.item.setTriggerPosition) {
1226-
const globalPos = gpuTempWidget.mapToItem(null, 0, 0);
1227-
const pos = SettingsData.getPopupTriggerPosition(globalPos, barWindow.screen, barWindow.effectiveBarThickness, gpuTempWidget.width, effectiveBarConfig?.spacing ?? 4, barPosition, effectiveBarConfig);
1228-
const widgetSection = topBarContent.getWidgetSection(parent) || "right";
1229-
processListPopoutLoader.item.setTriggerPosition(pos.x, pos.y, pos.width, widgetSection, barWindow.screen, barPosition, barWindow.effectiveBarThickness, effectiveBarConfig?.spacing ?? 4, effectiveBarConfig);
1230-
}
1231-
PopoutManager.requestPopout(processListPopoutLoader.item, undefined, "gpu_temp");
1201+
PopoutService.toggleProcessListModal(3);
12321202
}
12331203
}
12341204
}

quickshell/Modules/DankBar/Widgets/CpuTemperature.qml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ BasePill {
133133
acceptedButtons: Qt.LeftButton
134134
onPressed: mouse => {
135135
root.triggerRipple(this, mouse.x, mouse.y);
136-
DgopService.setSortBy("cpu");
137136
cpuTempClicked();
138137
}
139138
}

quickshell/Modules/DankBar/Widgets/GpuTemperature.qml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,6 @@ BasePill {
201201
acceptedButtons: Qt.LeftButton
202202
onPressed: mouse => {
203203
root.triggerRipple(this, mouse.x, mouse.y);
204-
DgopService.setSortBy("cpu");
205204
gpuTempClicked();
206205
}
207206
}

quickshell/Services/PopoutService.qml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -708,12 +708,12 @@ Singleton {
708708
}
709709
}
710710

711-
function showProcessListModal() {
711+
function showProcessListModal(tabIndex) {
712712
if (processListModal) {
713-
processListModal.show();
713+
processListModal.show(tabIndex);
714714
} else if (processListModalLoader) {
715715
processListModalLoader.active = true;
716-
Qt.callLater(() => processListModal?.show());
716+
Qt.callLater(() => processListModal?.show(tabIndex));
717717
}
718718
}
719719

@@ -728,12 +728,12 @@ Singleton {
728728
}
729729
}
730730

731-
function toggleProcessListModal() {
731+
function toggleProcessListModal(tabIndex) {
732732
if (processListModal) {
733-
processListModal.toggle();
733+
processListModal.toggle(tabIndex);
734734
} else if (processListModalLoader) {
735735
processListModalLoader.active = true;
736-
Qt.callLater(() => processListModal?.show());
736+
Qt.callLater(() => processListModal?.show(tabIndex));
737737
}
738738
}
739739

0 commit comments

Comments
 (0)