Files
glassMxrph/quickshell/components/GlassMenuItem.qml
T
mxandClaude Opus 5.5 99e64a7713 Add glassMxrph shell sources
Initial commit of the Quickshell desktop suite: bar, dock, launcher,
settings, Control Center, dashboard, OSD, lock screen, desktop widgets,
plugin host with the vendored Noctalia/Omarchy compatibility layer,
helpers, packaging, tests and phase documentation.

Includes the optimization work so far: usage widgets and dashboard
gauges no longer animate continuously, desktop widgets pause while
covered, system controls stop flickering on background polls, dock app
matching uses an indexed catalog, and workspace ghosts are created only
for occupied slots.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 22:36:17 +02:00

54 lines
2.9 KiB
QML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import QtQuick
import Quickshell
import "../theme"
Item {
id: root
property string text: ""
property string iconSource: ""
property bool separator: false
property bool actionEnabled: true
property bool selected: false
property bool submenu: false
property int buttonType: QsMenuButtonType.None
property int checkState: Qt.Unchecked
signal invoked()
signal entered()
implicitWidth: 264
implicitHeight: separator ? 9 : 34
Accessible.role: separator ? Accessible.Separator : Accessible.MenuItem
Accessible.name: text
Accessible.checkable: buttonType !== QsMenuButtonType.None
Accessible.checked: checkState === Qt.Checked
Accessible.onPressAction: if (actionEnabled && !separator) invoked()
Rectangle { anchors.verticalCenter: parent.verticalCenter; width: parent.width; height: 1; color: Theme.border; visible: root.separator }
Rectangle {
anchors.fill: parent; radius: 9; visible: !root.separator
color: root.selected && root.actionEnabled ? Qt.alpha(Theme.accent, 0.22) : Theme.transparent
Behavior on color { ColorAnimation { duration: Theme.duration / 2 } }
}
Row {
anchors.verticalCenter: parent.verticalCenter; x: 8; spacing: 8; visible: !root.separator
opacity: root.actionEnabled ? 1 : 0.4
Item {
width: 18; height: 18
Rectangle {
anchors.centerIn: parent; width: 14; height: 14
radius: root.buttonType === QsMenuButtonType.RadioButton ? 7 : 3
visible: root.buttonType !== QsMenuButtonType.None
color: Theme.transparent; border.width: 1
border.color: root.checkState === Qt.Unchecked ? Theme.textSecondary : Theme.accent
Rectangle { anchors.centerIn: parent; width: 6; height: 6; radius: 3; color: Theme.accent; visible: root.buttonType === QsMenuButtonType.RadioButton && root.checkState === Qt.Checked }
Text { anchors.centerIn: parent; text: root.checkState === Qt.PartiallyChecked ? "−" : "✓"; font.pixelSize: 12; color: Theme.accent; visible: root.buttonType !== QsMenuButtonType.RadioButton && root.checkState !== Qt.Unchecked }
}
Image { anchors.fill: parent; source: root.iconSource; sourceSize.width: 18; sourceSize.height: 18; visible: root.buttonType === QsMenuButtonType.None; fillMode: Image.PreserveAspectFit }
}
Text { width: root.width - 70; text: root.text; textFormat: Text.PlainText; elide: Text.ElideRight; color: Theme.text; font.pixelSize: 13; height: 18; verticalAlignment: Text.AlignVCenter }
Text { text: root.submenu ? "›" : ""; color: Theme.textSecondary; font.pixelSize: 16 }
}
MouseArea {
anchors.fill: parent; hoverEnabled: true; enabled: !root.separator
onEntered: root.entered()
onClicked: if (root.actionEnabled) root.invoked()
}
}