-
Notifications
You must be signed in to change notification settings - Fork 7
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
Add support for custom formats with labels #30
Add support for custom formats with labels #30
Conversation
Adds support for per-value "labels" that will only be visisble when the associated value is above zero. Useful for seperate icons per value. Valid labels are `{aur}`, `{pacman}` or `{total}`. Icons can optionally be added before/after values using e.g. `{x:aur}` and/or `{aur:x}`. Examples: ``` waybar-updates -f '{total} ({pacman}+{aur})' waybar-updates -f '{ :total: updates}' waybar-updates -f '{ :pacman:\n}{ :aur}' ```
Same labels as the main text format, with the addition of `{}` which gets replaced with the generated list of updates. By default adds an extra row to the top of the tooltip showing Pacman and AUR values.
Removes duplication in WIP stuff and moves text/tooltip/json generation into a new `send_output` function so it's a little easier to parse. Also removes the `function` from the rest of the functions since `usage` doesn't have it so it makes more sense that the rest also don't get it.
Seems some of the hackery is confusing shellcheck, I'll get those fixed up later tonight |
As far as I got, this will be a default for exisiting users who are not aware of changes?
|
Overall PR looks excellent, very accurate, a lot of small good looking style changes, very appreciate it! |
Correct - so by default the text stays the same, but all (non-zero) counts are added to tooltip I tried to get it somewhat centered but fonts, so YMMV |
I will release it as part of v0.5.0 a little bit later, have some work to do in Windows... |
The thought of Waybar on Windows didn't even cross my mind! Now I'm curious... |
@dshoreman unfortunately, by work I meant actual work! So I am loaded in Windows for now. |
Aha! Sorry, been a long day 😆 |
Should be available in AUR! |
Hi! I started switching to Waybar at the weekend and found this to replace what I had for Polybar previously. It works great—thanks for merging #29 so quickly btw—but ideally I'd like to show counts separately.
I couldn't find a way to get Waybar passing anything from the "real"
format
option in the bar config, so instead I've hacked together some basic "label" parsing. It supports a custom prefix/suffix (separated by:
) which allows for per-count auto-hiding icons, but at the cost of a really ugly sed block.New CLI args
-f, --format
-t, --tooltip
Supported Labels
{aur}
{dev}
{pacman}
{total}
Examples
New defaults
Custom prefix and suffix
Multiline Pacman+AUR example with icons
Showing only package counts in the tooltip
Showing all counts individually (and hiding them in the tooltip)