The bar theme for xonsh shell.
Project description
The bar prompt for the xonsh shell with customizable sections.
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:
-
Zero dependencies. You don't need to install additional packages.
-
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 fields:
- xonsh default fields and colors notation
screens
- list of the windows that created by screen window managercwd_abs
- current absolute path (~
disabled)date_time_tz
- date and time with timezone i.e.21-12-25 18:00:00-01
gitstatus_noc
- the same as xonshgitstatus
but without colors
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{starship#noesc}
- remove ANSI escape characters (colors){starship#noesc_strip}
- remove ANSI escape characters (colors) and strip (remove white spaces in the begin and end)- 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}{cwd_abs#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:
Using Starship cross-shell prompt to rendering right sections
Barship using xontrib-prompt-starship:
# First of all create a starship config to return sections in one line
$XONTRIB_PROMPT_STARSHIP_RIGHT_CONFIG = "~/.config/starship_xonsh_right.toml"
$XONTRIB_PROMPT_STARSHIP_REPLACE_PROMPT = False
$XONTRIB_PROMPT_BAR_RIGHT = '{starship_right#noesc_strip}'
xontrib load prompt_starship prompt_bar
Result:
Additional links
- Asynchronous section rendering
- xonsh default fields and colors notation
- Meaning of git status symbols (●×+⚑✓↑↓)
- Awesome example of rewriting the theme from Jonathan Slenders
- Customization the colors in the input line
Known issues
Spaces in the copied and pasted command line
Please update prompt_toolkit
to 3.0.7+ version via pip install -U prompt_toolkit
.
Credits
- This package is the part of ergopack - the pack of ergonomic xontribs.
- This package was created with xontrib cookiecutter template.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for xontrib_prompt_bar-0.3.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 116bf7392124bfdee6a8eb9d0ab0632841902dc88bd7906167fdb46687e80f3e |
|
MD5 | b875805f63e965fc475bf768d3ab2408 |
|
BLAKE2b-256 | 6506c9b379998e8c34f5566ab3a076220df9e48a9436ccd58d1d5ad7d4f61326 |