Polybar: Select time zone for date module

Created on 26 May 2017  Â·  3Comments  Â·  Source: polybar/polybar

It'd be extremely handy to be able to select which time zone a date module displays. Even just "utc = true" would be useful.

configuration feature help wanted

Most helpful comment

I reopened this because we will now start tracking this as a feature request for a new parameter in the date module and ignore the script workaround

All 3 comments

See #557

I reopened this because we will now start tracking this as a feature request for a new parameter in the date module and ignore the script workaround

I tried something with setenv to set the TZ environment variable as suggested in #788 by @NBonaparte. But there is a problem.

If we suppose the following config:

[bar/example]
…
modules-left = date_france date_local
…

The environment modification applies to all threads, so if there is two internal/date modules, as in the example above, the timezone may be applied to the two modules rather than just the date_france module.

One solution could be to use a "global clock", each module will get the time from a blocking method that will use setenv. Since this is a blocking call the request from each module will be sequential and it will resolve the thread concurrency problem.
What do you think of this solution?

Was this page helpful?
0 / 5 - 0 ratings