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

Hide on launch + only call isUserInteractingWithStatusBar if needed #78

Merged
merged 2 commits into from
Oct 24, 2019

Conversation

aonez
Copy link
Contributor

@aonez aonez commented Sep 30, 2019

Added hide on launch option #29


I was wondering why the 0.3 constant CPU usage and turns out it's this 0.5 sec check:

Timer.scheduledTimer(withTimeInterval: 0.5, repeats: true) { _ in
if self.isUserInteractingWithStatusBar() {
self.resetTimer()
}
}

So with this fix isUserInteractingWithStatusBar is only called if:

  1. autohide option is enabled
  2. the icons are visible

Reduces CPU usage. Only calls isUserInteractingWithStatusBar if the autohide option is enabled and the icons are not hidden.
@aonez
Copy link
Contributor Author

aonez commented Sep 30, 2019

After a few minutes with Dozer running and untouched. Bottom version has this patch:
Screen Shot 2019-09-30 at 16 39 49

And 40 minutes later, Mac just playing music (screen on sleep mode):

Screen Shot 2019-09-30 at 17 29 15

@Mortennn
Copy link
Owner

Mortennn commented Oct 2, 2019

Looks great!

I will check it out within a few days.

@aonez aonez changed the title Only call isUserInteractingWithStatusBar if needed Only call isUserInteractingWithStatusBar if needed + #29 Oct 21, 2019
@aonez aonez changed the title Only call isUserInteractingWithStatusBar if needed + #29 Hide on launch + only call isUserInteractingWithStatusBar if needed Oct 21, 2019
@AndrewMast
Copy link

@aonez All of your changes look solid. Thank you for doing this! I hope it's merged soon.

@Mortennn Mortennn merged commit 651c4b5 into Mortennn:master Oct 24, 2019
@Mortennn
Copy link
Owner

Works great! Thank you🙌

@Mortennn
Copy link
Owner

Mortennn commented Nov 6, 2019

I've released a prerelease with the changes Dozer.4.1.0.

@aonez
Copy link
Contributor Author

aonez commented Nov 6, 2019

Thanks @Mortennn!

@karbassi karbassi mentioned this pull request Mar 6, 2020
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