Skip to content

Conversation

bim9262
Copy link
Collaborator

@bim9262 bim9262 commented Jul 29, 2025

Currently this has only been applied to the time block, but any block that doesn't have formats for specific states/conditions could use this do allow one or more format, while still being able to continue using format and format_alt. (This could work as a fix to #2163)

One drawback about this is that I was unable to figure out how to be able to keep the deny_unknown_fields on the Config

This will allow configs to be specified in any of these ways:

[[block]]
block = "time"
[[block.click]]
button = "left"
action = "next_format"
[[block.click]]
button = "right"
action = "prev_format"

[[block]]
block = "time"
format = " $icon $timestamp.datetime(f:'%a %Y-%m-%d %R %z') "
[[block.click]]
button = "left"
action = "next_format"
[[block.click]]
button = "right"
action = "prev_format"

[[block]]
block = "time"
format = " $icon $timestamp.datetime(f:'%a %Y-%m-%d %R %z') "
format_alt = " $icon $timestamp.datetime(f:long, l:en-u-ca-hebrew-hc-h23)"
[[block.click]]
button = "left"
action = "next_format"
[[block.click]]
button = "right"
action = "prev_format"

[[block]]
block = "time"
format = [" $icon $timestamp.datetime(f:'%a %Y-%m-%d %R %z') ", " $icon $timestamp.datetime(f:long, l:en-u-ca-hebrew-hc-h23)"]
[[block.click]]
button = "left"
action = "next_format"
[[block.click]]
button = "right"
action = "prev_format"

[[block]]
block = "time"
[[block.format]]
full = " $icon $timestamp.datetime(f:'%a %Y-%m-%d %R %z') "
[[block.format]]
full = " $icon $timestamp.datetime(f:long, l:en-u-ca-hebrew-hc-h23)"
[[block.click]]
button = "left"
action = "next_format"
[[block.click]]
button = "right"
action = "prev_format"

[[block]]
block = "time"
testing = true
[block.format]
full = " $icon $timestamp.datetime(f:'%a %Y-%m-%d %R %z') "
[[block.click]]
button = "left"
action = "next_format"
[[block.click]]
button = "right"
action = "prev_format"

@bim9262 bim9262 linked an issue Jul 29, 2025 that may be closed by this pull request
@bim9262 bim9262 force-pushed the multi_format_config branch from e40fc6d to 327d47e Compare August 1, 2025 03:42
@bim9262
Copy link
Collaborator Author

bim9262 commented Aug 1, 2025

One drawback about this is that I was unable to figure out how to be able to keep the deny_unknown_fields on the Config

I fount that we can have deny_unknown_fields on the MaybeMultiConfig instead.

@bim9262
Copy link
Collaborator Author

bim9262 commented Aug 12, 2025

@MaxVerevkin any thoughts on this approach to allow one or more format (either as how formats are currently configured, or as a list of format configs)?

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.

format_alt not avaible for time module.
1 participant