Regenerated

This commit is contained in:
2026-05-01 12:11:07 +02:00
parent ea485ac930
commit b9b4692713
3 changed files with 701 additions and 452 deletions
+99 -16
View File
@@ -3709,7 +3709,8 @@ ShellRoot {
// ── State ──────────────────────────────────────────────────────────────
property string activeProfile: "balanced" // performance | balanced | powersave
property bool lidClose: true
// lid mode: "suspend" | "ignore_external" | "ignore"
property string lidMode: "suspend"
property bool wifiPower: true
property bool bluetoothOff: false
property string statusMsg: ""
@@ -3833,11 +3834,30 @@ ShellRoot {
showStatus("Bluetooth " + (v ? "disabled" : "enabled"), true)
}
function toggleLid(v) {
lidClose = v
run(["bash", "-c",
"loginctl set-handle-lid-switch " + (v ? "suspend" : "ignore")])
showStatus("Lid close → " + (v ? "suspend" : "ignore"), true)
function setLidMode(mode) {
lidMode = mode
// "suspend" = always suspend on lid close
// "ignore_external" = suspend normally, but ignore when ext monitor attached
// "ignore" = never suspend on lid close
if (mode === "suspend") {
run(["bash", "-c",
"loginctl set-handle-lid-switch suspend && " +
"loginctl set-handle-lid-switch-external-power suspend"])
} else if (mode === "ignore_external") {
run(["bash", "-c",
"loginctl set-handle-lid-switch suspend && " +
"loginctl set-handle-lid-switch-external-power ignore"])
} else {
run(["bash", "-c",
"loginctl set-handle-lid-switch ignore && " +
"loginctl set-handle-lid-switch-external-power ignore"])
}
var labels = {
"suspend": "always suspend",
"ignore_external": "ignore when monitor attached",
"ignore": "never suspend"
}
showStatus("Lid close → " + labels[mode], true)
}
// ── Processes ──────────────────────────────────────────────────────────
@@ -4042,11 +4062,9 @@ ShellRoot {
// ── Toggles ─────────────────────────────────────────────
SectionLabel { label: "Settings" }
ToggleRow {
label: "Suspend on lid close"
icon: "💻"
checked: lidClose
onToggled: (v) => toggleLid(v)
LidModeRow {
value: lidMode
onPicked: (m) => setLidMode(m)
}
ToggleRow {
label: "WiFi power saving"
@@ -4100,11 +4118,11 @@ ShellRoot {
component SectionLabel: Text {
required property string label
text: label.toUpperCase()
color: colors.overlay0
font.pixelSize: 10
font.bold: true
letterSpacing: 1.2
text: label.toUpperCase()
color: colors.overlay0
font.pixelSize: 10
font.bold: true
font.letterSpacing: 1.2
}
component ProfileButton: Rectangle {
@@ -4289,6 +4307,71 @@ ShellRoot {
onClicked: parent.clicked()
}
}
component LidModeRow: ColumnLayout {
required property string value
signal picked(string m)
Layout.fillWidth: true
spacing: 6
RowLayout {
spacing: 8
Text { text: "💻"; font.pixelSize: 14 }
Text {
text: "Lid close behaviour"
color: colors.subtext1
font.pixelSize: 12
}
}
RowLayout {
Layout.fillWidth: true
spacing: 6
Repeater {
model: [
{ key: "suspend", label: "Always suspend", icon: "💤" },
{ key: "ignore_external", label: "Ignore w/ monitor", icon: "🖥" },
{ key: "ignore", label: "Never suspend", icon: "🚫" }
]
delegate: Rectangle {
readonly property bool sel: value === modelData.key
Layout.fillWidth: true
height: 44
radius: 8
color: sel ? Qt.rgba(colors.teal.r, colors.teal.g, colors.teal.b, 0.15) : colors.surface0
border.color: sel ? colors.teal : "transparent"
border.width: 1
Behavior on color { ColorAnimation { duration: 120 } }
ColumnLayout {
anchors.centerIn: parent
spacing: 1
Text {
Layout.alignment: Qt.AlignHCenter
text: modelData.icon
font.pixelSize: 14
}
Text {
Layout.alignment: Qt.AlignHCenter
text: modelData.label
color: sel ? colors.teal : colors.subtext0
font.pixelSize: 9
font.bold: sel
}
}
MouseArea {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: picked(modelData.key)
}
}
}
}
}
}
#+END_SRC