Skip to content

fix(powerprofiles): stop spawning powerprofilesctl from list and set - #19

Open
mark-groves wants to merge 3 commits into
quattrofrom
fix/powerprofiles-busctl
Open

mark-groves wants to merge 3 commits into
quattrofrom
fix/powerprofiles-busctl

Conversation

@mark-groves

@mark-groves mark-groves commented Sep 13, 2026

Copy link
Copy Markdown
Owner

Why

PR 17 stopped the battery service from running powerprofilesctl get every two seconds. That was the command line on every recent SIGSEGV. omarchy-powerprofiles-list and omarchy-powerprofiles-set still started the same PyGObject script. The power panel calls list every five seconds while it is open.

This change reads Profiles and ActiveProfile through busctl, then writes the profile with set-property. No Python interpreter starts.

Scope

  • bin/omarchy-powerprofiles-list
  • bin/omarchy-powerprofiles-set
  • shell/plugins/menu/Menu.qml (unused power-profiles provider)
  • test/shell.d/powerprofiles-list-test.sh
  • test/shell.d/powerprofiles-set-test.sh

Out of scope: the 2s busctl poll in Service.qml, already landed in PR 17. No upstream PR until this has been tried on the fork.

Tradeoffs

A shared helper was not added. List and set call busctl the same way the battery poll already does. A D-Bus subscription would replace the panel's 5s refresh and is more code than this leftover needs.

Blast Radius

Anyone who opens the power panel or plugs in AC hits these two commands. The printed list on this machine matches the old powerprofilesctl order. If power-profiles-daemon is down, list still exits 0 with no rows.

Verification

  • ./test/shell.d/powerprofiles-list-test.sh failed before the fix (powerprofilesctl bomb, empty output), then passed.
  • ./test/shell.d/powerprofiles-set-test.sh passed after the mock moved to busctl set-property.
  • ./test/shell.d/menu-test.sh and ./test/shell.d/video-background-test.sh passed.
  • Live omarchy-powerprofiles-list --active-state still prints power-saver 1 / balanced 0 / performance 0 with a powerprofilesctl bomb on PATH.

Note

Medium Risk
Changes how AC/battery profile selection is applied system-wide via D-Bus; behavior should match the daemon but any busctl/jq parsing mismatch could mis-list profiles or fail to set them.

Overview
Power profile list/set no longer spawn powerprofilesctl (the PyGObject CLI that was implicated in SIGSEGVs). omarchy-powerprofiles-list and omarchy-powerprofiles-set now talk to net.hadess.PowerProfiles over D-Bus via busctl—reading Profiles / ActiveProfile with jq, and writing the active profile with set-property—so the power panel’s periodic refresh does not start a Python interpreter.

The unused power-profiles dynamic menu provider is removed from Menu.qml. Shell tests are updated: mocks assert powerprofilesctl is never invoked, new coverage for list output/--active-state, and set tests expect profile changes to go through Panel.qml rather than the menu.

Reviewed by Cursor Bugbot for commit 8ffb448. Configure here.

A PATH bomb on powerprofilesctl must still produce the daemon's profile names. That locks the remaining poll that spawned the CPython 3.14 crash.
Read Profiles and ActiveProfile through busctl, the same path the battery poll already uses. Drop the unused menu provider that still called get.
@coderabbitai

coderabbitai Bot commented Sep 13, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: caa0c176-6732-492e-9958-01f557531045


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant