Skip to content
This repository has been archived by the owner on Aug 29, 2020. It is now read-only.

Adds battery support #89

Merged
merged 3 commits into from Jan 4, 2019
Merged

Adds battery support #89

merged 3 commits into from Jan 4, 2019

Conversation

ghost
Copy link

@ghost ghost commented Dec 27, 2018

Adds a widget for battery level. The widget updates on the level of minutes, as batteries drain and charge slowly.

The battery widget is disabled by default; it can be enabled with -b.

Cleans up mod file; adds flag for battery.

Adds documentation; fixes missing color sets for battery.
Copy link
Owner

@cjbassi cjbassi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great! I've been hoping that people would add more widgets. Just have the one suggestion.

main.go Outdated
@@ -212,6 +236,10 @@ func initWidgets() {
wg.Done()
}()
if !minimal {
go func() {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should change this so that the battery is only created if the battery flag is set. The widget count variable also has to be changed to account for this.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:sheepishly: yeah. I got it working, then saw that and made changes I thought would do what you're suggesting and couldn't get it working again. Lazily, I reverted back to what was working and pushed the pull request.

I'll work on this a bit more.

Sean E. Russell added 2 commits January 1, 2019 11:04
Disable all battery code if battery not selected in options.
Refactors widgetCount to localize use.
@ghost
Copy link
Author

ghost commented Jan 1, 2019

  1. Updated code for new termui API.
  2. Changed flag to non-compete with status bar
  3. Disables all battery code if not selected in options
  4. Adds status bar option flag to README
  5. Refactors widgetCount code so it is entirely local to the code that uses it. This will also reduce the opportunity for errors and makes adding widgets more straightforward.

@cjbassi cjbassi merged commit 24ca528 into cjbassi:master Jan 4, 2019
cjbassi added a commit that referenced this pull request Jan 4, 2019
@cjbassi
Copy link
Owner

cjbassi commented Jan 4, 2019

Looks good, thanks for this! I changed 2 things:

  1. The statusbar is now enabled with the -s flag and the battery widget is enabled with -b.
  2. I opted to not include the picture in the readme, but I added a link to it next to where the cli args are documented.

@ghost
Copy link
Author

ghost commented Jan 4, 2019

Ok, thanks; I like your choice of options.

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