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
+498 -415
View File
File diff suppressed because it is too large Load Diff
+94 -11
View File
@@ -3709,7 +3709,8 @@ ShellRoot {
// ── State ────────────────────────────────────────────────────────────── // ── State ──────────────────────────────────────────────────────────────
property string activeProfile: "balanced" // performance | balanced | powersave 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 wifiPower: true
property bool bluetoothOff: false property bool bluetoothOff: false
property string statusMsg: "" property string statusMsg: ""
@@ -3833,11 +3834,30 @@ ShellRoot {
showStatus("Bluetooth " + (v ? "disabled" : "enabled"), true) showStatus("Bluetooth " + (v ? "disabled" : "enabled"), true)
} }
function toggleLid(v) { function setLidMode(mode) {
lidClose = v 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", run(["bash", "-c",
"loginctl set-handle-lid-switch " + (v ? "suspend" : "ignore")]) "loginctl set-handle-lid-switch suspend && " +
showStatus("Lid close → " + (v ? "suspend" : "ignore"), true) "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 ────────────────────────────────────────────────────────── // ── Processes ──────────────────────────────────────────────────────────
@@ -4042,11 +4062,9 @@ ShellRoot {
// ── Toggles ───────────────────────────────────────────── // ── Toggles ─────────────────────────────────────────────
SectionLabel { label: "Settings" } SectionLabel { label: "Settings" }
ToggleRow { LidModeRow {
label: "Suspend on lid close" value: lidMode
icon: "💻" onPicked: (m) => setLidMode(m)
checked: lidClose
onToggled: (v) => toggleLid(v)
} }
ToggleRow { ToggleRow {
label: "WiFi power saving" label: "WiFi power saving"
@@ -4104,7 +4122,7 @@ ShellRoot {
color: colors.overlay0 color: colors.overlay0
font.pixelSize: 10 font.pixelSize: 10
font.bold: true font.bold: true
letterSpacing: 1.2 font.letterSpacing: 1.2
} }
component ProfileButton: Rectangle { component ProfileButton: Rectangle {
@@ -4289,6 +4307,71 @@ ShellRoot {
onClicked: parent.clicked() 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 #+END_SRC
@@ -47,7 +47,8 @@ ShellRoot {
// State // State
property string activeProfile: "balanced" // performance | balanced | powersave 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 wifiPower: true
property bool bluetoothOff: false property bool bluetoothOff: false
property string statusMsg: "" property string statusMsg: ""
@@ -171,11 +172,30 @@ ShellRoot {
showStatus("Bluetooth " + (v ? "disabled" : "enabled"), true) showStatus("Bluetooth " + (v ? "disabled" : "enabled"), true)
} }
function toggleLid(v) { function setLidMode(mode) {
lidClose = v 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", run(["bash", "-c",
"loginctl set-handle-lid-switch " + (v ? "suspend" : "ignore")]) "loginctl set-handle-lid-switch suspend && " +
showStatus("Lid close → " + (v ? "suspend" : "ignore"), true) "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 // Processes
@@ -380,11 +400,9 @@ ShellRoot {
// Toggles // Toggles
SectionLabel { label: "Settings" } SectionLabel { label: "Settings" }
ToggleRow { LidModeRow {
label: "Suspend on lid close" value: lidMode
icon: "💻" onPicked: (m) => setLidMode(m)
checked: lidClose
onToggled: (v) => toggleLid(v)
} }
ToggleRow { ToggleRow {
label: "WiFi power saving" label: "WiFi power saving"
@@ -442,7 +460,7 @@ ShellRoot {
color: colors.overlay0 color: colors.overlay0
font.pixelSize: 10 font.pixelSize: 10
font.bold: true font.bold: true
letterSpacing: 1.2 font.letterSpacing: 1.2
} }
component ProfileButton: Rectangle { component ProfileButton: Rectangle {
@@ -627,4 +645,69 @@ ShellRoot {
onClicked: parent.clicked() 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)
}
}
}
}
}
} }