Skip to main content

Powerline date segment with timezone and 30s rotation support

Project description

powerline-date

CI PyPI Python versions

A drop-in replacement for Powerline's built-in date segment that adds timezone support and lets a single segment rotate through several timezones on a fixed interval.

Features

  • Render the time or date in any IANA timezone.
  • Rotate one segment through a list of zones — each with its own format and colorscheme highlight group — instead of stacking a segment per zone.
  • Stateless: the active zone is derived from the wall clock, so nothing is kept between renders and no daemon state is required.

Installation

Install into the same environment as Powerline. If you manage Powerline with pipx:

pipx inject powerline-status powerline-date

Otherwise:

pip install powerline-date

Usage

The package exposes powerline_date.date, usable anywhere a Powerline segment function is accepted (e.g. a tmux theme's segments).

A single timezone

{
    "function": "powerline_date.date",
    "name": "utc_time",
    "args": {
        "format": "%H:%M %Z",
        "timezone": "UTC"
    }
}

Rotating through timezones

One segment can cycle through a list of zones. Each entry may carry its own format and highlight_group (a suffix appended to time:), so each zone can be colored differently in your colorscheme.

{
    "function": "powerline_date.date",
    "name": "rotating_time",
    "args": {
        "cycle_seconds": 30,
        "timezones": [
            {"timezone": "America/New_York", "format": "%I:%M %p 🗽",    "highlight_group": "eastern"},
            {"timezone": "America/Chicago",  "format": "%I:%M %p %Z 🤠", "highlight_group": "central"},
            {"timezone": "UTC",              "format": "%H:%M %Z 👾",    "highlight_group": "UTC"}
        ]
    }
}

The active entry is chosen deterministically from the current time, so no state is kept between renders. For the rotation to look smooth, Powerline must re-render at least as often as cycle_seconds. In tmux:

set -g status-interval 5

Arguments

Argument Default Description
format %Y-%m-%d strftime format. Used as the fallback when a rotation entry omits its own format.
timezone None IANA name (e.g. America/New_York). Local time is used when unset.
timezones None List of rotation entries, each with timezone and optional format / highlight_group. Takes precedence over timezone.
cycle_seconds 5 Seconds each entry is shown before rotating to the next.

Colorscheme

Each rendered entry uses the highlight groups ["time:<highlight_group>", "time"], falling back to time when the specific group is undefined, with time:divider for the divider. Define these in your colorscheme to color each zone:

{
    "groups": {
        "time":         {"fg": "white", "bg": "darkblue"},
        "time:divider": {"fg": "black", "bg": "darkblue"},
        "time:eastern": {"fg": "white", "bg": "darkblue"},
        "time:central": {"fg": "white", "bg": "darkgreen"},
        "time:UTC":     {"fg": "white", "bg": "darkestpurple"}
    }
}

When highlight_group is omitted, the timezone name itself is used as the suffix (e.g. time:America/New_York).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

powerline_date-202605.0.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

powerline_date-202605.0-py3-none-any.whl (2.9 kB view details)

Uploaded Python 3

File details

Details for the file powerline_date-202605.0.tar.gz.

File metadata

  • Download URL: powerline_date-202605.0.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for powerline_date-202605.0.tar.gz
Algorithm Hash digest
SHA256 401751924c4e65a52ae466027a72af3456d3291ff281268c557463c699eb3934
MD5 6994b5771c517be59c996763714d982e
BLAKE2b-256 497a03b84564388da4c326241600ccbd5500dda3572a50c3fda8638f2ea9040e

See more details on using hashes here.

Provenance

The following attestation bundles were made for powerline_date-202605.0.tar.gz:

Publisher: release.yml on cwood/powerline-date

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file powerline_date-202605.0-py3-none-any.whl.

File metadata

File hashes

Hashes for powerline_date-202605.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d0773ab6cce70075bcd5fa625ce372b6fb19f0ab724d8b705124d2861e5f7c19
MD5 e7a2a88b53e1624813558b41b838d802
BLAKE2b-256 fb70c48a558a4b9d9fd8d412c96d5df2e782ff0f3a85ff3189aec6c6a3335ef3

See more details on using hashes here.

Provenance

The following attestation bundles were made for powerline_date-202605.0-py3-none-any.whl:

Publisher: release.yml on cwood/powerline-date

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page