Skip to main content

Yet another powerline theme for xonsh with async prompt support.

Project description

Powerline3

Yet another powerline theme for xonsh with async prompt support.

Note:

This depends on xonsh's unreleased version (master branch will work. or in future >0.9.24)

Why another one?

  • It uses $PROMPT_FIELDS and no need to have a separate functions and renderer. Since the addition of $PROMPT_TOKENS_FORMATTER it is possible to use the existing set of functions to emulate powerline theme for xonsh prompts.
  • Async prompt mode works as well.

Installation

To install use pip:

xpip install xontrib-powerline3
# or: xpip install -U git+https://github.com/jnoortheen/xontrib-powerline3

Usage

xontrib load powerline3 prompt_ret_code

# the foreground/background colors of the prompt-fields can be configured as below. 
# This works for custom fields as well
# The format is `<prompt-field-name>__pl_colors`. It can be a function returning `tuple[str, str]`
# or set tuples directly as below.
$PROMPT_FIELDS["cwd__pl_colors"] = ("WHITE", "CYAN")

# choose the powerline glyph used
$POWERLINE_MODE = "powerline" # if not set then it will choose random
# available modes: round/down/up/flame/squares/ruiny/lego

# define the prompts using the format style and you are good to go
$PROMPT = "".join(
    [
        "{vte_new_tab_cwd}",
        "{cwd:{}}",
        "{gitstatus:{}}",
        "{ret_code}",
        "{background_jobs}",
        os.linesep,
        "{full_env_name: 🐍{}}",
        "$",
    ]
)
$RIGHT_PROMPT = "".join(
    (
        "{long_cmd_duration: ⌛{}}",
        "{user: 🤖{}}",
        "{hostname: 🖥{}}",
        "{localtime: 🕰{}}",
    )
)

Extra PROMPT_FIELDS

1. full_env_name

  • When the env_name
    • is .venv show the name of the parent folder
    • contains -py3.* (when it is poetry created) shows the project name part alone

2. background_jobs

  • show number of running background jobs

Examples

screenshot.png

Credits

This package was created with xontrib cookiecutter template.

Similar Projects

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

xontrib-powerline3-0.3.16.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

xontrib_powerline3-0.3.16-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

Details for the file xontrib-powerline3-0.3.16.tar.gz.

File metadata

  • Download URL: xontrib-powerline3-0.3.16.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.10.1 Darwin/21.1.0

File hashes

Hashes for xontrib-powerline3-0.3.16.tar.gz
Algorithm Hash digest
SHA256 9d6188f01ff14f43f1cc227127fa7df09e337ab4686d6908c4caaf3d1cf3789f
MD5 bb4b567fd2d90081432e2468da9f8c8c
BLAKE2b-256 0062a899d3fcff0b24b404f6761c616ced6ad3508be751a302bb60e4c9661740

See more details on using hashes here.

File details

Details for the file xontrib_powerline3-0.3.16-py3-none-any.whl.

File metadata

File hashes

Hashes for xontrib_powerline3-0.3.16-py3-none-any.whl
Algorithm Hash digest
SHA256 523e1d20abfff113d8be88eeef7925373e9219a04e7406f4b0f5e1d4ee81734a
MD5 9fe0d85b1bf1a09c85664f214ee12580
BLAKE2b-256 3eb04f43e7825fec8b4554a49c35dce90acb13573ee6244bb64b73a14295b833

See more details on using hashes here.

Supported by

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