Skip to content

Commit 36fcf6b

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 b447e16 commit 36fcf6b

5 files changed

Lines changed: 24 additions & 11 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 & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1285,6 +1285,7 @@ Item {
12851285
widgetItem: cpuTempWidget,
12861286
section: topBarContent.getWidgetSection(parent) || "right",
12871287
triggerSource: "cpu_temp",
1288+
tabIndex: 1,
12881289
mode: "click"
12891290
});
12901291
}
@@ -1309,6 +1310,7 @@ Item {
13091310
widgetItem: gpuTempWidget,
13101311
section: topBarContent.getWidgetSection(parent) || "right",
13111312
triggerSource: "gpu_temp",
1313+
tabIndex: 3,
13121314
mode: "click"
13131315
});
13141316
}

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
@@ -759,12 +759,12 @@ Singleton {
759759
}
760760
}
761761

762-
function showProcessListModal() {
762+
function showProcessListModal(tabIndex) {
763763
if (processListModal) {
764-
processListModal.show();
764+
processListModal.show(tabIndex);
765765
} else if (processListModalLoader) {
766766
processListModalLoader.active = true;
767-
Qt.callLater(() => processListModal?.show());
767+
Qt.callLater(() => processListModal?.show(tabIndex));
768768
}
769769
}
770770

@@ -779,12 +779,12 @@ Singleton {
779779
}
780780
}
781781

782-
function toggleProcessListModal() {
782+
function toggleProcessListModal(tabIndex) {
783783
if (processListModal) {
784-
processListModal.toggle();
784+
processListModal.toggle(tabIndex);
785785
} else if (processListModalLoader) {
786786
processListModalLoader.active = true;
787-
Qt.callLater(() => processListModal?.show());
787+
Qt.callLater(() => processListModal?.show(tabIndex));
788788
}
789789
}
790790

0 commit comments

Comments
 (0)