feat: add option for recoloring tray icons + show popout on hover

This commit is contained in:
2026-07-02 11:33:43 +02:00
parent 53836aec1a
commit 4d731c5a65
7 changed files with 33 additions and 25 deletions
+2
View File
@@ -72,10 +72,12 @@ JsonObject {
property bool upower: true
}
component Tray: JsonObject {
property bool recolorIcons: false
property bool showAudio: true
property bool showBluetooth: false
property bool showMicrophone: true
property bool showNetwork: false
property bool showOnHover: false
property bool showPower: true
property bool showWifi: false
property int trayIconSize: 24
+1 -1
View File
@@ -170,7 +170,7 @@ Item {
root.panels.osd.hovered = false;
}
if (!root.popouts.currentName.startsWith("traymenu")) {
if (!root.popouts.currentName.startsWith("traymenu") || Config.bar.tray.showOnHover) {
root.popouts.hasCurrent = false;
}
+1 -1
View File
@@ -127,7 +127,7 @@ CustomWindow {
HyprlandFocusGrab {
id: focusGrab
active: visibilities.dock || visibilities.resources || visibilities.launcher || visibilities.sidebar || visibilities.dashboard || visibilities.settings || visibilities.clipboard || (panels.popouts.hasCurrent && panels.popouts.currentName.startsWith("traymenu"))
active: visibilities.dock || visibilities.resources || visibilities.launcher || visibilities.sidebar || visibilities.dashboard || visibilities.settings || visibilities.clipboard || (panels.popouts.hasCurrent && panels.popouts.currentName.startsWith("traymenu") && !Config.bar.tray.showOnHover)
windows: [root]
onCleared: {
+2 -15
View File
@@ -48,7 +48,7 @@ RowLayout {
return;
}
if (!popouts.currentName.startsWith("traymenu"))
if (!popouts.currentName.startsWith("traymenu") || Config.bar.tray.showOnHover)
popouts.hasCurrent = false;
}
@@ -57,19 +57,7 @@ RowLayout {
const item = ch.item;
const itemWidth = item.implicitWidth;
if (id === "audio" && Config.bar.popouts.audio) {
popouts.currentName = "audio";
popouts.currentCenter = Qt.binding(() => item.mapToItem(root, itemWidth / 2, 0).x);
popouts.hasCurrent = true;
} else if (id === "network" && Config.bar.popouts.network) {
popouts.currentName = "network";
popouts.currentCenter = Qt.binding(() => item.mapToItem(root, itemWidth / 2, 0).x);
popouts.hasCurrent = true;
} else if (id === "upower" && Config.bar.popouts.upower) {
popouts.currentName = "upower";
popouts.currentCenter = Qt.binding(() => item.mapToItem(root, itemWidth / 2, 0).x);
popouts.hasCurrent = true;
} else if (id === "updates") {
if (id === "updates") {
popouts.currentName = "updates";
popouts.currentCenter = Qt.binding(() => item.mapToItem(root, itemWidth / 2, 0).x);
popouts.hasCurrent = true;
@@ -81,7 +69,6 @@ RowLayout {
Repeater {
id: repeater
// model: Config.bar.entries.filted(n => n.index > 50).sort(n => n.index)
model: Config.bar.entries
DelegateChooser {
+19 -1
View File
@@ -19,7 +19,6 @@ PageBase {
SpinRow {
first: true
from: 12
last: true
settingAnchor: "bar-tray-iconsize"
stepSize: 1
text: qsTr("Icon size")
@@ -28,5 +27,24 @@ PageBase {
onMoved: value => Config.bar.tray.trayIconSize = value
}
ToggleRow {
checked: Config.bar.tray.showOnHover
settingAnchor: "bar-tray-show-popout-on-hover"
subtext: Config.bar.tray.showOnHover ? qsTr("Will show context menu on hover") : qsTr("Will show context menu on right-click")
text: qsTr("Show popout on hover")
onToggled: Config.bar.tray.showOnHover = checked
}
ToggleRow {
checked: Config.bar.tray.recolorIcons
last: true
settingAnchor: "bar-tray-recolor-icons"
subtext: qsTr("Recolors icons to fit current scheme")
text: qsTr("Recolor icons")
onToggled: Config.bar.tray.recolorIcons = checked
}
}
}
+5 -4
View File
@@ -45,7 +45,8 @@ Item {
CustomRect {
anchors.fill: parent
anchors.margins: 3
color: icon.layer.enabled && root.current ? DynamicColors.palette.m3primary : "transparent"
color: icon.layer.enabled && enabled && root.current ? DynamicColors.palette.m3primary : "transparent"
enabled: !Config.bar.tray.showOnHover
radius: Appearance.rounding.full
StateLayer {
@@ -57,7 +58,7 @@ Item {
if (mouse.button === Qt.LeftButton) {
root.item.activate();
console.log(icon.source + "\n" + root.item.id);
} else if (mouse.button === Qt.RightButton && Config.bar.popouts.tray) {
} else if (mouse.button === Qt.RightButton && Config.bar.popouts.tray && !Config.bar.tray.showOnHover) {
root.popouts.currentName = `traymenu${root.ind}`;
root.popouts.currentCenter = Qt.binding(() => root.mapToItem(root.loader, root.implicitWidth / 2, 0).x);
root.popouts.hasCurrent = true;
@@ -76,9 +77,9 @@ Item {
anchors.centerIn: parent
antialiasing: true
color: root.current ? DynamicColors.palette.m3onPrimary : DynamicColors.palette.m3onSurface
color: root.current && !Config.bar.tray.showOnHover ? DynamicColors.palette.m3onPrimary : DynamicColors.palette.m3onSurface
implicitSize: Config.bar.tray.trayIconSize * root.dpr
layer.enabled: Config.general.color.smart || Config.general.color.scheduleDark
layer.enabled: Config.bar.tray.recolorIcons
scale: 1 / root.dpr
source: root.resolveIcon(root.item.id, root.item.icon)
}
+3 -3
View File
@@ -61,12 +61,12 @@ RowLayout {
}
let trayPos = mapToItem(sysTray, localX, localY);
if (sysTray.contains(Qt.point(trayPos.x, trayPos.y))) {
if (Config.bar.tray.showOnHover && sysTray.contains(Qt.point(trayPos.x, trayPos.y))) {
let trayRowPos = sysTray.mapToItem(sysRow, trayPos.x, trayPos.y);
let child = sysRow.childAt(trayRowPos.x, trayRowPos.y);
if (child && child.hasOwnProperty("popoutId")) {
if (child && child.hasOwnProperty("ind")) {
return {
id: child.popoutId,
id: `traymenu${child.ind}`,
item: child
};
}