Krolyxon
Commit bfdf41e

Branches

Refs →

aurorabfdf41e

aurora: don't touch PowerProfiles until ppd is running (hung startup)

Author
krolyxon
Date
2026-10-27 09:53 +0530
Parent
45dccf9
Commit
bfdf41ef410573c86af54ecc22d4bbcb05a82bdf

+18 −6

3 files changed

  1. M .config/quickshell/aurora/Battery.qml +16 −4
  2. M .config/quickshell/aurora/SetPower.qml +1 −1
  3. M .config/quickshell/aurora/SysPage.qml +1 −1
M .config/quickshell/aurora/Battery.qml View
@@ -96,29 +96,41 @@ Singleton {
9696 }
9797
9898 // ---- power-profiles-daemon present? (Quickshell's PowerProfiles has no "available" flag)
99+ // Don't touch PowerProfiles before it is: reading it D-Bus-activates ppd and blocks the whole shell until it
100+ // runs, and ppd is After=multi-user.target (which waits on network-online), so that can be 30s+ after login.
99101 property bool hasProfiles: false
102+ readonly property bool hasPerf: hasProfiles && PowerProfiles.hasPerformanceProfile
103+ property int ppdTries: 0
100104 Process {
105+ id: ppdCheck
101106 command: ["busctl", "--system", "status", "org.freedesktop.UPower.PowerProfiles"]
102107 running: true
103108 stdout: StdioCollector {}
104− onExited: code => { root.hasProfiles = code === 0; root.applyAuto() }
109+ onExited: code => { root.ppdTries++; root.hasProfiles = code === 0; root.applyAuto() }
110+ }
111+ // keep looking for ~2 min after start
112+ Timer {
113+ interval: 5000
114+ repeat: true
115+ running: !root.hasProfiles && root.ppdTries < 24
116+ onTriggered: if (!ppdCheck.running) ppdCheck.running = true
105117 }
106118
107119 // ---- power profile: saver | balanced | performance (set in ppd, which remembers it), or auto =
108120 // Settings.powerAc / powerBat, switched when the power source changes
109− readonly property string profile: Settings.powerAuto ? "auto" : nameOf(PowerProfiles.profile)
121+ readonly property string profile: Settings.powerAuto ? "auto" : hasProfiles ? nameOf(PowerProfiles.profile) : "balanced"
110122 function nameOf(p) {
111123 return p === PowerProfile.PowerSaver ? "saver" : p === PowerProfile.Performance ? "performance" : "balanced"
112124 }
113125 function profileOf(name) {
114126 if (name === "saver") return PowerProfile.PowerSaver
115− if (name === "performance" && PowerProfiles.hasPerformanceProfile) return PowerProfile.Performance
127+ if (name === "performance" && hasPerf) return PowerProfile.Performance
116128 return PowerProfile.Balanced
117129 }
118130 function setProfile(name) {
119131 Settings.powerAuto = name === "auto"
120132 if (name === "auto") applyAuto()
121− else PowerProfiles.profile = profileOf(name)
133+ else if (hasProfiles) PowerProfiles.profile = profileOf(name)
122134 }
123135 function applyAuto() {
124136 if (!started || !hasProfiles || !Settings.powerAuto) return
M .config/quickshell/aurora/SetPower.qml View
@@ -11,7 +11,7 @@ Flickable {
1111 boundsBehavior: Flickable.StopAtBounds
1212
1313 readonly property var profiles: [{ value: "saver", label: "saver" }, { value: "balanced", label: "balanced" }]
14− .concat(PowerProfiles.hasPerformanceProfile ? [{ value: "performance", label: "performance" }] : [])
14+ .concat(Battery.hasPerf ? [{ value: "performance", label: "performance" }] : [])
1515
1616 // seconds -> "2m 30s" / "never"
1717 function dur(s) {
M .config/quickshell/aurora/SysPage.qml View
@@ -114,7 +114,7 @@ Flickable {
114114 }
115115 IconBtn {
116116 Layout.fillWidth: true
117− visible: PowerProfiles.hasPerformanceProfile
117+ visible: Battery.hasPerf
118118 icon: Theme.iSpeed
119119 label: "perf"
120120 active: Battery.profile === "performance"