quickshell: inline monochrome tray icons on bar

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
rope 2026-05-26 10:55:21 +01:00
parent fbb7c2d494
commit a3e83fa6f0

View file

@ -62,6 +62,7 @@ in
polkit_gnome
] ++ lib.optionals isGaming [
quickshell
qt6.qt5compat
];
# Use upstream anyrun flake's HM module instead of the built-in one
@ -569,6 +570,7 @@ in
import Quickshell.Widgets
import QtQuick
import QtQuick.Layouts
import Qt5Compat.GraphicalEffects
ShellRoot {
Variants {
@ -634,67 +636,35 @@ in
// Spacer
Item { Layout.fillWidth: true }
// Tray toggle button
Item {
id: trayToggle
Layout.preferredWidth: 28
Layout.preferredHeight: 30
Layout.rightMargin: 6
Text {
anchors.centerIn: parent
text: trayPopup.visible ? "\u25b6" : "\u25c0"
color: "#${c.base05}"
font.family: "FiraMono Nerd Font"
font.pixelSize: 10
}
MouseArea {
anchors.fill: parent
onClicked: trayPopup.visible = !trayPopup.visible
}
}
}
// Tray icon popup
PopupWindow {
id: trayPopup
anchor.item: trayToggle
anchor.edges: Edges.Bottom | Edges.Right
anchor.gravity: Edges.Bottom | Edges.Left
anchor.adjustment: PopupAdjustment.Slide
visible: false
color: "transparent"
implicitWidth: trayRow.width + 24
implicitHeight: 36
Rectangle {
anchors.fill: parent
color: "#${c.base00}"
border.color: "#${c.base03}"
border.width: 1
radius: 6
// Tray icons inline
RowLayout {
id: trayRow
anchors.centerIn: parent
id: trayArea
spacing: 8
Layout.rightMargin: 8
Repeater {
model: SystemTray.items
Item {
required property var modelData
Layout.preferredWidth: 20
Layout.preferredHeight: 20
Layout.preferredWidth: 16
Layout.preferredHeight: 16
Image {
id: trayIcon
anchors.fill: parent
source: modelData.icon
sourceSize.width: 20
sourceSize.height: 20
sourceSize.width: 16
sourceSize.height: 16
smooth: true
mipmap: true
visible: false
}
ColorOverlay {
anchors.fill: trayIcon
source: trayIcon
color: "#${c.base05}"
}
MouseArea {
@ -714,13 +684,12 @@ in
}
}
}
}
// Custom-rendered context menu
PopupWindow {
id: contextMenu
property var trayItem: null
anchor.item: trayToggle
anchor.item: trayArea
anchor.edges: Edges.Bottom | Edges.Right
anchor.gravity: Edges.Bottom | Edges.Left
anchor.adjustment: PopupAdjustment.Slide