Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide option to not update when on battery #94

Open
dvcrn opened this issue Nov 14, 2022 · 5 comments
Open

Provide option to not update when on battery #94

dvcrn opened this issue Nov 14, 2022 · 5 comments

Comments

@dvcrn
Copy link

dvcrn commented Nov 14, 2022

Since it starts on boot, this can also happen when in a place like a cafe and running off battery

Provide a setting/flag to not run autoupdate when currently on battery

@github-actions
Copy link
Contributor

github-actions bot commented Dec 6, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@github-actions github-actions bot added the Stale label Dec 6, 2022
@dvcrn
Copy link
Author

dvcrn commented Dec 6, 2022

Not stale

@github-actions github-actions bot removed the Stale label Dec 6, 2022
@github-actions
Copy link
Contributor

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@github-actions github-actions bot added the Stale label Dec 27, 2022
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jan 4, 2023
@DomT4 DomT4 reopened this Jan 24, 2023
@github-actions github-actions bot removed the Stale label Jan 24, 2023
@DomT4
Copy link
Owner

DomT4 commented Jan 24, 2023

Have added some labels that will hopefully stop the bot automatically closing the issue.

@swissbuechi
Copy link
Contributor

swissbuechi commented Oct 26, 2023

I did not find an option to handle this request with launchd.
We could add a check inside the /Users/$(whoami)/Library/Application Support/com.github.domt4.homebrew-autoupdate/brew_autoupdate script with pmset -g ps.
It's a bit "dirty" in my opinion, because we need to grep the output from pmset.

Example brew_autoupdate:

#!/bin/sh
if [[ $(pmset -g ps | head -1) =~ "Battery Power" ]]; then
  echo "Not starting autoupdate, because device is running on Battery"
  exit
fi

# Script content ...
echo "Starting autoupdate..."

A better solution would be to use this COM Interface from the IOKit https://developer.apple.com/documentation/iokit/iopowersources_h/1810316-iopsgetprovidingpowersourcetype.
It maybe can somehow be invoked from inside the brew_autoupdate script.

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

No branches or pull requests

3 participants