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

feat(upower): add new formatting properties #441

Merged
merged 1 commit into from
Feb 12, 2024

Conversation

Disr0
Copy link
Contributor

@Disr0 Disr0 commented Feb 10, 2024

Adds parsing in format for properties other than {percentages} πŸ˜΅β€πŸ’«

Resolves #440

@JakeStanger
Copy link
Owner

Thanks for the PR. This is definitely a good addition. There are a few small bits that I think need addressing before this goes in:

This is a new feature, not a bug fix :) Could you amend your commit message to reflect that please so it gets added to the changelog correctly. Something like: feat(upower): add new formatting properties.

I don't think adding icon_name as a property is particularly helpful, unless there's something smart you could do with this and Pango? Otherwise it's sort of an internal identifier that gets exposed with little purpose.

Arguably the time_to_empty and time_to_full properties should be combined into one (perhaps just time_remaining?), which checks the state to see which underlying property to use. Otherwise you end up having to add both to have the ETA consistently display:

{ type = "upower" format = "{percentage}% {state} ({time_to_empty}{time_to_full})" }

I'm not sure whether the combine property should be instead of or in addition to the separated ones? Would people ever want to show one and not the other? I'm open to feedback on that one.

Once that's all done I'll re-review and update the docs page. Let me know if you need any help with any of the above :)

Copy link
Owner

@JakeStanger JakeStanger left a comment

Choose a reason for hiding this comment

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

[Changes requested above]

@Disr0 Disr0 changed the title fix: properly parse properties in upower module feat(upower): add new formatting properties Feb 10, 2024
@Disr0
Copy link
Contributor Author

Disr0 commented Feb 10, 2024

Yeah, icon_name isn't particularly useful, I'll remove it from the formatting.
Combining time_to_empty and time_to_full sounds more correct, yeah, but how should it be done? I'm not sure if adding if switch is a good idea, but maybe it's better than just concatenating time_to_empty and time_to_full as a string and sending it as time_remaining?

@Disr0 Disr0 force-pushed the fix_formatting_in_upower branch from 655f9ae to 4a717d0 Compare February 11, 2024 12:57
Copy link
Owner

@JakeStanger JakeStanger left a comment

Choose a reason for hiding this comment

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

Looking nearly there, cheers for your work on this. Just one minor adjustment I think, then I'm happy with it.

Are you able to squash your commits down into a single one which matches the PR title? I can give a hand with that if not.

@Disr0 Disr0 force-pushed the fix_formatting_in_upower branch 2 times, most recently from 0e9559d to 332e6b5 Compare February 11, 2024 18:04
@Disr0
Copy link
Contributor Author

Disr0 commented Feb 11, 2024

Should be done now

@JakeStanger
Copy link
Owner

Cheers, lgtm. I'll update the docs to add in the relevant section & merge in the next few days.

@JakeStanger JakeStanger force-pushed the fix_formatting_in_upower branch 2 times, most recently from 2f5604d to cc92c65 Compare February 12, 2024 22:53
@JakeStanger JakeStanger force-pushed the fix_formatting_in_upower branch from cc92c65 to 76a6816 Compare February 12, 2024 23:06
@JakeStanger JakeStanger merged commit f5f6b37 into JakeStanger:master Feb 12, 2024
2 checks passed
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.

upower widget doesn't parse {time_to_empty}
3 participants