waffles: add lock screen, fix ctrl alt del screen for light mode

This commit is contained in:
end-4
2025-12-09 23:05:48 +01:00
parent bfe97c1c05
commit fdbe39d744
14 changed files with 441 additions and 59 deletions
@@ -0,0 +1,76 @@
import qs
import qs.services
import qs.modules.common
import qs.modules.common.widgets
import qs.modules.common.functions
import qs.modules.waffle.looks
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import Quickshell
import Quickshell.Io
WSessionScreenTextButton {
id: root
implicitWidth: 40
implicitHeight: 40
focusRingRadius: Looks.radius.large
colBackground: ColorUtils.transparentize(Looks.darkColors.bg2)
colBackgroundHover: Looks.applyContentTransparency(Looks.darkColors.bg2Hover)
colBackgroundActive: Looks.applyContentTransparency(Looks.darkColors.bg2Active)
property color color: {
if (root.down) {
return root.colBackgroundActive;
} else if (root.hovered) {
return root.colBackgroundHover;
} else {
return root.colBackground;
}
}
background: Rectangle {
id: background
radius: Looks.radius.medium
color: root.color
}
contentItem: Item {
FluentIcon {
anchors.centerIn: parent
implicitSize: 20
icon: "power"
color: root.fgColor
}
}
onClicked: {
powerMenu.visible = !powerMenu.visible;
}
WMenu {
id: powerMenu
x: -powerMenu.implicitWidth / 2 + root.implicitWidth / 2
y: -powerMenu.implicitHeight
color: Looks.darkColors.bg1Base
Component.onCompleted: {
powerMenu.backgroundPane.borderColor = Looks.applyContentTransparency(Looks.darkColors.bg2Border);
}
delegate: WMenuItem {
id: menuItemDelegate
colBackground: ColorUtils.transparentize(Looks.darkColors.bg1Base)
colBackgroundHover: Looks.applyContentTransparency(Looks.darkColors.bg2Hover)
colBackgroundActive: Looks.applyContentTransparency(Looks.darkColors.bg2Active)
colForeground: Looks.darkColors.fg
}
Action {
icon.name: "power"
text: Translation.tr("Shut down")
onTriggered: Session.poweroff()
}
Action {
icon.name: "arrow-counterclockwise"
text: Translation.tr("Restart")
onTriggered: Session.reboot()
}
}
}
@@ -8,7 +8,6 @@ import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import Quickshell
import Quickshell.Io
Item {
id: root
@@ -94,63 +93,13 @@ Item {
}
}
component PowerButton: WSessionScreenTextButton {
id: root
implicitWidth: 40
implicitHeight: 40
focusRingRadius: Looks.radius.large
colBackgroundHover: Looks.colors.bg2Hover
colBackgroundActive: Looks.colors.bg2Active
property color color: {
if (root.down) {
return root.colBackgroundActive;
} else if (root.hovered) {
return root.colBackgroundHover;
} else {
return root.colBackground;
}
}
background: Rectangle {
id: background
radius: Looks.radius.medium
color: root.color
}
contentItem: Item {
FluentIcon {
anchors.centerIn: parent
implicitSize: 20
icon: "power"
}
}
onClicked: {
powerMenu.visible = !powerMenu.visible;
}
WMenu {
id: powerMenu
x: -powerMenu.implicitWidth / 2 + root.implicitWidth / 2
y: -powerMenu.implicitHeight
Action {
icon.name: "power"
text: Translation.tr("Shut down")
onTriggered: Session.poweroff()
}
Action {
icon.name: "arrow-counterclockwise"
text: Translation.tr("Restart")
onTriggered: Session.reboot()
}
}
}
component CancelButton: WBorderlessButton {
id: root
implicitHeight: 32
colBackground: Looks.colors.bg1Base
colBackgroundHover: Qt.lighter(Looks.colors.bg1Base, 1.2)
colBackgroundActive: Qt.lighter(Looks.colors.bg1Base, 1.1)
colBackground: Looks.darkColors.bg1Base
colBackgroundHover: Qt.lighter(Looks.darkColors.bg1Base, 1.2)
colBackgroundActive: Qt.lighter(Looks.darkColors.bg1Base, 1.1)
colForeground: Looks.darkColors.fg
property bool keyboardDown: false
@@ -172,6 +121,7 @@ Item {
text: Translation.tr("Cancel")
horizontalAlignment: Text.AlignHCenter
font.pixelSize: Looks.font.pixelSize.large
color: root.colForeground
}
Rectangle {
@@ -12,6 +12,7 @@ WTextButton {
property bool keyboardDown: false
property alias focusRingRadius: focusRing.radius
fgColor: (root.pressed || root.keyboardDown) ? Looks.darkColors.fg1 : Looks.darkColors.fg
Keys.onPressed: event => {
if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) {
@@ -34,7 +35,7 @@ WTextButton {
WText {
id: buttonText
anchors.fill: parent
color: (root.pressed || root.keyboardDown) ? Looks.colors.fg1 : Looks.colors.fg
color: root.fgColor
text: root.text
font.pixelSize: Looks.font.pixelSize.large
}