diff --git a/settings/hyprland.nix b/settings/hyprland.nix index 6955d56..72a8818 100644 --- a/settings/hyprland.nix +++ b/settings/hyprland.nix @@ -750,82 +750,69 @@ in Repeater { model: menuOpener.children - Loader { + Rectangle { required property var modelData width: 200 - sourceComponent: modelData.isSeparator ? separatorComp : menuItemComp + height: modelData.isSeparator ? 9 : 28 + color: !modelData.isSeparator && itemMouse.containsMouse && modelData.enabled + ? "#${c.base02}" : "transparent" + radius: modelData.isSeparator ? 0 : 4 + + // Separator line + Rectangle { + visible: modelData.isSeparator + anchors.centerIn: parent + width: parent.width - 20 + height: 1 + color: "#${c.base03}" + } + + // Menu item content + RowLayout { + visible: !modelData.isSeparator + anchors.fill: parent + anchors.leftMargin: 10 + anchors.rightMargin: 10 + spacing: 8 + + Text { + Layout.fillWidth: true + text: modelData.text ?? "" + color: modelData.enabled ? "#${c.base05}" : "#${c.base03}" + font.family: "FiraMono Nerd Font" + font.pixelSize: 12 + elide: Text.ElideRight + } + + Text { + visible: modelData.buttonType !== QsMenuButtonType.None + text: modelData.checkState === Qt.Checked ? "\u2713" : "" + color: "#${c.base0D}" + font.family: "FiraMono Nerd Font" + font.pixelSize: 12 + } + } + + MouseArea { + id: itemMouse + anchors.fill: parent + hoverEnabled: true + enabled: !modelData.isSeparator && modelData.enabled + onClicked: { + modelData.triggered(); + contextMenu.visible = false; + } + } } } } } - // Close when clicking outside onVisibleChanged: { if (!visible) { menuOpener.menu = null; } } - } - - // Menu item delegate - component MenuItemDelegate: Rectangle { - required property var modelData - width: 200 - height: modelData.isSeparator ? 1 : 28 - color: itemMouse.containsMouse && modelData.enabled ? "#${c.base02}" : "transparent" - radius: 4 - - RowLayout { - anchors.fill: parent - anchors.leftMargin: 10 - anchors.rightMargin: 10 - spacing: 8 - - Text { - Layout.fillWidth: true - text: modelData.text ?? "" - color: modelData.enabled ? "#${c.base05}" : "#${c.base03}" - font.family: "FiraMono Nerd Font" - font.pixelSize: 12 - elide: Text.ElideRight - } - - Text { - visible: modelData.buttonType !== QsMenuButtonType.None - text: modelData.checkState === Qt.Checked ? "\u2713" : "" - color: "#${c.base0D}" - font.family: "FiraMono Nerd Font" - font.pixelSize: 12 - } - } - - MouseArea { - id: itemMouse - anchors.fill: parent - hoverEnabled: true - enabled: modelData.enabled - onClicked: { - modelData.triggered(); - contextMenu.visible = false; - } - } - } - - // Separator delegate - component SeparatorDelegate: Rectangle { - width: 200 - height: 9 - color: "transparent" - Rectangle { - anchors.centerIn: parent - width: parent.width - 20 - height: 1 - color: "#${c.base03}" - } - } - - Component { id: menuItemComp; MenuItemDelegate {} } - Component { id: separatorComp; SeparatorDelegate {} } } } }