Compare commits

...

9 commits

Author SHA1 Message Date
a3de748347 fix(hostname): handle background color when failed 2025-01-11 20:50:14 +01:00
da773f822c feat(env): display env name before contents
Remove container duplicate.
2025-01-11 20:49:33 +01:00
9fb90f451e fix(hostname): was sometimes showing the username 2025-01-11 20:32:10 +01:00
steelman
afc9e26765 fix: change scope of _lp_jolly_make_env_inline_right
Make it visible outside of _lp_dotmatrix_make_env,
as its left counterpart.
2025-01-07 16:53:25 +01:00
Ludovic Rousseau
0c92a648ce
Some patches for README.md (#4)
doc(README): fix typos and deprecated features

- LP_ENABLE_VCS_DIFFSTATS no more exist and is not documented.
- Remove LP_ENABLE_UNCOMMITED.
2025-01-07 16:47:52 +01:00
3aaf5fa592 doc: more screenshots in design 2024-04-01 14:32:13 +02:00
ad41163634 doc: link to LP + screenshot 2024-04-01 14:23:39 +02:00
721554725d refactor: better emblem 2024-04-01 14:18:08 +02:00
5d8f9926b0 doc: add Jolly's emblem 2024-04-01 12:11:29 +02:00
4 changed files with 2816 additions and 30 deletions

View file

@ -7,13 +7,16 @@ It is an original prompt design, very carefully designed,
that will completely changes the way you imagine the prompt.
It is focused on *improving the user experience*,
by vastly improving the ability of the user to immediatly spot
by vastly improving the ability of the user to immediately spot
what she should do following her system's state changes.
Has such, you may find it a little bit disconcerting at first.
But we believe that the advantages of this design makes it worth the effort.
![A ship with black sails, three of which are printed with the symbols "~", "$", and ">"; going out of a circling boat wheel with sun rays in her back; and navigating a blue wave with froth going over a banner that reads "Liquid Prompt". A large black flag is attached to the front shroud, showing a skull and two crossed bones, on top of a legend reading "jolly roger".](docs/jolly_emblem.svg)
Preview
-------
@ -60,7 +63,7 @@ The prompt itself is designed in three lines:
### Example
For instance, in the following prompt, you can see that the user is in a Git repository and has some action waiting to be done:
- the rightmost blue "≠" indicates that there are some modifications waiting to be commited (hence the directional hint, from a diff to the branch).
- the rightmost blue "≠" indicates that there are some modifications waiting to be committed (hence the directional hint, from a diff to the branch).
- the leftmost blue segment indicates that there are some commits that may be pushed to the remote (hence the directional hint, from the branch to the VCS symbol).
![](screenshots/variant-chevron.png)
@ -97,7 +100,7 @@ For example:
source ~/lp-jolly/jolly.theme && lp_theme jolly
```
NOTE: The recommended segment markers (the "chevron" variant) uses characters in the private section of unicode
NOTE: The recommended segment markers (the "chevron" variant) uses characters in the private section of Unicode
that are defined by the "Nerd-fonts" project.
You will either need a compatible font, or use a variant that does not need them, like "text" and "jolly".
@ -149,8 +152,6 @@ except for the ones defining colors, specific marks and disabling some features.
The following options are honored:
- [`LP_ENABLE_PERM`](https://liquidprompt.readthedocs.io/en/stable/config.html#LP_ENABLE_PERM),
- [`LP_ENABLE_VCS_DIFFSTATS`](https://liquidprompt.readthedocs.io/en/stable/config.html#LP_ENABLE_VCS_DIFFSTATS),
- [`LP_ENABLE_UNCOMMITED`](https://liquidprompt.readthedocs.io/en/stable/config.html#LP_ENABLE_UNCOMMITED),
- [`LP_MARK_BATTERY`](https://liquidprompt.readthedocs.io/en/stable/config.html#LP_MARK_BATTERY),
- [`LP_MARK_LOAD`](https://liquidprompt.readthedocs.io/en/stable/config.html#LP_MARK_LOAD),
- [`LP_MARK_TEMP`](https://liquidprompt.readthedocs.io/en/stable/config.html#LP_MARK_TEMP),
@ -173,13 +174,13 @@ Note: the order in which you load the presets may be important.
When changing the colors of the first line, presets needs to be loaded
from your shell configuration and not just sourced in the prompt.
A first set is are called "variants" and mainly change the segment joints,
A first set is called "variants" and mainly change the segment joints,
but can also impact the icons on some variants:
- `source presets/variant-chevron.conf" (the *recommended*, need a Nerd-fonts font),
- `source presets/variant-slant.conf" (need a Nerd-fonts font),
- `source presets/variant-round.conf" (need a Nerd-fonts font),
- `source presets/variant-text.conf" (the one that works anywhere).
- `source presets/variant-chevron.conf` (the *recommended*, need a Nerd-fonts font),
- `source presets/variant-slant.conf` (need a Nerd-fonts font),
- `source presets/variant-round.conf` (need a Nerd-fonts font),
- `source presets/variant-text.conf` (the one that works anywhere).
A second set changes the colors:
@ -516,6 +517,7 @@ The color starting the gradient of the line of the middle section.
Default is white.
Valus being linearly interpolated up to `JOLLY_COLOR_LINE_END`,
it is recommended to stick to aligned ANSI values (i.e. greys)
@ -524,7 +526,9 @@ it is recommended to stick to aligned ANSI values (i.e. greys)
The color ending the gradient of the line of the middle section.
Default is black.
Valus being linearly interpolated from `JOLLY_COLOR_LINE_START`,
it is recommended to stick to aligned ANSI values (i.e. greys).

View file

@ -149,6 +149,13 @@ States that rarely change or evolve slowly are less important.
Each aspect of theming should have a related configuration variable.
## More details
If you want to know more, check our
[opinionated prompt systems comparison](https://github.com/liquidprompt/liquidprompt/wiki/Why)
that goes into more details and give examples across various other prompt systems.
# Jolly's Design Principles
## Stability
@ -164,6 +171,8 @@ change too much the location of information previously displayed.
> Sections are thus organized from left to right, in decreasing order of stability.
> Jolly always displays important segments, even in their default state, so that they are always located where the user expect them to be.
![](../screenshots/variant-chevron.png)
## Sectioning
@ -195,6 +204,8 @@ To ease the visual browsing of those segments, it uses the visual separators int
> While Jolly can theoretically use many of the "powerline" characters as separators, it recommends using the "arrow" one, which fits better the *semantic sequence* principle.
![](../screenshots/variant-round.png)
## Semantic Sequences
@ -206,6 +217,8 @@ For instance from the more generic to the more specific, from a natural order of
> Spaced reverse arrows in the VCS sections actually show the direction of the expected action
> (e.g. "to be pushed" = local-to-remote = right-to-left).
![](../screenshots/git_commits.png)
## Semantic Spaces
@ -234,6 +247,8 @@ Important information may be displayed using two other colors: one for informati
> Its default is set to blue/yellow, following the most classical recommendation to bypass the most common colorblindness issues.
> The basic segments use tones of dark and light greys with AAA contrast between them, appearing as black and white on many classical terminal backgrounds.
![](../screenshots/variant-chevron_colors-cyan-magenta.png)
## Semantic Thresholds

2761
docs/jolly_emblem.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 399 KiB

View file

@ -444,40 +444,37 @@ _lp_jolly_make_env() {
if _lp_env_vars "${LP_COLOR_ENV_VARS_SET}" "${LP_COLOR_ENV_VARS_UNSET}"; then
local lp_join
_lp_join "$I" ${lp_env_vars[@]}
_lp_jolly_make_env_inline_left+="$d${lp_join}$b"
_lp_jolly_make_env_inline_left+="${d}${lp_join}$b"
fi
if _lp_software_collections ; then
_lp_jolly_make_env_inline_left+="$d${lp_software_collections}$b"
_lp_jolly_make_env_inline_left+="${d}sc:${lp_software_collections}$b"
fi
if _lp_python_env ; then
_lp_jolly_make_env_inline_left+="$d${lp_python_env}$b"
_lp_jolly_make_env_inline_left+="${d}py:${lp_python_env}$b"
fi
if _lp_node_env ; then
_lp_jolly_make_env_inline_left+="$d${lp_node_env}$b"
_lp_jolly_make_env_inline_left+="${d}node:${lp_node_env}$b"
fi
if _lp_ruby_env ; then
_lp_jolly_make_env_inline_left+="$d${lp_ruby_env}$b"
_lp_jolly_make_env_inline_left+="${d}ruby:${lp_ruby_env}$b"
fi
if _lp_container ; then
_lp_jolly_make_env_inline_left+="$d${lp_container}$b"
_lp_jolly_make_env_inline_left+="${d}c:${lp_container}$b"
fi
if _lp_kubernetes_context ; then
_lp_jolly_make_env_inline_left+="$d${lp_kubernetes_context}$b"
_lp_jolly_make_env_inline_left+="${d}kub:${lp_kubernetes_context}$b"
fi
if _lp_terraform_env ; then
_lp_jolly_make_env_inline_left+="$d${lp_terraform_env}$b"
_lp_jolly_make_env_inline_left+="${d}tf:${lp_terraform_env}$b"
fi
if _lp_aws_profile ; then
_lp_jolly_make_env_inline_left+="$d${lp_aws_profile}$b"
_lp_jolly_make_env_inline_left+="${d}aws:${lp_aws_profile}$b"
fi
if _lp_cmake ; then
local lp_join
_lp_join "$I" ${lp_cmake_c_compiler} ${lp_cmake_cxx_compiler} ${lp_cmake_generator} ${lp_cmake_buildtype}
_lp_jolly_make_env_inline_left+="$d${lp_join}$b"
fi
if _lp_container; then
_lp_jolly_make_env_inline_left+="$d$lp_container$b"
fi
if _lp_modules; then
_lp_jolly_make_env_inline_left+="$d"
_lp_join "$I" "${lp_modules[@]}"
@ -485,7 +482,7 @@ _lp_jolly_make_env() {
fi
# History section.
local _lp_jolly_make_env_inline_right=
_lp_jolly_make_env_inline_right=
if _lp_os; then
_lp_join "$I" ${lp_os_arch} ${lp_os_family} ${lp_os_kernel} ${lp_os_distrib} ${lp_os_version}
_lp_jolly_make_env_inline_right+="$d${lp_join}$b"
@ -851,17 +848,18 @@ __jolly_activate_user() {
__jolly_activate_hostname() {
local hostname
local hostname=
if _lp_hostname; then
case "$lp_connection" in
ssh)
local client_ip client_port server_ip server_port hostname=
hostname="$lp_hostname"
local client_ip client_port server_ip server_port
IFS=" " read -r client_ip client_port server_ip server_port <<<"$SSH_CONNECTION"
local username=${USER:-${USERNAME:-${LOGNAME-}}}
if _lp_create_link "ssh://${username}@${server_ip}:${server_port}" "$lp_hostname"; then
if _lp_create_link "ssh://${username}@${server_ip}:${server_port}" "$hostname"; then
hostname="$link"
else
hostname="$lp_hostname"
hostname="$hostname"
fi
# If we want a different color for each host
if (( LP_ENABLE_SSH_COLORS )); then
@ -882,8 +880,15 @@ __jolly_activate_hostname() {
hostname="${JOLLY_HOST_LOCAL}"
fi
__jolly_make_field "$hostname" ${JOLLY_COLOR_LITE[@]+"${JOLLY_COLOR_LITE[@]}"}
_JOLLY_HOSTNAME="${jolly_field}"
if __jolly_make_field "$hostname" ${JOLLY_COLOR_LITE[@]+"${JOLLY_COLOR_LITE[@]}"} ; then
_JOLLY_HOSTNAME="${jolly_field}"
else
if __jolly_make_field "$lp_hostname" ${JOLLY_COLOR_LITE[@]+"${JOLLY_COLOR_LITE[@]}"} ; then
_JOLLY_HOSTNAME="${jolly_field}"
else
_JOLLY_HOSTNAME="${lp_hostname}"
fi
fi
}
@ -1224,7 +1229,8 @@ __jolly_join_fields() {
}
__jolly_make_field() { # string, color_array
local lp_terminal_format string="${1-}"
local string="${1-}"
local lp_terminal_format
[[ -z $string ]] && return 1
shift