feat: redesign quickshell menus
This commit is contained in:
1 parent
f15d5bb6ac
commit
ab09d46e66
16 files changed
+645
-1076
No files matched your search
@@ -0,0 +1,178 @@
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Wayland
|
||||
import Quickshell.Hyprland
|
||||
import Quickshell.Services.SystemTray
|
||||
import Quickshell.Io
|
||||
import "../Shared"
|
||||
|
||||
PanelWindow {
|
||||
id: barWindow
|
||||
|
||||
// Reference to global state
|
||||
property QtObject rootState
|
||||
|
||||
anchors {
|
||||
top: true
|
||||
left: true
|
||||
right: true
|
||||
}
|
||||
|
||||
margins {
|
||||
top: Theme.geometry.padding
|
||||
left: Theme.geometry.padding
|
||||
right: Theme.geometry.padding
|
||||
}
|
||||
|
||||
exclusiveZone: implicitHeight + margins.top + Theme.geometry.padding
|
||||
|
||||
implicitHeight: 40
|
||||
color: "transparent"
|
||||
|
||||
WlrLayershell.layer: WlrLayer.Top
|
||||
WlrLayershell.namespace: "quickshell-bar"
|
||||
|
||||
// Left Pill (Workspaces + Battery)
|
||||
Rectangle {
|
||||
id: leftPill
|
||||
anchors.left: parent.left
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
height: parent.height
|
||||
width: leftPillRow.width + Theme.geometry.padding * 2
|
||||
radius: Theme.geometry.pillRadius
|
||||
color: Theme.colors.surface
|
||||
border.color: Theme.colors.border
|
||||
border.width: 1
|
||||
|
||||
Row {
|
||||
id: leftPillRow
|
||||
anchors.centerIn: parent
|
||||
spacing: Theme.geometry.spacing
|
||||
|
||||
// Workspaces
|
||||
Row {
|
||||
spacing: Theme.geometry.spacing
|
||||
Repeater {
|
||||
model: Hyprland.workspaces.values
|
||||
|
||||
delegate: Rectangle {
|
||||
width: 24
|
||||
height: 24
|
||||
radius: 12
|
||||
color: modelData.active ? Theme.colors.primary : Theme.colors.surfaceHover
|
||||
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
text: modelData.id
|
||||
color: modelData.active ? Theme.colors.background : Theme.colors.text
|
||||
font.family: Theme.font.family
|
||||
font.pixelSize: 12
|
||||
font.bold: modelData.active
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: modelData.activate()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Center Pill (Clock)
|
||||
Rectangle {
|
||||
id: centerPill
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
height: parent.height
|
||||
width: clockText.width + Theme.geometry.padding * 4
|
||||
radius: Theme.geometry.pillRadius
|
||||
color: Theme.colors.surface
|
||||
border.color: Theme.colors.border
|
||||
border.width: 1
|
||||
|
||||
SystemClock {
|
||||
id: clock
|
||||
precision: SystemClock.Minutes
|
||||
}
|
||||
|
||||
Text {
|
||||
id: clockText
|
||||
anchors.centerIn: parent
|
||||
text: Qt.formatDateTime(clock.date, "hh:mm") // 24h format
|
||||
color: Theme.colors.text
|
||||
font.family: Theme.font.family
|
||||
font.bold: true
|
||||
}
|
||||
}
|
||||
|
||||
// Right Pill (Tray / System)
|
||||
Rectangle {
|
||||
id: rightPill
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
height: parent.height
|
||||
width: trayRow.width + Theme.geometry.padding * 4
|
||||
radius: Theme.geometry.pillRadius
|
||||
color: Theme.colors.surface
|
||||
border.color: Theme.colors.border
|
||||
border.width: 1
|
||||
|
||||
Row {
|
||||
id: trayRow
|
||||
anchors.centerIn: parent
|
||||
spacing: Theme.geometry.spacing
|
||||
|
||||
Repeater {
|
||||
model: SystemTray.items.values
|
||||
|
||||
delegate: Image {
|
||||
width: 20
|
||||
height: 20
|
||||
source: modelData.icon.name || ""
|
||||
visible: source != ""
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton
|
||||
onClicked: (mouse) => {
|
||||
if (mouse.button === Qt.LeftButton) modelData.activate();
|
||||
else if (mouse.button === Qt.RightButton) modelData.contextMenu();
|
||||
else if (mouse.button === Qt.MiddleButton) modelData.secondaryActivate();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
width: 1
|
||||
height: 20
|
||||
color: Theme.colors.border
|
||||
visible: SystemTray.items.values.length > 0
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
width: 24
|
||||
height: 24
|
||||
radius: 12
|
||||
color: rootState.commandPaletteOpen ? Theme.colors.primary : "transparent"
|
||||
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
text: "☰"
|
||||
color: rootState.commandPaletteOpen ? Theme.colors.background : Theme.colors.text
|
||||
font.pixelSize: 14
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: rootState.toggleCommandPalette()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user