jetbrains-auto-power-saver
jetbrains-auto-power-saver copied to clipboard
Automatically detect power cord status for laptops
As as user, it would be neat if the IDE / plugin could identify when a laptop was on battery or AC power.
This has been requested a few times:
- https://youtrack.jetbrains.com/issue/IDEA-119217
- https://youtrack.jetbrains.com/issue/IDEA-134314
- https://youtrack.jetbrains.com/issue/IDEA-181434
Some existing 'prior art' can be found here:
- https://github.com/algi/powersource-monitor-intellij
- https://github.com/JetBrains/intellij-community/blob/master/platform/platform-impl/src/org/jetbrains/io/PowerSupplyKit.java (removed on 2019-10-31 in
intellij-community
GitHub repo commit revision number4ce0b0496d4276241e80f10dddcbf189d7698358
- see https://github.com/JetBrains/intellij-community/blob/de145675c4b585c0223a80033f55428c74958e0d/platform/platform-impl/src/org/jetbrains/io/PowerSupplyKit.java for when this file was originally added.)
User Stories
The below are user stories that should be satisfied when this issue/feature/enhancement gets implemented.
- "I want to be able to have the plugin automatically detect when my device is running on battery vs AC, and act more 'intelligently' in each state. Some examples: (a) When running on AC, turn 'power save mode' off ignore any [un-]focus settings of the plugin; (b) when running on battery, turn 'power save mode' on and ignore any [un-]focus settings of the plugin.
- From https://github.com/ChrisCarini/jetbrains-auto-power-saver/issues/89 : "As a user, I want to be able to set IDEA to power save mode manually when my laptop is running on battery. In this case power save mode must remain turned on until I manually turn it off."
Another example that seems fairly simple: https://github.com/jonathanlermitage/intellij-battery-status-plugin
FYI, they implemented a below/above a certain charge percentage switch in the Battery Status plugin last year: https://github.com/jonathanlermitage/intellij-battery-status-plugin/issues/5#issuecomment-1492797799
Be sure to note there is currently a visualisation state bug in JetBrains IDEA. Which makes using the Power Safe Mode toggle slightly annoying: ~~https://youtrack.jetbrains.com/issue/WI-76406~~
The above ticket is closed as duplicate of this general JetBrains IDEA ticket: https://youtrack.jetbrains.com/issue/IDEA-331139
This is great, thank you for sharing @HenkPoley !
I still have not had the time to sit down and implement this feature yet, but it's still on my radar and of interest to me. Of course, if anyone is interested in giving it a shot, I'm open to PRs!
Part of the visualization bug is fixed.
Still has similar bugs in:
- Show Diff
- Sticky Lines
https://youtrack.jetbrains.com/issue/IJPL-72740/
New tickets for those:
- https://youtrack.jetbrains.com/issue/IJPL-148846 - Sticky Lines don't appear after disabling Power Save Mode
- https://youtrack.jetbrains.com/issue/IJPL-148844 - Power Save Mode: diff line highlighting disappears on enabling PSM and doesn't appear on disabling
Thank you @HenkPoley ! I've stared and voted for both issues!
One bug fixed in 2024.2, this one remains:
- https://youtrack.jetbrains.com/issue/IJPL-148846 - Sticky Lines don't appear after disabling Power Save Mode