Waybar: timezone on clock module

Created on 15 Mar 2019  路  6Comments  路  Source: Alexays/Waybar

Hi,
Nice project thanks ! It would be nice to be able to set the timezone on the config file so we don't have to bother to set the TZ env var and reload the session, wdyt ?
Cheers

enhancement

Most helpful comment

@mjec @ZeiP Since Alexays seems okay with adding a dependency on tz.h, there remains to make the actual pull request.
That would entail

  1. Updade clock.cpp to actually use tz.h
  2. Augment the clock module config to support a timezone argument.
  3. Check that it works correctly with two modules (i.e. the timezones are actually different).

Most of this should be straightforward, given that clock.cpp is 31 lines :-). A potential unknown pain point will be the formatting, but I guess there are ways to convert a tz.h time to a more standard value for formatting with fmt.

All 6 comments

Also, the possibility of adding multiple clocks in different timezones would be a plus!

I misunderstood this one as being about displaying the current timezone in the clock widget, which can already be done with %Z of course.

At the moment, waybar does not detect system timezone changes, but this should be fixed soon (see https://github.com/Alexays/Waybar/issues/479). By default, the clock should reflect the system's timezone.

So this feature chiefly adds

[...] the possibility of adding multiple clocks in different timezones [...].

I'd be happy to work on this (specifically, being able to specify the TZ for a particular clock module), and I think the easiest way to make this happen would be to bring in Howard Hinnant's tz.h -- is adding a new dependency for this ok?

Adding multiple clocks with different time zones is the most important functionality I'm missing when changing from py3status. Is there something I can do to help get this done?

@mjec @ZeiP Since Alexays seems okay with adding a dependency on tz.h, there remains to make the actual pull request.
That would entail

  1. Updade clock.cpp to actually use tz.h
  2. Augment the clock module config to support a timezone argument.
  3. Check that it works correctly with two modules (i.e. the timezones are actually different).

Most of this should be straightforward, given that clock.cpp is 31 lines :-). A potential unknown pain point will be the formatting, but I guess there are ways to convert a tz.h time to a more standard value for formatting with fmt.

PR #560 created which adds timzeone support -- feedback extremely welcome, as I don't normally write C++.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

docquantum picture docquantum  路  5Comments

cryptoluks picture cryptoluks  路  4Comments

lovesegfault picture lovesegfault  路  3Comments

0xdec picture 0xdec  路  4Comments

Sqvid picture Sqvid  路  5Comments