191 lines
5.9 KiB
QML
191 lines
5.9 KiB
QML
import QtQuick
|
|
import QtQuick.Layouts
|
|
import QtQuick.Controls
|
|
import Quickshell
|
|
import Quickshell.Wayland
|
|
import Quickshell.Io
|
|
import "../theme"
|
|
import ".."
|
|
|
|
PanelWindow {
|
|
id: quickMenu
|
|
|
|
WlrLayershell.layer: WlrLayer.Overlay
|
|
WlrLayershell.keyboardFocus: WlrKeyboardFocus.OnDemand
|
|
|
|
anchors {
|
|
top: true
|
|
left: true
|
|
}
|
|
|
|
margins {
|
|
top: 0
|
|
left: Theme.sidebarWidth
|
|
}
|
|
|
|
visible: GlobalState.appleMenuVisible
|
|
|
|
implicitWidth: 220
|
|
implicitHeight: menuContainer.implicitHeight
|
|
|
|
color: "transparent"
|
|
|
|
// Close on escape
|
|
Item {
|
|
anchors.fill: parent
|
|
focus: true
|
|
Keys.onEscapePressed: GlobalState.appleMenuVisible = false
|
|
}
|
|
|
|
Rectangle {
|
|
id: menuContainer
|
|
anchors.fill: parent
|
|
color: Theme.glassBg
|
|
border.color: Theme.glassBorder
|
|
border.width: 1
|
|
|
|
Column {
|
|
width: parent.width
|
|
padding: 8
|
|
|
|
component MenuItem: Item {
|
|
id: menuItem
|
|
width: parent.width
|
|
height: 28
|
|
|
|
property string text: ""
|
|
property string shortcut: ""
|
|
signal triggered()
|
|
|
|
Rectangle {
|
|
anchors.fill: parent
|
|
color: menuItemMouseArea.containsMouse ? Qt.rgba(Theme.accentVolt.r, Theme.accentVolt.g, Theme.accentVolt.b, 0.1) : "transparent"
|
|
}
|
|
|
|
Rectangle {
|
|
anchors.left: parent.left
|
|
anchors.top: parent.top
|
|
anchors.bottom: parent.bottom
|
|
width: 2
|
|
color: Theme.accentVolt
|
|
visible: menuItemMouseArea.containsMouse
|
|
}
|
|
|
|
Text {
|
|
anchors.left: parent.left
|
|
anchors.leftMargin: 12
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
text: menuItem.text
|
|
font.family: Theme.fontSans
|
|
font.pixelSize: 13
|
|
color: menuItemMouseArea.containsMouse ? Theme.textPrimary : Theme.textSecondary
|
|
}
|
|
|
|
Text {
|
|
anchors.right: parent.right
|
|
anchors.rightMargin: 12
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
text: menuItem.shortcut
|
|
font.family: Theme.fontMono
|
|
font.pixelSize: 11
|
|
color: Theme.textMuted
|
|
visible: text !== ""
|
|
}
|
|
|
|
MouseArea {
|
|
id: menuItemMouseArea
|
|
anchors.fill: parent
|
|
hoverEnabled: true
|
|
onClicked: {
|
|
menuItem.triggered()
|
|
GlobalState.appleMenuVisible = false
|
|
}
|
|
}
|
|
}
|
|
|
|
component MenuSeparator: Item {
|
|
width: parent.width
|
|
height: 17
|
|
|
|
Rectangle {
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
anchors.left: parent.left
|
|
anchors.right: parent.right
|
|
anchors.leftMargin: 12
|
|
anchors.rightMargin: 12
|
|
height: 1
|
|
color: Theme.glassBorder
|
|
}
|
|
}
|
|
|
|
MenuItem {
|
|
text: "System Info..."
|
|
onTriggered: GlobalState.aboutMacVisible = true
|
|
}
|
|
|
|
MenuItem {
|
|
text: "System Preferences..."
|
|
onTriggered: {
|
|
let p = Qt.createQmlObject('import Quickshell.Io; Process { command: ["pavucontrol"] }', quickMenu)
|
|
p.running = true
|
|
}
|
|
}
|
|
|
|
MenuItem {
|
|
text: "Activity Monitor"
|
|
shortcut: "btop"
|
|
onTriggered: {
|
|
let p = Qt.createQmlObject('import Quickshell.Io; Process { command: ["foot", "-e", "btop"] }', quickMenu)
|
|
p.running = true
|
|
}
|
|
}
|
|
|
|
MenuSeparator {}
|
|
|
|
MenuItem {
|
|
text: "Sleep"
|
|
onTriggered: {
|
|
let p = Qt.createQmlObject('import Quickshell.Io; Process { command: ["systemctl", "suspend"] }', quickMenu)
|
|
p.running = true
|
|
}
|
|
}
|
|
|
|
MenuItem {
|
|
text: "Restart..."
|
|
onTriggered: {
|
|
let p = Qt.createQmlObject('import Quickshell.Io; Process { command: ["systemctl", "reboot"] }', quickMenu)
|
|
p.running = true
|
|
}
|
|
}
|
|
|
|
MenuItem {
|
|
text: "Shut Down..."
|
|
onTriggered: {
|
|
let p = Qt.createQmlObject('import Quickshell.Io; Process { command: ["systemctl", "poweroff"] }', quickMenu)
|
|
p.running = true
|
|
}
|
|
}
|
|
|
|
MenuSeparator {}
|
|
|
|
MenuItem {
|
|
text: "Lock Screen"
|
|
shortcut: "Super+L"
|
|
onTriggered: {
|
|
let p = Qt.createQmlObject('import Quickshell.Io; Process { command: ["hyprlock"] }', quickMenu)
|
|
p.running = true
|
|
}
|
|
}
|
|
|
|
MenuItem {
|
|
text: "Log Out"
|
|
shortcut: "Super+Shift+Q"
|
|
onTriggered: {
|
|
let p = Qt.createQmlObject('import Quickshell.Io; Process { command: ["hyprctl", "dispatch", "exit"] }', quickMenu)
|
|
p.running = true
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|