Taskbar improvements

- Fix broken tooltip and truncate them if too long
- Fix SystemInfo width which can lead to blurry image in the taskbar
This commit is contained in:
Quadbyte 2025-08-04 21:33:25 -04:00
parent 34fec629e7
commit 9857ef583c
3 changed files with 10 additions and 3 deletions

View file

@ -8,6 +8,10 @@ Row {
spacing: 10 spacing: 10
visible: Settings.settings.showSystemInfoInBar visible: Settings.settings.showSystemInfoInBar
// The width calculation below is required to ensure our row width is an integer.
// If omitted the next component to the right might get blurry (Taskbar icons).
width: Math.floor(cpuUsageLayout.width + cpuTempLayout.width + memoryUsageLayout.width + (2 * 10))
Row { Row {
id: cpuUsageLayout id: cpuUsageLayout
spacing: 6 spacing: 6

View file

@ -15,6 +15,7 @@ Item {
// Attach custom tooltip // Attach custom tooltip
StyledTooltip { StyledTooltip {
id: styledTooltip id: styledTooltip
positionAbove: false
} }
function getAppIcon(toplevel: Toplevel): string { function getAppIcon(toplevel: Toplevel): string {
@ -94,7 +95,8 @@ Item {
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onEntered: { onEntered: {
styledTooltip.text = appTitle || appId; var text = appTitle || appId;
styledTooltip.text = text.length > 60 ? text.substring(0, 60) + "..." : text;
styledTooltip.targetItem = appButton; styledTooltip.targetItem = appButton;
styledTooltip.tooltipVisible = true; styledTooltip.tooltipVisible = true;
} }

View file

@ -16,8 +16,6 @@ Window {
color: "transparent" color: "transparent"
visible: false visible: false
minimumWidth: Math.max(50, tooltipText.implicitWidth + 24)
minimumHeight: Math.max(50, tooltipText.implicitHeight + 16)
property var _timerObj: null property var _timerObj: null
onTooltipVisibleChanged: { onTooltipVisibleChanged: {
@ -36,6 +34,9 @@ Window {
} }
function _showNow() { function _showNow() {
width = Math.max(50, tooltipText.implicitWidth + 24)
height = Math.max(50, tooltipText.implicitHeight + 16)
if (!targetItem) return; if (!targetItem) return;
if (positionAbove) { if (positionAbove) {