Skip to main content

Powerline3

Yet another powerline like prompt for xonsh with async prompt support.

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

Metadata

Release files for xontrib-powerline3 0.3.17

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for xontrib-powerline3 0.3.17
File Size Uploaded
xontrib-powerline3-0.3.17.tar.gz 8.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for xontrib-powerline3 0.3.17
File Interpreter ABI Platform
xontrib_powerline3-0.3.17-py3-none-any.whl Python 3 none any Details

Total release size: 17.7 kB

Release files / xontrib-powerline3-0.3.17.tar.gz

Download URL xontrib-powerline3-0.3.17.tar.gz
Size 8.4 kB
Tags Source
SHA-256 checksum
How to use checksums
ec17c6267161e77e3c2b8d70d1217dcfdd4f5660794008d1336fa1541756188e
BLAKE2b-256 checksum
How to use checksums
0d6a9e7e13038d4902c0d8b607dcc37aa395e66451390bbda80da495a0fc1c76
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.13 CPython/3.10.2 Darwin/21.4.0

Release files / xontrib_powerline3-0.3.17-py3-none-any.whl

Download URL xontrib_powerline3-0.3.17-py3-none-any.whl
Size 9.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
00e26714d1c2ba5e703d695954e85cd861f9070de4bbeb47655bc9c69e255bb6
BLAKE2b-256 checksum
How to use checksums
55d2fe4cc186f6ae5f9d0ba7ca2f700a15c533113d42e14e157a0f7adbee1010
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.13 CPython/3.10.2 Darwin/21.4.0

Release history Release notifications | RSS feed

This release

0.3.17 This release

2 release files

0.3.16

2 release files

0.3.14

2 release files

0.3.7

2 release files

0.3.5

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page