Add tooltips, fix tray menu

This commit is contained in:
ly-sec 2025-07-16 13:56:09 +02:00
parent a7fbccaf8b
commit 32e1160f8f
13 changed files with 319 additions and 69 deletions

View file

@ -6,7 +6,7 @@ import qs.Settings
PanelWindow {
id: window
implicitWidth: 350
implicitHeight: notificationColumn.implicitHeight + 60
implicitHeight: notificationColumn.implicitHeight
color: "transparent"
visible: notificationModel.count > 0
screen: Quickshell.primaryScreen !== undefined ? Quickshell.primaryScreen : null
@ -16,7 +16,7 @@ PanelWindow {
anchors.top: true
anchors.right: true
margins.top: barVisible ? -20 : 10
margins.top: 6
margins.right: 6
ListModel {

View file

@ -16,7 +16,7 @@ PanelWindow {
screen: modelData
anchors.top: true
anchors.right: true
margins.top: -24
margins.top: 0
WlrLayershell.keyboardFocus: (settingsModal.visible && mouseArea.containsMouse) ? WlrKeyboardFocus.Exclusive : WlrKeyboardFocus.None
// Animation properties

View file

@ -3,6 +3,7 @@ import QtQuick.Layouts 1.15
import QtQuick.Controls 2.15
import Quickshell.Services.UPower
import qs.Settings
import qs.Components
Rectangle {
id: card
@ -28,6 +29,7 @@ Rectangle {
opacity: (typeof PowerProfiles !== 'undefined' && !PowerProfiles.hasPerformanceProfile) ? 0.4 : 1
Text {
id: perfIcon
anchors.centerIn: parent
text: "speed"
font.family: "Material Symbols Outlined"
@ -49,6 +51,15 @@ Rectangle {
if (typeof PowerProfiles !== 'undefined')
PowerProfiles.profile = PowerProfile.Performance;
}
onEntered: perfTooltip.tooltipVisible = true
onExited: perfTooltip.tooltipVisible = false
}
StyledTooltip {
id: perfTooltip
text: "Performance Profile"
tooltipVisible: false
targetItem: perfIcon
delay: 200
}
}
@ -64,6 +75,7 @@ Rectangle {
opacity: 1
Text {
id: balIcon
anchors.centerIn: parent
text: "balance"
font.family: "Material Symbols Outlined"
@ -85,6 +97,15 @@ Rectangle {
if (typeof PowerProfiles !== 'undefined')
PowerProfiles.profile = PowerProfile.Balanced;
}
onEntered: balTooltip.tooltipVisible = true
onExited: balTooltip.tooltipVisible = false
}
StyledTooltip {
id: balTooltip
text: "Balanced Profile"
tooltipVisible: false
targetItem: balIcon
delay: 200
}
}
@ -100,6 +121,7 @@ Rectangle {
opacity: 1
Text {
id: saveIcon
anchors.centerIn: parent
text: "eco"
font.family: "Material Symbols Outlined"
@ -121,6 +143,15 @@ Rectangle {
if (typeof PowerProfiles !== 'undefined')
PowerProfiles.profile = PowerProfile.PowerSaver;
}
onEntered: saveTooltip.tooltipVisible = true
onExited: saveTooltip.tooltipVisible = false
}
StyledTooltip {
id: saveTooltip
text: "Power Saver Profile"
tooltipVisible: false
targetItem: saveIcon
delay: 200
}
}
}

View file

@ -27,48 +27,120 @@ Rectangle {
Layout.alignment: Qt.AlignVCenter
// CPU Usage
CircularProgressBar {
progress: Sysinfo.cpuUsage / 100
size: 50
strokeWidth: 4
hasNotch: true
notchIcon: "speed"
notchIconSize: 14
Layout.alignment: Qt.AlignHCenter
Item {
width: 50; height: 50
CircularProgressBar {
id: cpuBar
progress: Sysinfo.cpuUsage / 100
size: 50
strokeWidth: 4
hasNotch: true
notchIcon: "speed"
notchIconSize: 14
Layout.alignment: Qt.AlignHCenter
}
MouseArea {
id: cpuBarMouse
anchors.fill: parent
hoverEnabled: true
onEntered: cpuTooltip.tooltipVisible = true
onExited: cpuTooltip.tooltipVisible = false
}
StyledTooltip {
id: cpuTooltip
text: 'CPU Usage: ' + Sysinfo.cpuUsage + '%'
tooltipVisible: false
targetItem: cpuBar
delay: 200
}
}
// Cpu Temp
CircularProgressBar {
progress: Sysinfo.cpuTemp / 100
size: 50
strokeWidth: 4
hasNotch: true
units: "°C"
notchIcon: "thermometer"
notchIconSize: 14
Layout.alignment: Qt.AlignHCenter
Item {
width: 50; height: 50
CircularProgressBar {
id: tempBar
progress: Sysinfo.cpuTemp / 100
size: 50
strokeWidth: 4
hasNotch: true
units: "°C"
notchIcon: "thermometer"
notchIconSize: 14
Layout.alignment: Qt.AlignHCenter
}
MouseArea {
id: tempBarMouse
anchors.fill: parent
hoverEnabled: true
onEntered: tempTooltip.tooltipVisible = true
onExited: tempTooltip.tooltipVisible = false
}
StyledTooltip {
id: tempTooltip
text: 'CPU Temp: ' + Sysinfo.cpuTemp + '°C'
tooltipVisible: false
targetItem: tempBar
delay: 200
}
}
// Memory Usage
CircularProgressBar {
progress: Sysinfo.memoryUsagePer / 100
size: 50
strokeWidth: 4
hasNotch: true
notchIcon: "memory"
notchIconSize: 14
Layout.alignment: Qt.AlignHCenter
Item {
width: 50; height: 50
CircularProgressBar {
id: memBar
progress: Sysinfo.memoryUsagePer / 100
size: 50
strokeWidth: 4
hasNotch: true
notchIcon: "memory"
notchIconSize: 14
Layout.alignment: Qt.AlignHCenter
}
MouseArea {
id: memBarMouse
anchors.fill: parent
hoverEnabled: true
onEntered: memTooltip.tooltipVisible = true
onExited: memTooltip.tooltipVisible = false
}
StyledTooltip {
id: memTooltip
text: 'Memory Usage: ' + Sysinfo.memoryUsagePer + '% (' + Sysinfo.memoryUsageStr + ' used)'
tooltipVisible: false
targetItem: memBar
delay: 200
}
}
// Disk Usage
CircularProgressBar {
progress: Sysinfo.diskUsage / 100
size: 50
strokeWidth: 4
hasNotch: true
notchIcon: "storage"
notchIconSize: 14
Layout.alignment: Qt.AlignHCenter
Item {
width: 50; height: 50
CircularProgressBar {
id: diskBar
progress: Sysinfo.diskUsage / 100
size: 50
strokeWidth: 4
hasNotch: true
notchIcon: "storage"
notchIconSize: 14
Layout.alignment: Qt.AlignHCenter
}
MouseArea {
id: diskBarMouse
anchors.fill: parent
hoverEnabled: true
onEntered: diskTooltip.tooltipVisible = true
onExited: diskTooltip.tooltipVisible = false
}
StyledTooltip {
id: diskTooltip
text: 'Disk Usage: ' + Sysinfo.diskUsage + '%'
tooltipVisible: false
targetItem: diskBar
delay: 200
}
}
}
}