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

Conditionally set progress bar color? #87

Closed
GoldsteinE opened this issue Jul 31, 2022 · 7 comments
Closed

Conditionally set progress bar color? #87

GoldsteinE opened this issue Jul 31, 2022 · 7 comments

Comments

@GoldsteinE
Copy link

GoldsteinE commented Jul 31, 2022

Hi! My usecase is following: I want to display progress bar for volume and color it differently when volume is muted. Currently I could probably achieve this by creating two identical blocks with different AppName, but this is an unpleasant duplication.

@GoldsteinE
Copy link
Author

Actually, two blocks with different AppName would not be deduplicated with tags, so I ended up matching on Body instead, which is even more of a hack (and for some reason not guaranteed?)

@Toqozz
Copy link
Owner

Toqozz commented Aug 1, 2022

Why is it not guaranteed?

@GoldsteinE
Copy link
Author

I’m not sure, but that’s what the documentation says:

When the notification has some body text (not guaranteed).

@Toqozz
Copy link
Owner

Toqozz commented Aug 1, 2022

Right, that's because it is not required for a notification to have body text, only summary text, e.g.: notify-send "summary". I'll edit that section to make it a bit clearer

I assume you're creating the notifications yourself, so the right way of handling this is probably to support supplying some extra data which you can then use with a RenderCriteria. Maybe something like: notify-send "Summary" "Body" --hint="string:wired-note:mute"?

but this is an unpleasant duplication.

Unfortunately I don't think we can do much better than this. If we have options for specific use cases just under the Progress bar, then it balloons out exponentially. It would be nice if we could have some kind of conditional inclusions or something, but we're just not set up for that right now. Here's an issue that talks about some potential options: #81

@GoldsteinE
Copy link
Author

I thought about %-syntax in Color strings.

I assume you're creating the notifications yourself, so the right way of handling this is probably to support supplying some extra data which you can then use with a RenderCriteria. Maybe something like: notify-send "Summary" "Body" --hint="string:wired-note:mute"?

Yes, that would be a lot cleaner.

@Toqozz
Copy link
Owner

Toqozz commented Aug 14, 2022

I've added RenderCriteria::Note in master. You can use it like this:

In wired.ron:

render_criteria: [Note("mute")],

When sending the notification:

$ notify-send "Summary" "Body" --hint="string:wired-note:mute"

@Toqozz Toqozz closed this as completed Aug 14, 2022
@GoldsteinE
Copy link
Author

Thanks!

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

No branches or pull requests

2 participants