Harmonized PowerMenu with proper Style.xxx
This commit is contained in:
parent
d345e3fbc0
commit
eedea2e65b
2 changed files with 69 additions and 49 deletions
|
|
@ -122,7 +122,7 @@ Item {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
clip: true
|
clip: true
|
||||||
model: folderModel
|
model: folderModel
|
||||||
|
|
||||||
boundsBehavior: Flickable.StopAtBounds
|
boundsBehavior: Flickable.StopAtBounds
|
||||||
flickableDirection: Flickable.AutoFlickDirection
|
flickableDirection: Flickable.AutoFlickDirection
|
||||||
interactive: false
|
interactive: false
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@ NPanel {
|
||||||
visible: false
|
visible: false
|
||||||
|
|
||||||
// Anchors will be set by the parent component
|
// Anchors will be set by the parent component
|
||||||
|
|
||||||
function show() {
|
function show() {
|
||||||
visible = true
|
visible = true
|
||||||
}
|
}
|
||||||
|
|
@ -21,28 +20,29 @@ NPanel {
|
||||||
visible = false
|
visible = false
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close menu when clicking outside
|
|
||||||
Connections {
|
|
||||||
target: Quickshell
|
|
||||||
function onMousePressed() {
|
|
||||||
if (powerMenu.visible && !powerMenu.contains(Quickshell.mousePosition)) {
|
|
||||||
powerMenu.hide()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
width: 160 * scaling
|
width: 160 * scaling
|
||||||
height: 220 * scaling
|
height: 220 * scaling
|
||||||
color: Colors.surface
|
radius: Style.radiusMedium * scaling
|
||||||
radius: 8 * scaling
|
|
||||||
border.color: Colors.outline
|
border.color: Colors.outline
|
||||||
border.width: 1 * scaling
|
border.width: Math.max(1, Style.borderThin * scaling)
|
||||||
|
gradient: Gradient {
|
||||||
|
GradientStop {
|
||||||
|
position: 0.0
|
||||||
|
color: Colors.backgroundTertiary
|
||||||
|
}
|
||||||
|
GradientStop {
|
||||||
|
position: 1.0
|
||||||
|
color: Colors.backgroundSecondary
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
visible: true
|
visible: true
|
||||||
z: 9999
|
z: 9999
|
||||||
|
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.rightMargin: 32 * scaling
|
anchors.rightMargin: Style.marginLarge * scaling
|
||||||
anchors.topMargin: 86 * scaling
|
anchors.topMargin: 86 * scaling
|
||||||
|
|
||||||
// Prevent closing when clicking in the panel bg
|
// Prevent closing when clicking in the panel bg
|
||||||
|
|
@ -56,25 +56,27 @@ NPanel {
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: 8 * scaling
|
anchors.margins: Style.marginSmall * scaling
|
||||||
spacing: 4 * scaling
|
spacing: Style.marginTiny * scaling
|
||||||
|
|
||||||
|
// --------------
|
||||||
|
// Lock
|
||||||
Rectangle {
|
Rectangle {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.preferredHeight: 36 * scaling
|
Layout.preferredHeight: 36 * scaling
|
||||||
radius: 6 * scaling
|
radius: Style.radiusSmall * scaling
|
||||||
color: lockButtonArea.containsMouse ? Colors.accentPrimary : "transparent"
|
color: lockButtonArea.containsMouse ? Colors.accentPrimary : "transparent"
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
anchors.leftMargin: 12 * scaling
|
anchors.leftMargin: Style.marginMedium * scaling
|
||||||
anchors.rightMargin: 12 * scaling
|
anchors.rightMargin: Style.marginMedium * scaling
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
id: lockRow
|
id: lockRow
|
||||||
spacing: 8 * scaling
|
spacing: Style.marginSmall * scaling
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
@ -82,7 +84,10 @@ NPanel {
|
||||||
Text {
|
Text {
|
||||||
text: "lock_outline"
|
text: "lock_outline"
|
||||||
font.family: "Material Symbols Outlined"
|
font.family: "Material Symbols Outlined"
|
||||||
font.pixelSize: 16 * scaling
|
font.pointSize: Style.fontSizeLarge * scaling
|
||||||
|
font.variableAxes: {
|
||||||
|
"wght": (Font.Normal + Font.Bold) / 2.0
|
||||||
|
}
|
||||||
color: lockButtonArea.containsMouse ? Colors.onAccent : Colors.textPrimary
|
color: lockButtonArea.containsMouse ? Colors.onAccent : Colors.textPrimary
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
@ -91,7 +96,6 @@ NPanel {
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
text: "Lock Screen"
|
text: "Lock Screen"
|
||||||
font.pixelSize: 14 * scaling
|
|
||||||
color: lockButtonArea.containsMouse ? Colors.onAccent : Colors.textPrimary
|
color: lockButtonArea.containsMouse ? Colors.onAccent : Colors.textPrimary
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
@ -114,22 +118,24 @@ NPanel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// --------------
|
||||||
|
// Suspend
|
||||||
Rectangle {
|
Rectangle {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.preferredHeight: 36 * scaling
|
Layout.preferredHeight: 36 * scaling
|
||||||
radius: 6 * scaling
|
radius: Style.radiusSmall * scaling
|
||||||
color: suspendButtonArea.containsMouse ? Colors.accentPrimary : "transparent"
|
color: suspendButtonArea.containsMouse ? Colors.accentPrimary : "transparent"
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
anchors.leftMargin: 12 * scaling
|
anchors.leftMargin: Style.marginMedium * scaling
|
||||||
anchors.rightMargin: 12 * scaling
|
anchors.rightMargin: Style.marginMedium * scaling
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
id: suspendRow
|
id: suspendRow
|
||||||
spacing: 8 * scaling
|
spacing: Style.marginSmall * scaling
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
@ -137,7 +143,10 @@ NPanel {
|
||||||
Text {
|
Text {
|
||||||
text: "bedtime"
|
text: "bedtime"
|
||||||
font.family: "Material Symbols Outlined"
|
font.family: "Material Symbols Outlined"
|
||||||
font.pixelSize: 16 * scaling
|
font.pointSize: Style.fontSizeLarge * scaling
|
||||||
|
font.variableAxes: {
|
||||||
|
"wght": (Font.Normal + Font.Bold) / 2.0
|
||||||
|
}
|
||||||
color: suspendButtonArea.containsMouse ? Colors.onAccent : Colors.textPrimary
|
color: suspendButtonArea.containsMouse ? Colors.onAccent : Colors.textPrimary
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
@ -146,7 +155,6 @@ NPanel {
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
text: "Suspend"
|
text: "Suspend"
|
||||||
font.pixelSize: 14 * scaling
|
|
||||||
color: suspendButtonArea.containsMouse ? Colors.onAccent : Colors.textPrimary
|
color: suspendButtonArea.containsMouse ? Colors.onAccent : Colors.textPrimary
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
@ -168,22 +176,24 @@ NPanel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// --------------
|
||||||
|
// Reboot
|
||||||
Rectangle {
|
Rectangle {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.preferredHeight: 36 * scaling
|
Layout.preferredHeight: 36 * scaling
|
||||||
radius: 6 * scaling
|
radius: Style.radiusSmall * scaling
|
||||||
color: rebootButtonArea.containsMouse ? Colors.accentPrimary : "transparent"
|
color: rebootButtonArea.containsMouse ? Colors.accentPrimary : "transparent"
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
anchors.leftMargin: 12 * scaling
|
anchors.leftMargin: Style.marginMedium * scaling
|
||||||
anchors.rightMargin: 12 * scaling
|
anchors.rightMargin: Style.marginMedium * scaling
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
id: rebootRow
|
id: rebootRow
|
||||||
spacing: 8 * scaling
|
spacing: Style.marginSmall * scaling
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
@ -191,7 +201,10 @@ NPanel {
|
||||||
Text {
|
Text {
|
||||||
text: "refresh"
|
text: "refresh"
|
||||||
font.family: "Material Symbols Outlined"
|
font.family: "Material Symbols Outlined"
|
||||||
font.pixelSize: 16 * scaling
|
font.pointSize: Style.fontSizeLarge * scaling
|
||||||
|
font.variableAxes: {
|
||||||
|
"wght": (Font.Normal + Font.Bold) / 2.0
|
||||||
|
}
|
||||||
color: rebootButtonArea.containsMouse ? Colors.onAccent : Colors.textPrimary
|
color: rebootButtonArea.containsMouse ? Colors.onAccent : Colors.textPrimary
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
@ -200,7 +213,6 @@ NPanel {
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
text: "Reboot"
|
text: "Reboot"
|
||||||
font.pixelSize: 14 * scaling
|
|
||||||
color: rebootButtonArea.containsMouse ? Colors.onAccent : Colors.textPrimary
|
color: rebootButtonArea.containsMouse ? Colors.onAccent : Colors.textPrimary
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
@ -222,22 +234,24 @@ NPanel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// --------------
|
||||||
|
// Logout
|
||||||
Rectangle {
|
Rectangle {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.preferredHeight: 36 * scaling
|
Layout.preferredHeight: 36 * scaling
|
||||||
radius: 6 * scaling
|
radius: Style.radiusSmall * scaling
|
||||||
color: logoutButtonArea.containsMouse ? Colors.accentPrimary : "transparent"
|
color: logoutButtonArea.containsMouse ? Colors.accentPrimary : "transparent"
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
anchors.leftMargin: 12 * scaling
|
anchors.leftMargin: Style.marginMedium * scaling
|
||||||
anchors.rightMargin: 12 * scaling
|
anchors.rightMargin: Style.marginMedium * scaling
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
id: logoutRow
|
id: logoutRow
|
||||||
spacing: 8 * scaling
|
spacing: Style.marginSmall * scaling
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
@ -245,7 +259,10 @@ NPanel {
|
||||||
Text {
|
Text {
|
||||||
text: "exit_to_app"
|
text: "exit_to_app"
|
||||||
font.family: "Material Symbols Outlined"
|
font.family: "Material Symbols Outlined"
|
||||||
font.pixelSize: 16 * scaling
|
font.pointSize: Style.fontSizeLarge * scaling
|
||||||
|
font.variableAxes: {
|
||||||
|
"wght": (Font.Normal + Font.Bold) / 2.0
|
||||||
|
}
|
||||||
color: logoutButtonArea.containsMouse ? Colors.onAccent : Colors.textPrimary
|
color: logoutButtonArea.containsMouse ? Colors.onAccent : Colors.textPrimary
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
@ -254,7 +271,6 @@ NPanel {
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
text: "Logout"
|
text: "Logout"
|
||||||
font.pixelSize: 14 * scaling
|
|
||||||
color: logoutButtonArea.containsMouse ? Colors.onAccent : Colors.textPrimary
|
color: logoutButtonArea.containsMouse ? Colors.onAccent : Colors.textPrimary
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
@ -276,22 +292,24 @@ NPanel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// --------------
|
||||||
|
// Shutdown
|
||||||
Rectangle {
|
Rectangle {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.preferredHeight: 36 * scaling
|
Layout.preferredHeight: 36 * scaling
|
||||||
radius: 6 * scaling
|
radius: Style.radiusSmall * scaling
|
||||||
color: shutdownButtonArea.containsMouse ? Colors.accentPrimary : "transparent"
|
color: shutdownButtonArea.containsMouse ? Colors.accentPrimary : "transparent"
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
anchors.leftMargin: 12 * scaling
|
anchors.leftMargin: Style.marginMedium * scaling
|
||||||
anchors.rightMargin: 12 * scaling
|
anchors.rightMargin: Style.marginMedium * scaling
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
id: shutdownRow
|
id: shutdownRow
|
||||||
spacing: 8 * scaling
|
spacing: Style.marginSmall * scaling
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
@ -299,7 +317,10 @@ NPanel {
|
||||||
Text {
|
Text {
|
||||||
text: "power_settings_new"
|
text: "power_settings_new"
|
||||||
font.family: "Material Symbols Outlined"
|
font.family: "Material Symbols Outlined"
|
||||||
font.pixelSize: 16 * scaling
|
font.pointSize: Style.fontSizeLarge * scaling
|
||||||
|
font.variableAxes: {
|
||||||
|
"wght": (Font.Normal + Font.Bold) / 2.0
|
||||||
|
}
|
||||||
color: shutdownButtonArea.containsMouse ? Colors.onAccent : Colors.textPrimary
|
color: shutdownButtonArea.containsMouse ? Colors.onAccent : Colors.textPrimary
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
@ -308,7 +329,6 @@ NPanel {
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
text: "Shutdown"
|
text: "Shutdown"
|
||||||
font.pixelSize: 14 * scaling
|
|
||||||
color: shutdownButtonArea.containsMouse ? Colors.onAccent : Colors.textPrimary
|
color: shutdownButtonArea.containsMouse ? Colors.onAccent : Colors.textPrimary
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
@ -397,4 +417,4 @@ NPanel {
|
||||||
command: ["loginctl", "terminate-user", Quickshell.env("USER")]
|
command: ["loginctl", "terminate-user", Quickshell.env("USER")]
|
||||||
running: false
|
running: false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue