Skip to content

Make power profile defaults configurable#6046

Open
crmne wants to merge 1 commit into
basecamp:devfrom
crmne:cp/powerprofiles-conf
Open

Make power profile defaults configurable#6046
crmne wants to merge 1 commit into
basecamp:devfrom
crmne:cp/powerprofiles-conf

Conversation

@crmne

@crmne crmne commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Summary

This is a smaller version of #5621: no menu, just a persistent config file.

omarchy-powerprofiles-set now reads:

# ~/.config/omarchy/powerprofiles.conf
ac=performance
battery=balanced

Those are today's defaults, so behavior is unchanged unless the user edits the file. If the file is missing or contains an unavailable profile, the helper falls back to the existing defaults.

The existing udev rule is unchanged. This makes the Omarchy helper configurable and seeds the default config file.

One important detail: udev launches the helper through the system manager, so $HOME is not guaranteed to be the desktop user's home. The helper therefore still honors OMARCHY_CONFIG_HOME first, but otherwise derives the user config path from its installed executable path under ~/.local/share/omarchy/bin. That lets the same config file work from boot, Hyprland autostart, and udev AC/USB events without changing the udev rule.

Why

Editing the udev rule directly does not hold up as a persistent user preference:

  • boot applies the profile outside udev via omarchy-powerprofiles-init
  • Omarchy regenerates/replaces the power-profile udev rule during migrations/updates
  • udev/systemd runs the helper outside the user session, so relying on $HOME alone can miss ~/.config/omarchy/powerprofiles.conf

This gives users an Omarchy-supported override without changing defaults for everyone.

Testing

  • bash -n bin/omarchy-powerprofiles-set migrations/1780735021.sh
  • git diff --check
  • bin/omarchy-powerprofiles-set ac with local ac=balanced
  • smoke-tested an installed-path helper with HOME=/root and ac=balanced, verifying it still reads the user config from the executable path
  • smoke-tested OMARCHY_CONFIG_HOME override precedence
  • OMARCHY_CONFIG_HOME=/tmp/omarchy-powerprofiles-migration-test/.config/omarchy OMARCHY_PATH=/home/carmine/Code/omarchy bash migrations/1780735021.sh

Copilot AI review requested due to automatic review settings June 6, 2026 08:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds a user-configurable default power profile configuration so omarchy-powerprofiles-set can choose AC/battery profiles based on persisted settings.

Changes:

  • Add a migration to install a default powerprofiles.conf into the user config directory (if missing).
  • Add config/omarchy/powerprofiles.conf with default ac/battery profile mappings.
  • Update omarchy-powerprofiles-set to read and validate configured profiles before falling back to hard-coded defaults.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.

File Description
migrations/1780735021.sh Creates the config directory and seeds powerprofiles.conf if it doesn’t exist.
config/omarchy/powerprofiles.conf Introduces default AC/battery profile mappings.
bin/omarchy-powerprofiles-set Loads profile defaults from config and applies them if valid.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread migrations/1780735021.sh
Comment thread migrations/1780735021.sh Outdated
@crmne crmne force-pushed the cp/powerprofiles-conf branch from 966cfdc to af1a6f0 Compare June 6, 2026 08:49
Copilot AI review requested due to automatic review settings June 6, 2026 08:57
@crmne crmne force-pushed the cp/powerprofiles-conf branch from af1a6f0 to 7767b32 Compare June 6, 2026 08:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.

Comment thread migrations/1780735021.sh Outdated
Comment thread install/config/powerprofilesctl-rules.sh Outdated
@crmne crmne force-pushed the cp/powerprofiles-conf branch from 7767b32 to 78afa24 Compare June 6, 2026 09:05
Copilot AI review requested due to automatic review settings June 6, 2026 11:49
@crmne crmne force-pushed the cp/powerprofiles-conf branch from 78afa24 to c23298b Compare June 6, 2026 11:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.

Comment thread migrations/1780735021.sh
Comment thread migrations/1780735021.sh
@crmne crmne force-pushed the cp/powerprofiles-conf branch from c23298b to 00597e9 Compare June 6, 2026 11:53
Copilot AI review requested due to automatic review settings June 6, 2026 11:53
@crmne crmne force-pushed the cp/powerprofiles-conf branch from 00597e9 to 52206bf Compare June 6, 2026 11:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.

Comment thread migrations/1780735021.sh
@crmne crmne force-pushed the cp/powerprofiles-conf branch from 52206bf to a65d3f8 Compare June 6, 2026 11:56
@MrDach

MrDach commented Jun 12, 2026

Copy link
Copy Markdown

This would be great to be able to configure! My Dell Latitude with an i7 will also start taking off if I keep it in performance mode.

For now I've added the following to ~/.config/hypr/autostart.conf

exec-once = sh -c 'sleep 3; powerprofilesctl set balanced'

Which is a terrible hack but I just get annoyed by having to do the change manually on every boot.

Shame that your config menu PR was closed.

@crmne

crmne commented Jun 12, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the comment @MrDach. I know a ton of people having the same problem.

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.

3 participants