Skip to main content

The bar theme for xonsh shell.

Project description

The bar prompt for the xonsh shell with customizable sections.

[Demo] Screenshot made in Konsole with $XONSH_COLOR_STYLE = "paraiso-dark".

If you like the idea of bar theme click ⭐ on the repo and stay tuned.

Features:

  • Clear concept. The bar is a delimiter and information panel. Three attention aspects: command line and path, output, sections with additional info.

  • The command beginning has fixed position to have a large command line every time and avoid mess of attention.

  • The sections placed to right but not in the same line as command and it allows you to copy the command and output without environmental disclosure.

  • Full customization. Change colors, add sections with info you need easily with Python.

Install

xpip install -U xontrib-prompt-bar
echo 'xontrib load prompt_bar' >> ~/.xonshrc
# Reload xonsh

Use cases

Fields and colors

The bar theme supports xonsh default fields and colors notation.

To customize the appearance of the fields on the bar you can use wrappers:

  • {hostname} - no wrapper
  • {hostname#section} - add backlight for the text
  • {hostname#accent} - bold font and lighter color
  • Also you can create your own fields and wrapper. See the section below.

Add custom fields and wrappers

How to add two new fields called my_left_custom and my_right_custom and one new wrapper called brackets.

$PROMPT_FIELDS['my_left_custom'] = 'Hello left!'
$PROMPT_FIELDS['my_right_custom'] = lambda: '>'*3 + ' {YELLOW}Hello right!'

$XONTRIB_PROMPT_BAR_WRAPPERS = {
    'brackets': lambda v: f'[{v}]'
}

$XONTRIB_PROMPT_BAR_LEFT = '{hostname}{user}{pwd#accent}{my_left_custom#brackets}'
$XONTRIB_PROMPT_BAR_RIGHT = '{my_right_custom#section}{env_name#section}{gitstatus_noc#section}{date_time_tz}'

xontrib load prompt_bar

Result:

[Demo custom fields]

Additional links

Known issues

Spaces in the copied and pasted command line

Please update prompt_toolkit to 3.0.7+ version:

$ xonfig | grep prompt
| prompt toolkit   | 3.0.3           |
| shell type       | prompt_toolkit  |

$ pip install -U prompt_toolkit

Future

Asynchronous section rendering:

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-prompt-bar-0.2.2.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

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

xontrib_prompt_bar-0.2.2-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file xontrib-prompt-bar-0.2.2.tar.gz.

File metadata

  • Download URL: xontrib-prompt-bar-0.2.2.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.9.0

File hashes

Hashes for xontrib-prompt-bar-0.2.2.tar.gz
Algorithm Hash digest
SHA256 8cb81aa2e5b4c3876ec737cd02cf6f3f6df958a8abe42b317b550bd8027b2775
MD5 5d9a71a8ff5e1fbc24a2b8db65673c3d
BLAKE2b-256 ae9674e6cb604b9b58b416d539b472fc2eed348d1318b381d424fc9d61402ae7

See more details on using hashes here.

File details

Details for the file xontrib_prompt_bar-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: xontrib_prompt_bar-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.9.0

File hashes

Hashes for xontrib_prompt_bar-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3a6923a9a211605a755e3f83d7a18703cc4ae6f5fbc740bc4a48f796c34ea7c0
MD5 d0a043f6e2d95a0e141323e6c3deca9a
BLAKE2b-256 8e62ca9a4b7a138a0d388efe0e77f5f87a2a298f2e5d010a714325fbbed9ca89

See more details on using hashes here.

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