tobi-wan-kenobi / bumblebee-status

bumblebee-status is a modular, theme-able status line generator for the i3 window manager.
https://bumblebee-status.readthedocs.io/en/main/
MIT License
1.22k stars 229 forks source link

locale setting (for timezone selection) are ignored #945

Closed christianhorn closed 1 year ago

christianhorn commented 1 year ago

Bug Report

Description

Affected modules: time date datetimetz datetz Version used: latest git

Timezone is used from current environment, while parameters like date.locale seem to be ignored. My goal is to have the current time from 2 different timezones in the status bar.

How to reproduce

[chris@космос tmp]$ env TZ="Asia/Tokyo" date
Sat 17 Dec 15:43:47 JST 2022
[chris@космос tmp]$ env TZ="Europe/Berlin" date
Sat 17 Dec 07:43:53 CET 2022
[chris@космос tmp]$ env TZ="Asia/Tokyo"  \
bumblebee-status/bumblebee-status \
      -m time date datetimetz datetz \
      -p time.format="%H:%M" time.locale="Europe/Berlin" \
        date.format="%H:%M" date.locale="Europe/Berlin" \
        datetimetz.format="%H:%M" datetimetz.locale="Europe/Berlin" \
        datetz.format="%H:%M" datetz.locale="Europe/Berlin"
{"version": 1, "click_events": true}
[
[{"full_text": " 15:44 ", "color": "#aabbcc", "name": "time", "instance": "b6d6eb3d-4e97-42cb-b441-2b35cfe47bc9", "_raw": "15:44", "_suffix": " ", "_prefix": " ", "align": null}, {"full_text": " 15:44 ", "color": "#aabbcc", "name": "date", "instance": "b5513602-57a6-4482-9182-13ea6c885dca", "_raw": "15:44", "_suffix": " ", "_prefix": " ", "align": null}, {"full_text": " 15:44 ", "color": "#aabbcc", "name": "datetimetz", "instance": "13f684b4-4e75-4457-8dcc-396fe2b079e1", "_raw": "15:44", "_suffix": " ", "_prefix": " ", "align": null}, {"full_text": " 15:44 ", "color": "#aabbcc", "name": "datetz", "instance": "70cd81dc-7077-4a35-bff5-7777039f8d84", "_raw": "15:44", "_suffix": " ", "_prefix": " ", "align": null}],
^CTraceback (most recent call last):
  File "/home/chris/Downloads/tmp/bumblebee-status/bumblebee-status", line 149, in <module>
    main()
  File "/home/chris/Downloads/tmp/bumblebee-status/bumblebee-status", line 141, in main
    output.wait(config.interval())
  File "/home/chris/Downloads/tmp/bumblebee-status/bumblebee_status/core/output.py", line 303, in wait
    time.sleep(interval)
KeyboardInterrupt

[chris@космос tmp]$ env TZ="Europe/Berlin" \
bumblebee-status/bumblebee-status \
      -m time date datetimetz datetz \
      -p time.format="%H:%M" time.locale="Asia/Tokyo" \
        date.format="%H:%M" date.locale="Asia/Tokyo" \
        datetimetz.format="%H:%M" datetimetz.locale="Asia/Tokyo" \
        datetz.format="%H:%M" datetz.locale="Asia/Tokyo"
{"version": 1, "click_events": true}
[
[{"full_text": " 07:44 ", "color": "#aabbcc", "name": "time", "instance": "a601121d-5a53-4b94-bb6b-1a87ef7e7b21", "_raw": "07:44", "_suffix": " ", "_prefix": " ", "align": null}, {"full_text": " 07:44 ", "color": "#aabbcc", "name": "date", "instance": "f2d1d037-cd62-4cce-ad9d-693a4420e35b", "_raw": "07:44", "_suffix": " ", "_prefix": " ", "align": null}, {"full_text": " 07:44 ", "color": "#aabbcc", "name": "datetimetz", "instance": "c7f0260e-db91-48ed-b92b-34991a1f5b5d", "_raw": "07:44", "_suffix": " ", "_prefix": " ", "align": null}, {"full_text": " 07:44 ", "color": "#aabbcc", "name": "datetz", "instance": "f27847ab-e286-4491-9569-0e39710eebb8", "_raw": "07:44", "_suffix": " ", "_prefix": " ", "align": null}],
^CTraceback (most recent call last):
  File "/home/chris/Downloads/tmp/bumblebee-status/bumblebee-status", line 149, in <module>
    main()
  File "/home/chris/Downloads/tmp/bumblebee-status/bumblebee-status", line 141, in main
    output.wait(config.interval())
  File "/home/chris/Downloads/tmp/bumblebee-status/bumblebee_status/core/output.py", line 303, in wait
    time.sleep(interval)
KeyboardInterrupt

[chris@космос tmp]$
tobi-wan-kenobi commented 1 year ago

Hello,

that is a bit of a confusion: The "locale" setting changes how some formats are printed (whether the weekday is german, english, spanish, etc.)

To change the timezone, you need to use the parameter "timezone". I.e. if you just replace locale with timezone in your example, you should be good.

Hope this helps!

christianhorn commented 1 year ago

Hi,

awesome, thanks a bunch! The time part of what I am now running with sway:

env TZ="Asia/Tokyo" \
bumblebee-status/bumblebee-status \
      -m time datetimetz \
      -p time.format="日本 %H:%M" \
      -p datetimetz.format="ドイツ %H:%M" datetimetz.timezone="Europe/Berlin"

Chris