Skip to content

Battery power management#1

Merged
CYKLER01 merged 4 commits into
CYKLER01:feat/low-battery-optimizationfrom
PixelKhaos:feat/battery-power-management
Mar 1, 2026
Merged

Battery power management#1
CYKLER01 merged 4 commits into
CYKLER01:feat/low-battery-optimizationfrom
PixelKhaos:feat/battery-power-management

Conversation

@PixelKhaos
Copy link
Copy Markdown

So it ended up much larger than I thought, but most of it is repeated logic between different "triggers".

Automatically fetching the available refresh rates for monitor.
Separated effects in hyprland for finetuned control of what to enable/disable, with more possible to add in the future.
And as these override eachother as expected so you can use several or just one trigger.

This layout I think could be reworked in the future to be more compact as more things are added, or if combined with another panel as it's mostly repeated settings under different sections.

  • Charging status triggers
    • "Evaluate thresholds" toggle to check battery level when unpluggging overriding it's explicit settings
  • Profile setting triggers
  • Battery threshold triggers
    • Expandable cards for many instances
      Useful if you want settings disabled/lowered progressively as battery drains

  • Three way toggles to set setting off, unchanged and off
    (unchanged simply does nothing to that setting when switching, leaving the current set)
  • Layout grows to fit the sections with animation
  • Power section is hidden in control panel if there is no battery, keeping it available only for laptops etc
recording_20260301_17-37-14.mp4

- Added three way toggle component
- Battery threshold-based power behaviour
- Charging/unplugged behavior
- Per-power profile settings
- Added power management UI pane
- Refresh rate control
- Changed battery pane to two-column layout (60/40)
- Threshold cards
  - Collapsible edit mode
- Fixed signal handlers
- Changed toggle colors
  - m3error for disable state
- Fixed duplicate charging toast
- Changed threshold grid to single-column list
@PixelKhaos
Copy link
Copy Markdown
Author

@CYKLER01 if you test this and make sure it's working and all, but it should cover what you wanted to do, as well as how anyone else might want to use it :)

@CYKLER01 CYKLER01 added the enhancement New feature or request label Mar 1, 2026
@CYKLER01
Copy link
Copy Markdown
Owner

CYKLER01 commented Mar 1, 2026

Damn that is a lot, i was planning on getting it done over the next week and hopefully getting it done by friday but you did it all so thank you for that. im currently in the process of reviewing all of this and will get back to you as soon as that is complete. Thank you for the help! :)

@PixelKhaos
Copy link
Copy Markdown
Author

Damn that is a lot, i was planning on getting it done over the next week and hopefully getting it done by friday but you did it all so thank you for that. im currently in the process of reviewing all of this and will get back to you as soon as that is complete. Thank you for the help! :)

Ah yeah I structured the properties and JSON at first, but as I added a placeholder thresholds section and then what to disable for each profile, I started realizing things would start interfering, and since it all follows the same pattern I essentially just copied the logic a bunch of times. it was a whole bit of testing then realizing that "whoops in this case that acts in a way that feels wrong"

But at this point it's more of a "at least it exists", making it compact and refactoring is doable if necessary later

@CYKLER01
Copy link
Copy Markdown
Owner

CYKLER01 commented Mar 1, 2026

But at this point it's more of a "at least it exists", making it compact and refactoring is doable if necessary later

Yep so thats definitely something that i noticed while testing, the other thing is that i cant really get it to work in the first place as it just throws this error. (i also dont know where to check the full logs)
image

@PixelKhaos
Copy link
Copy Markdown
Author

Yep so thats definitely something that i noticed while testing, the other thing is that i cant really get it to work in the first place as it just throws this error. (i also dont know where to check the full logs)

Hm, showBattery is not something I touched for this, it's a pre-existing config option in the shell.json
Is there some misformat in your config maybe?

@CYKLER01
Copy link
Copy Markdown
Owner

CYKLER01 commented Mar 1, 2026

Yep so i finally got it working, the error was due to my installing the files from this pull request incorrectly. Ive tested out all the functions and its all good, only suggestion would be to somewhat change the formatting but everything else looks good :)

@PixelKhaos
Copy link
Copy Markdown
Author

Yep so i finally got it working, the error was due to my installing the files from this pull request incorrectly. Ive tested out all the functions and its all good, only suggestion would be to somewhat change the formatting but everything else looks good :)

Sweet, and what kind of formatting are you thinking?

@CYKLER01
Copy link
Copy Markdown
Owner

CYKLER01 commented Mar 1, 2026

Ill merge this will this fork so that i can continue working on it. I also might not get back to you on this until tomorrow.

@CYKLER01 CYKLER01 merged commit bbdc526 into CYKLER01:feat/low-battery-optimization Mar 1, 2026
@CYKLER01
Copy link
Copy Markdown
Owner

CYKLER01 commented Mar 2, 2026

@PixelKhaos do you think the options under plugged in behaviour are neccessary since it already chooses a power mode which has those options.
image

@PixelKhaos
Copy link
Copy Markdown
Author

PixelKhaos commented Mar 2, 2026

@PixelKhaos do you think the options under plugged in behaviour are neccessary since it already chooses a power mode which has those options.

Yeah, in case the user wants to keep the profile set already, as in with "unchanged", but override some specific settings. For example maybe profiles are all set to default unchanged, and only used for battery thresholds.
Or lets say profile doesn't turn off blur as an example, but on unplug you add that on too, so it just includes more.

It'd be pretty annoying if I have certain settings for profiles meant for low battery, but forced to use them on charging states too. Like pulling the charger out is normally at full battery and all but not always.

I don't use any of the settings in profiles myself, and dont particularly want to change the profiles as I move about and dont need to be in balanced for the most part, so charging states and thresholds is what is good for me to set and reset the options.

@PixelKhaos
Copy link
Copy Markdown
Author

I do think there might be some more compact way to lay it out maybe, but it's a trigger in of itself I think should have controls to decide what to do regardless of the profile "inherited".

@CYKLER01
Copy link
Copy Markdown
Owner

CYKLER01 commented Mar 2, 2026

I don't use any of the settings in profiles myself, and dont particularly want to change the profiles as I move about and dont need to be in balanced for the most part, so charging states and thresholds is what is good for me to set and reset the options.

Yeah thats fair enough, ive found myself using only the profiles and modifying them to my needs and except for turning on low power mode when the laptop is unplugged not touching any of the plugged in status options.

@PixelKhaos
Copy link
Copy Markdown
Author

Yeah thats fair enough, ive found myself using only the profiles and modifying them to my needs and except for turning on low power mode when the laptop is unplugged not touching any of the plugged in status options.

ah yeah, so that exactly why I think it should be present in some way, to give the options of how you want to manage it.
But I do think the layout is very repetetive for all this, but at the same time it means you know exactly what pattern to follow.

Maybe the charging status should be a single column list with expandable "cards" like the thresholds? not saving any space but less controls right in your face?

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants