import QtQuick import QtQuick.Layouts import QtQuick.Controls import "../theme" import ".." Rectangle { id: root property string menuName: "" width: 200 implicitHeight: menuCol.implicitHeight + 12 radius: Theme.radiusMedium color: Theme.menuDropdownBg border.color: Theme.menuDropdownBorder border.width: 1 ColumnLayout { id: menuCol anchors.fill: parent anchors.margins: 6 spacing: 2 // FILE MENU Repeater { model: root.menuName === "File" ? [ { text: "New Window", shortcut: "⌘N", cmd: "foot &" }, { text: "New Incognito Window", shortcut: "⇧⌘N", cmd: "brave --incognito &" }, { text: "Close Window", shortcut: "⌘W", cmd: "hyprctl dispatch killactive" }, { text: "---", shortcut: "", cmd: "" }, { text: "Take Screenshot", shortcut: "⇧⌘5", cmd: "grim -g \"$(slurp)\" ~/screenshot.png" } ] : [] delegate: MenuEntryDelegate {} } // EDIT MENU Repeater { model: root.menuName === "Edit" ? [ { text: "Undo", shortcut: "⌘Z", cmd: "" }, { text: "Redo", shortcut: "⇧⌘Z", cmd: "" }, { text: "---", shortcut: "", cmd: "" }, { text: "Cut", shortcut: "⌘X", cmd: "wl-copy" }, { text: "Copy", shortcut: "⌘C", cmd: "wl-copy" }, { text: "Paste", shortcut: "⌘V", cmd: "wl-paste" }, { text: "Select All", shortcut: "⌘A", cmd: "" } ] : [] delegate: MenuEntryDelegate {} } // VIEW MENU Repeater { model: root.menuName === "View" ? [ { text: "Toggle Fullscreen", shortcut: "⌃⌘F", cmd: "hyprctl dispatch fullscreen 0" }, { text: "Toggle Floating", shortcut: "⌘V", cmd: "hyprctl dispatch togglefloating" }, { text: "Toggle Group", shortcut: "⌘G", cmd: "hyprctl dispatch togglegroup" }, { text: "---", shortcut: "", cmd: "" }, { text: "Zoom In", shortcut: "⌘+", cmd: "" }, { text: "Zoom Out", shortcut: "⌘-", cmd: "" } ] : [] delegate: MenuEntryDelegate {} } // WINDOW MENU Repeater { model: root.menuName === "Window" ? [ { text: "Minimize Window", shortcut: "⌘M", cmd: "hyprctl dispatch movetoworkspacesilent special:scratch" }, { text: "Tile Left", shortcut: "⌃⌥←", cmd: "hyprctl dispatch movewindow l" }, { text: "Tile Right", shortcut: "⌃⌥→", cmd: "hyprctl dispatch movewindow r" }, { text: "---", shortcut: "", cmd: "" }, { text: "Show Scratchpad", shortcut: "⌘↩", cmd: "hyprctl dispatch togglespecialworkspace scratch" }, { text: "Show Messaging", shortcut: "⌘M", cmd: "hyprctl dispatch togglespecialworkspace messaging" } ] : [] delegate: MenuEntryDelegate {} } // HELP MENU Repeater { model: root.menuName === "Help" ? [ { text: "Hyprland Documentation", shortcut: "", cmd: "brave https://wiki.hyprland.org &" }, { text: "NixOS Manual", shortcut: "", cmd: "brave https://nixos.org/manual/nixos/stable/ &" }, { text: "---", shortcut: "", cmd: "" }, { text: "About Antigravity", shortcut: "", cmd: "" } ] : [] delegate: MenuEntryDelegate {} } } component MenuEntryDelegate: Item { Layout.fillWidth: true Layout.preferredHeight: modelData.text === "---" ? 7 : 22 Rectangle { anchors.fill: parent visible: modelData.text === "---" color: "transparent" Rectangle { anchors.centerIn: parent width: parent.width height: 1 color: Qt.rgba(1.0, 1.0, 1.0, 0.12) } } Rectangle { anchors.fill: parent visible: modelData.text !== "---" radius: Theme.radiusSmall color: itemMouse.containsMouse ? Theme.menuHoverBlue : "transparent" RowLayout { anchors.fill: parent anchors.leftMargin: 10 anchors.rightMargin: 10 spacing: 8 Text { text: modelData.text font.family: Theme.fontFamily font.pixelSize: Theme.fontSizeNormal color: itemMouse.containsMouse ? Theme.menuTextHover : Theme.textPrimary Layout.fillWidth: true elide: Text.ElideRight } Text { visible: modelData.shortcut !== "" text: modelData.shortcut font.family: Theme.fontFamily font.pixelSize: Theme.fontSizeSmall color: itemMouse.containsMouse ? Theme.menuTextHover : Theme.textTertiary } } MouseArea { id: itemMouse anchors.fill: parent hoverEnabled: true cursorShape: Qt.PointingHandCursor onClicked: { GlobalState.activeDropdownMenu = ""; if (modelData.cmd) { GlobalState.launchApp(modelData.cmd); } } } } } }