fixes waybar, adds quickshell

This commit is contained in:
2026-05-04 15:32:47 +02:00
parent 5e55b51220
commit bd17b76c30
34 changed files with 995 additions and 1217 deletions
@@ -0,0 +1,59 @@
// PowerProfilesWidget.qml - ⚡/⚖/🔋 + click-to-cycle
import QtQuick
import Quickshell.Io
import ".."
Pill {
id: root
property string profile: "balanced"
readonly property var profileOrder: ["performance", "balanced", "power-saver"]
readonly property var icons: ({
"performance": "⚡",
"balanced": "⚖",
"power-saver": "🔋",
})
onClicked: (m) => {
if (m.button !== Qt.LeftButton) return;
const i = profileOrder.indexOf(root.profile);
const next = profileOrder[(i + 1) % profileOrder.length];
setProc.command = ["powerprofilesctl", "set", next];
setProc.running = true;
root.profile = next; // optimistic update
}
Text {
text: (root.icons[root.profile] ?? "⚡")
font.family: Theme.fontSans
font.pixelSize: Theme.fontSize
color: Theme.foreground
}
// Read current profile periodically
Process {
id: readProc
running: false
command: ["powerprofilesctl", "get"]
stdout: SplitParser {
onRead: (line) => root.profile = line.trim()
}
onExited: readProc.running = false
}
// Setter - command is rewritten on each click
Process {
id: setProc
running: false
command: ["true"]
onExited: setProc.running = false
}
Timer {
interval: 2000
running: true
repeat: true
triggeredOnStart: true
onTriggered: readProc.running = true
}
}