Skip to content

AltStatusBarFix: battery percentage not shown #11976

Merged
5 commits merged into
masterfrom
unknown repository
Jun 8, 2024
Merged

AltStatusBarFix: battery percentage not shown #11976
5 commits merged into
masterfrom
unknown repository

Conversation

@ghost

@ghost ghost commented Jun 5, 2024

Copy link
Copy Markdown
  • Show the battery percentage (if selected in the menu) and
  • do not show the original CRE status bar after closing the AltStatBar menu (if somethin changed there).

(A difference to the original behavior -> if the battery is charging, then show [↯45%]' instead of [ + ]`)

Regression (#11873)


This change is Reviewable

@Frenzie Frenzie added this to the 2024.06 milestone Jun 5, 2024
@Frenzie

Frenzie commented Jun 5, 2024

Copy link
Copy Markdown
Member

luacheck has some minor complaints, looks fine to me otherwise.

@poire-z poire-z left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you for fixing my mess :)

if self.battery == 1 and self.battery_percent == 1 then -- append battery percentage
local batt_pre = "["
local batt_post = "]"
local batt_val = ""

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Better have batt_val = nil
For devices without battery, it would show as image

batt_lvl = batt_lvl + aux_batt_lvl
else
batt_pre = "+"
batt_post = "+"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The doubled + feel a bit excessive:
image
The low weight of the + glyph makes it feel like a hole on the right and a bit misaglined. If it ends on the right with the %, it looks better, like proper justficiation :) instead of a hanging +.

@poire-z poire-z left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

(No experience about the AuxBattery stuff, but) looks ok.

@Frenzie

Frenzie commented Jun 5, 2024

Copy link
Copy Markdown
Member

Is the OP still true with these changes? (For the squash commit message.)

@poire-z

poire-z commented Jun 5, 2024

Copy link
Copy Markdown
Contributor

The list 2 items yes.
Leave the parenthesed line out, as it was tweaked for the auxbattery, and no need to talk about it.

@ghost

ghost commented Jun 5, 2024

Copy link
Copy Markdown
Author

@poire-z Before merging an additional thought. During my last work with the alt status bar (1, 2 or even 3 years ago) I noticed, we could use unicode there too. ↯ would be nice to indicate charging.
IIRC you did not want that, cause coolreader does/didnt support, has not used the right fonts.

Does this concerns still holds true?
crengine neue generation is divergating anyway.

@poire-z

poire-z commented Jun 5, 2024

Copy link
Copy Markdown
Contributor

If it's fed from frontend - and it's found in NotoSans (or the fallback fonts we provide to crengine from koreader frontend), I guess it's fine. It seems to work, adding page_info = page_info .. " \u{21AF}" at the end:
image

In any case, if we want to do more stuff like this for the top status bar, I guess feeding strings from frontend (and adding stuff to crengine so it uses these strings) like my recent PR is the simple way to go.

In the past, I imagined the way to tweak the top status bar would be to paint some widget of us over the crengine top status bar (even left empty by crengine, but we need to keep having it know about that room taken for all the existing y computations/adjustments when it is enabled).
But if we can be fine with just a left string and a right string, it would be a lot easier. (Although there is the two-columns mode where it already does some magic that we would need to mimic in frontend).
(There's just the battery icon level filling that we may not have much granularity with Unicode symbols).

@ghost

ghost commented Jun 7, 2024

Copy link
Copy Markdown
Author

Ready from my side:
Now the status line looks like 06:34 123 / 234 [28%] or 06:34 123 / 234 ↯ 28%
The space at the end. This is necessary in charging mode, otherwise the battery percentage is too much on the right.

Comment on lines +151 to +152
local batt_pre = "["
local batt_post = "]"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is it ok these [ ] are gone when the battery is charging?
I think they somehow provide the shape of a bettery icon/level [ 45% ] (while also making it different from the book reading progress just before it), it's strange they go away when the battery is charging.

@ghost

ghost commented Jun 7, 2024

Copy link
Copy Markdown
Author

Ready?

@ghost ghost merged commit c8f4008 into koreader:master Jun 8, 2024
@ghost ghost deleted the fixAltStatusBar branch June 8, 2024 07:36
0xstillb pushed a commit to 0xstillb/koreader-thai that referenced this pull request May 9, 2026
This pull request was closed.
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.

2 participants