From a3e83fa6f0a062e41d140096c24ee4d2384a9c67 Mon Sep 17 00:00:00 2001 From: rope Date: Tue, 26 May 2026 10:55:21 +0100 Subject: [PATCH] quickshell: inline monochrome tray icons on bar Co-Authored-By: Claude Opus 4.6 --- settings/hyprland.nix | 109 +++++++++++++++--------------------------- 1 file changed, 39 insertions(+), 70 deletions(-) diff --git a/settings/hyprland.nix b/settings/hyprland.nix index 34e0cf4..e537296 100644 --- a/settings/hyprland.nix +++ b/settings/hyprland.nix @@ -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,80 +636,47 @@ in // Spacer Item { Layout.fillWidth: true } - // Tray toggle button - Item { - id: trayToggle - Layout.preferredWidth: 28 - Layout.preferredHeight: 30 - Layout.rightMargin: 6 + // Tray icons inline + RowLayout { + id: trayArea + spacing: 8 + Layout.rightMargin: 8 - Text { - anchors.centerIn: parent - text: trayPopup.visible ? "\u25b6" : "\u25c0" - color: "#${c.base05}" - font.family: "FiraMono Nerd Font" - font.pixelSize: 10 - } + Repeater { + model: SystemTray.items - MouseArea { - anchors.fill: parent - onClicked: trayPopup.visible = !trayPopup.visible - } - } - } + Item { + required property var modelData + Layout.preferredWidth: 16 + Layout.preferredHeight: 16 - // 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 + Image { + id: trayIcon + anchors.fill: parent + source: modelData.icon + sourceSize.width: 16 + sourceSize.height: 16 + smooth: true + mipmap: true + visible: false + } - Rectangle { - anchors.fill: parent - color: "#${c.base00}" - border.color: "#${c.base03}" - border.width: 1 - radius: 6 + ColorOverlay { + anchors.fill: trayIcon + source: trayIcon + color: "#${c.base05}" + } - RowLayout { - id: trayRow - anchors.centerIn: parent - spacing: 8 - - Repeater { - model: SystemTray.items - - Item { - required property var modelData - Layout.preferredWidth: 20 - Layout.preferredHeight: 20 - - Image { - anchors.fill: parent - source: modelData.icon - sourceSize.width: 20 - sourceSize.height: 20 - smooth: true - mipmap: true - } - - MouseArea { - anchors.fill: parent - acceptedButtons: Qt.LeftButton | Qt.RightButton - onClicked: (event) => { - if (event.button === Qt.RightButton && modelData.hasMenu) { - contextMenu.trayItem = modelData; - menuOpener.menu = modelData.menu; - contextMenu.visible = true; - } else { - modelData.activate(); - } + MouseArea { + anchors.fill: parent + acceptedButtons: Qt.LeftButton | Qt.RightButton + onClicked: (event) => { + if (event.button === Qt.RightButton && modelData.hasMenu) { + contextMenu.trayItem = modelData; + menuOpener.menu = modelData.menu; + contextMenu.visible = true; + } else { + modelData.activate(); } } } @@ -720,7 +689,7 @@ in 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