Files
glassMxrph/quickshell/controlcenter/modules/Power.qml
T
mxandClaude Opus 5.5 99e64a7713 Add glassMxrph shell sources
Initial commit of the Quickshell desktop suite: bar, dock, launcher,
settings, Control Center, dashboard, OSD, lock screen, desktop widgets,
plugin host with the vendored Noctalia/Omarchy compatibility layer,
helpers, packaging, tests and phase documentation.

Includes the optimization work so far: usage widgets and dashboard
gauges no longer animate continuously, desktop widgets pause while
covered, system controls stop flickering on background polls, dock app
matching uses an indexed catalog, and workspace ghosts are created only
for occupied slots.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 22:36:17 +02:00

92 lines
3.0 KiB
QML

pragma ComponentBehavior: Bound
import QtQuick
import QtQuick.Layouts
import ".."
import "../../components"
import "../../services"
import "../../theme"
ControlCard {
id: root
Component.onDestruction: PowerService.cancel()
RowLayout {
Layout.fillWidth: true
spacing: 4
Repeater {
model: [
{
id: "lock",
glyph: "󰌾"
},
{
id: "logout",
glyph: "󰍃"
},
{
id: "suspend",
glyph: "󰤄"
},
{
id: "reboot",
glyph: "󰜉"
},
{
id: "shutdown",
glyph: "󰐥"
}
]
ColumnLayout {
id: action
required property var modelData
readonly property string label: modelData.id === "logout" ? "Log out" : modelData.id === "shutdown" ? "Shut down" : modelData.id.charAt(0).toUpperCase() + modelData.id.slice(1)
Layout.fillWidth: true
Layout.preferredWidth: 1
spacing: 4
CCToggle {
objectName: "power-" + action.modelData.id
Layout.alignment: Qt.AlignHCenter
size: 38
glyph: action.modelData.glyph
fallback: action.label.charAt(0)
checked: PowerService.pending === action.modelData.id
enabled: (action.modelData.id === "lock" && ConfigService.ready && ConfigService.data.lock.enabled) || (!!SystemService.state.power && !!SystemService.state.power[action.modelData.id] && !SystemService.acting)
onClicked: PowerService.request(action.modelData.id)
Accessible.name: action.label
}
Text {
text: action.label
color: Theme.textSecondary
font.pixelSize: 10
elide: Text.ElideRight
horizontalAlignment: Text.AlignHCenter
Layout.fillWidth: true
}
}
}
}
RowLayout {
visible: PowerService.pending !== ""
Layout.fillWidth: true
spacing: 8
Text {
text: "Confirm " + PowerService.pending + "? Unsaved work may be lost."
color: Theme.text
font.pixelSize: 12
wrapMode: Text.Wrap
Layout.fillWidth: true
}
GlassButton {
objectName: "powerCancel"
text: "Cancel"
onClicked: PowerService.cancel()
}
GlassButton {
objectName: "powerConfirm"
text: "Confirm"
accented: true
enabled: !SystemService.acting
onClicked: PowerService.confirm()
}
}
}