Skip to main content

The bar theme for xonsh shell.

Project description

The bar theme for xonsh shell.

[Demo]

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.1.4.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

xontrib_prompt_bar-0.1.4-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: xontrib-prompt-bar-0.1.4.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.5

File hashes

Hashes for xontrib-prompt-bar-0.1.4.tar.gz
Algorithm Hash digest
SHA256 8c5777c9a86a48353f1e86591be86b3ba41f99b5f05a2a0da038297b64abf7e0
MD5 72530fdf45489a62996bd40753701478
BLAKE2b-256 faf938bca4f03bd09d3140f90ce72071ec3da41a1aefa87d7c0e8ae56e42d71b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xontrib_prompt_bar-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 4.9 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/47.1.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.5

File hashes

Hashes for xontrib_prompt_bar-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 2c8ef28a1da91ec95cd132e4947d1a1c49d21f4438d4848d63d6f5d4f7b89bcb
MD5 8049e5cb9a3dfcfca81995ee883044df
BLAKE2b-256 2f3040748dcb67cca9d763bd922e8ee0c402cb93da8991c48d857163df6d57b3

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