py3status icon indicating copy to clipboard operation
py3status copied to clipboard

google_calendar module: Inject is_current into format event

Open syyyr opened this issue 1 month ago • 6 comments

Usecase: I want to show start_dat for upcoming events and end_time for ongoing events. Example usage:

google_calendar {
    format = "{events}"
    events_within_hours = 48
    format_event = "[\?color=lime {summary}] [\?if=is_current until {end_time}][\?if=!is_current {start_time}] {format_timer}"
    format_time = "%a %H:%M"
    format_timer = "\?color=time ([\?if=!is_current in ][\?if=days {days}d ][\?if=hours {hours}h ][\?if=minutes {minutes}m][\?if=is_current \ left])"
}
image

syyyr avatar Dec 04 '25 14:12 syyyr

I have added documentation for the new placeholder. I found out that is_current was not documented for format_event either, so I added documentation for that too (it is not in format_notification so that's why I needed to add it separately).

today placeholder sounds better.

Sorry, I do not know what you mean by this. 😁

syyyr avatar Dec 06 '25 11:12 syyyr

... know what you mean...

I'm wondering if this is a good event placeholder name or if there is a more fitting one... is_current, current, today (probably not, now I have looked into it a bit more), active, ongoing, etc. I'm leaning on active right now. Idk.

lasers avatar Dec 06 '25 13:12 lasers

... know what you mean...

I'm wondering if this is a good event placeholder name or if there is a more fitting one... is_current, current, today (probably not, now I have looked into it a bit more), active, ongoing, etc. I'm leaning on active right now. Idk.

I am fine with changing it to active. I only called it is_current, because that's what the existing placeholder was named. :)

Although if someone depended on the current placeholder name (like the default format_event does), changing the name will be a breaking change. And I suppose it's better if the placeholders have the same name.

syyyr avatar Dec 08 '25 10:12 syyyr

We can leave is_current in place for only safeformatted format_timer and update the docs mentioning active.

lasers avatar Dec 08 '25 17:12 lasers

Hmm, okay, so:

  • My new placeholder for format_event is now called active.
  • The is_current placeholder for format_timer stays in place for backwards compatibility.
  • I have added documentation for both of those.
  • I have also renamed the is_current variable to be called event_active. Seems like a better name, but I can remove that.

syyyr avatar Dec 08 '25 17:12 syyyr

Current situation:

  • both format_timer and format_event have the active placeholder
  • format_timer has the is_current placeholder for compatibllity
  • the default format_timer now uses active instead of is_current
  • the documentation only speaks about active
  • the variable renaming is still in place

syyyr avatar Dec 08 '25 18:12 syyyr