Tray: layout fixes

This commit is contained in:
Ly-sec
2025-11-04 23:34:36 +01:00
parent 960042b3b8
commit 8b00fae3ae
10 changed files with 51 additions and 16 deletions
+12 -9
View File
@@ -20,21 +20,24 @@ NPanel {
// Trigger refresh when settings change
property int settingsVersion: 0
// Read favorites directly from settings for reactivity
readonly property var favoritesList: {
// Read widget settings for reactivity
readonly property var widgetSettings: {
// Reference settingsVersion to force recalculation when it changes
var _ = root.settingsVersion
if (widgetSection === "" || widgetIndex < 0)
return []
return {}
var widgets = Settings.data.bar.widgets[widgetSection]
if (!widgets || widgetIndex >= widgets.length)
return []
var widgetSettings = widgets[widgetIndex]
if (!widgetSettings || widgetSettings.id !== "Tray")
return []
return widgetSettings.favorites || []
return {}
var settings = widgets[widgetIndex]
if (!settings || settings.id !== "Tray")
return {}
return settings
}
// Read favorites directly from settings for reactivity
readonly property var favoritesList: widgetSettings.favorites || []
function wildCardMatch(str, rule) {
if (!str || !rule)
return false
@@ -126,7 +129,7 @@ NPanel {
return icon
}
layer.enabled: true
layer.enabled: root.widgetSettings.colorizeIcons !== false
layer.effect: ShaderEffect {
property color targetColor: Settings.data.colorSchemes.darkMode ? Color.mOnSurface : Color.mSurfaceVariant
property real colorizeMode: 1.0
+31 -7
View File
@@ -303,17 +303,18 @@ Rectangle {
}
}
// Dropdown opener - wrapped in Item for proper alignment
// Dropdown opener - simple icon with hover effect
Item {
id: dropdownButton
visible: dropdownItems.length > 0
width: itemSize
height: itemSize
NIconButton {
id: dropdownButton
property bool hovered: false
NIcon {
id: chevronIcon
anchors.centerIn: parent
width: itemSize
height: itemSize
icon: {
if (barPosition === "top")
return "chevron-down"
@@ -326,13 +327,36 @@ Rectangle {
else
return "chevron-down" // default fallback
}
tooltipText: I18n.tr("open-control-center") // reuse generic tooltip text
pointSize: Math.round(itemSize * 0.65)
color: dropdownButton.hovered ? Color.mPrimary : Color.mOnSurface
Behavior on color {
ColorAnimation {
duration: Style.animationFast
easing.type: Easing.InOutQuad
}
}
}
MouseArea {
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onEntered: {
dropdownButton.hovered = true
TooltipService.show(Screen, dropdownButton, I18n.tr("tooltips.open-tray-dropdown"), BarService.getTooltipDirection())
}
onExited: {
dropdownButton.hovered = false
TooltipService.hide()
}
onClicked: {
TooltipService.hideImmediately()
const panel = PanelService.getPanel("trayDropdownPanel", root.screen)
if (panel) {
panel.widgetSection = root.section
panel.widgetIndex = root.sectionWidgetIndex
panel.toggle(this)
panel.toggle(dropdownButton)
}
}
}