Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Do not show background tips unless focused #40

Merged
merged 3 commits into from
Feb 17, 2018
Merged

Conversation

50Wliu
Copy link
Contributor

@50Wliu 50Wliu commented Feb 17, 2018

Requirements

  • Filling out the template is required. Any pull request that does not include enough information to be reviewed in a timely manner may be closed at the maintainers' discretion.
  • All new code requires tests to ensure against regressions

Description of the Change

Only show background tips when Atom is focused to preserve battery life.

In the following GIFs, the slightly highlighted line in the Task Manager represents Atom. Notice the GPU usage when Atom is and isn't focused. (Note that I decreased the display duration to 1 second for a shorter GIF)

Before After
background-tips-gpu-before background-tips-gpu-after

Alternate Designs

None.

Benefits

Uses public Atom and Electron APIs to detect when Atom isn't focused and deactivates the background tips and timers in order to save battery life. I have verified that the new listeners are disposed of correctly when the package is deactivated.

Possible Drawbacks

When Atom is still visible but not focused, no background tips will appear.

Applicable Issues

None.

@50Wliu 50Wliu merged commit 5446730 into master Feb 17, 2018
@50Wliu 50Wliu deleted the wl-battery-life branch February 17, 2018 19:02
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant