diff --git a/README.md b/README.md index 828bae8..98e227e 100644 --- a/README.md +++ b/README.md @@ -195,8 +195,8 @@ Example of a compact prompt: ![](dotmatrix-unspaced.png) -#### Specific features +#### Specific features **DOTMATRIX_ENABLE_HISTORY** *boolean = 1* @@ -218,6 +218,21 @@ Maximum length of the *last* command used (counting the `DOTMATRIX_HISTORY_LAST_ Mark to display when the last command string is shortened. +**DOTMATRIX_ENABLE_SHELL** *boolean = 0* + +Display the current shell in the top-right section. + + +**DOTMATRIX_SHELL_ZSH** *string = "z"* + +The mark indicating a *zsh* shell. + + +**DOTMATRIX_SHELL_BASH** *string = "b"* + +The mark indicating a *bash* shell. + + #### Generic Markers The following options configure some marks that will be used across all variants of the theme. diff --git a/dotmatrix.theme b/dotmatrix.theme index 0dcdb6f..09324f3 100644 --- a/dotmatrix.theme +++ b/dotmatrix.theme @@ -15,6 +15,10 @@ _lp_dotmatrix_theme_activate() { DOTMATRIX_DIFF=${DOTMATRIX_DIFF:-"≠"} DOTMATRIX_ENABLE_GRADIENT_LINE=${DOTMATRIX_ENABLE_GRADIENT_LINE:-0} + DOTMATRIX_ENABLE_SHELL=${DOTMATRIX_ENABLE_SHELL:-0} + + DOTMATRIX_SHELL_ZSH=${DOTMATRIX_SHELL_ZSH:-"z"} + DOTMATRIX_SHELL_BASH=${DOTMATRIX_SHELL_BASH:-"b"} DOTMATRIX_ENABLE_HISTORY=${DOTMATRIX_ENABLE_HISTORY:-1} DOTMATRIX_HISTORY_LAST_LEN=${DOTMATRIX_HISTORY_LAST_LEN:-$((COLUMNS/4))} @@ -227,7 +231,25 @@ _lp_dotmatrix_theme_activate() { [[ ${#DOTMATRIX_COLOR_SEP_LITE[@]} == 0 ]] && DOTMATRIX_COLOR_SEP_LITE=( 15 -2 0 0 15 -2) + # LP_COLORMAP=( ${LP_COLORMAP[@]+"${LP_COLORMAP[@]}"} ) + # if [[ ${#LP_COLORMAP[@]} == 0 ]]; then + local lp_terminal_format + lp_terminal_format ${DOTMATRIX_COLOR_DARK[@]+"${DOTMATRIX_COLOR_DARK[@]}"} + local l1="$lp_terminal_format" + lp_terminal_format ${DOTMATRIX_COLOR_NOTE[@]+"${DOTMATRIX_COLOR_NOTE[@]}"} + local l2="$lp_terminal_format" + lp_terminal_format ${DOTMATRIX_COLOR_WARN[@]+"${DOTMATRIX_COLOR_WARN[@]}"} + local l3="$lp_terminal_format" + LP_COLORMAP=( + "" # l0 + "$l1" + "$l2" + "$l3" + ) + # fi + __dotmatrix_activate_display + # __dotmatrix_activate_shell __dotmatrix_activate_connection __dotmatrix_activate_user __dotmatrix_activate_multiplexer @@ -290,21 +312,21 @@ _lp_dotmatrix_theme_prompt() { local blt_plug="${dotmatrix_sep}" local battery= - if _lp_battery ; then + if _lp_battery_color ; then __dotmatrix_make_field "$lp_battery" ${DOTMATRIX_COLOR_DARK[@]+"${DOTMATRIX_COLOR_DARK[@]}"} battery="${dotmatrix_field}${LP_MARK_BATTERY}" has_notes=$((has_notes+1)) fi local load= - if _lp_load ; then + if _lp_load_color ; then __dotmatrix_make_field "$lp_load" ${DOTMATRIX_COLOR_DARK[@]+"${DOTMATRIX_COLOR_DARK[@]}"} load="${dotmatrix_field}${LP_MARK_LOAD}" has_notes=$((has_notes+1)) fi local temperature= - if _lp_temperature ; then + if _lp_temperature_color ; then __dotmatrix_make_field "$lp_temperature" ${DOTMATRIX_COLOR_DARK[@]+"${DOTMATRIX_COLOR_DARK[@]}"} temperature="${dotmatrix_field}${LP_MARK_TEMP}" has_notes=$((has_notes+1)) @@ -363,6 +385,11 @@ _lp_dotmatrix_theme_prompt() { side+="${lp_terminal_format}" fi + # Called here for an easy access to the configured color. + if __dotmatrix_activate_shell ; then + side+="${_DOTMATRIX_SHELL}" + fi + # clock if _lp_time ; then __dotmatrix_make_sep_plug ${DOTMATRIX_COLOR_DARK[@]+"${DOTMATRIX_COLOR_DARK[@]}"} @@ -398,7 +425,7 @@ _lp_dotmatrix_theme_prompt() { lp_terminal_format ${DOTMATRIX_COLOR_LINE[@]+"${DOTMATRIX_COLOR_LINE[@]}"} - local inline_left="${NO_COL}$LP_PS1_PREFIX${lp_terminal_format}" + local inline_left="${NO_COL}$LP_PS1_PREFIX${lp_terminal_format}${DOTMATRIX_LINE}" # Dev env section. local ista="$_LP_FIRST_INDEX" @@ -447,6 +474,8 @@ _lp_dotmatrix_theme_prompt() { inline_right="$d${hist_most}$I${hist_last}$b" fi + inline_right+="${DOTMATRIX_LINE}" + local inline # FIXME use _lp_fill-like function to handle multi-character line? if ((DOTMATRIX_ENABLE_GRADIENT_LINE)); then @@ -572,6 +601,20 @@ __dotmatrix_activate_display() { fi } +__dotmatrix_activate_shell() { + ((DOTMATRIX_ENABLE_SHELL)) || return 2 + + if ((_LP_SHELL_zsh)) ; then + __dotmatrix_make_sep_plug ${DOTMATRIX_COLOR_DARK[@]+"${DOTMATRIX_COLOR_DARK[@]}"} + __dotmatrix_make_field "$DOTMATRIX_SHELL_ZSH" ${DOTMATRIX_COLOR_DARK[@]+"${DOTMATRIX_COLOR_DARK[@]}"} + _DOTMATRIX_SHELL="${dotmatrix_sep}${dotmatrix_field}" + else + __dotmatrix_make_sep_plug ${DOTMATRIX_COLOR_LITE[@]+"${DOTMATRIX_COLOR_LITE[@]}"} + __dotmatrix_make_field "$DOTMATRIX_SHELL_BASH" ${DOTMATRIX_COLOR_LITE[@]+"${DOTMATRIX_COLOR_LITE[@]}"} + _DOTMATRIX_SHELL="${dotmatrix_sep}${dotmatrix_field}" + fi +} + __dotmatrix_activate_connection() { _lp_user diff --git a/liquidprompt_dotmatrix_design.odt b/liquidprompt_dotmatrix_design.odt index d6bd555..94b7693 100644 Binary files a/liquidprompt_dotmatrix_design.odt and b/liquidprompt_dotmatrix_design.odt differ diff --git a/liquidprompt_dotmatrix_design.svg b/liquidprompt_dotmatrix_design.svg index b3f9e5e..b1eb1dc 100644 --- a/liquidprompt_dotmatrix_design.svg +++ b/liquidprompt_dotmatrix_design.svg @@ -4,16 +4,15 @@ - Liquid Prompt DotMatrix Design + xmlns:svg="http://www.w3.org/2000/svg"> + + + + + inkscape:groupmode="layer" + inkscape:label="Page 1" + transform="matrix(1.3333333,0,0,-1.3333333,0,1122.5197)"> @@ -46,6 +69,7 @@ id="text26">localhost logged│ home ┌┴┐┌┴┐┌┴┐   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ├┘ no-internet admin remote dirstack detached suspended X su │ tmux │ RO VCS root cwd │ batt load temp │ bg │ time + sodipodi:role="line" + id="tspan184">X su │ tmux │ RO VCS root cwd │ recall batt load temp │ bg │shell time @@ -346,9 +379,10 @@ transform="matrix(1,0,0,-1,0.1,692.689)" style="font-variant:normal;font-weight:normal;font-size:8px;font-family:'MesloLGS NF';-inkscape-font-specification:MesloLGS-NF-Regular;writing-mode:lr-tb;fill:#008400;fill-opacity:1;fill-rule:nonzero;stroke:none" id="text192">├┐┌┴┐┌─┴─┐┌┴┐┌──┴──┐┌┴┐ ┌─────┴─────┐ ┌───┴────┐ ┌┴┐ ┌┴─┐┌─┴─┐┌─┴┐ ┌┴┐┌┴┐┌┴┐┌───┴───┐ + sodipodi:role="line" + id="tspan190">├┐┌┴┐┌─┴─┐┌┴┐┌──┴──┐┌┴┐ ┌─────┴─────┐ ┌───┴────┐ ┌┴┐├┐ ┌┴─┐┌─┴─┐┌─┴┐ ┌┴┐┌┴┐┌┴┐┌┴┐ ┌───┴───┐ @@ -376,6 +410,7 @@ id="text208">█ root server ~ code liquidprompt theme dotmatrix + id="tspan388">2 @@ -733,2296 +779,2756 @@   - - - - 24% - - - - + id="tspan400"> + + +  + id="path410" /> + id="g412"> + 24% + + + + + + + + 1.68 + + + 1.68 - - - - + id="tspan438">╱ + id="path442" /> + id="g444"> 90° + sodipodi:role="line" + id="tspan446">90° + d="M 476.6,670.239 H 481.35 V 680.289 H 476.6 Z" + style="fill:#007ffe;fill-opacity:1;fill-rule:evenodd;stroke:none" + id="path450" /> + id="g452"> + + + + + 3d + + +  3d - - - - + id="tspan470">╱ + d="M 500.7,670.239 H 510.25 V 680.289 H 500.7 Z" + style="fill:#007ffe;fill-opacity:1;fill-rule:evenodd;stroke:none" + id="path474" /> + id="g476"> 2& + sodipodi:role="line" + id="tspan478">2& + d="M 510.3,670.239 H 515.05 V 680.289 H 510.3 Z" + style="fill:#007ffe;fill-opacity:1;fill-rule:evenodd;stroke:none" + id="path482" /> + id="g484"> + id="tspan486">╱ + + 1z + + - - 1z - - - - - - - - 15:20:34 - + id="path498" /> + + + + + + + b + + + + + + + + + + 15:20:34 + + ━ scl ━ venv + id="tspan540">━ + id="g544"> + + + scl0 + + + ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - - - - + id="tspan558">┃ - + id="g562" /> + + sodipodi:role="line" + id="tspan566">scl1 - - - ± - - - - - - - - - - - - + - - - - - - + id="tspan572"> - + id="g576"> - + id="tspan578">━ - + id="g582"> + id="tspan584"> + + + venv - + id="tspan596"> - - - + id="g600"> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + + + + + + + main + sodipodi:role="line" + id="tspan618"> + d="M 17.7,650.039 H 22.45 V 660.089 H 17.7 Z" + style="fill:#ddd;fill-opacity:1;fill-rule:evenodd;stroke:none" + id="path622" /> + id="g624"> : + id="tspan626"> + id="path630" /> + id="g632"> feat + sodipodi:role="line" + id="tspan634">± - - - - - + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + v0.1 + sodipodi:role="line" + id="tspan710">main + id="path714" /> - + id="g716"> - - - - - - - - - + - - - - - - - - + id="tspan718">: - - - - - - - - - - + id="path722" /> + id="g724"> - - - - - - + sodipodi:role="line" + id="tspan726">feat + id="path730" /> + id="g732"> + id="tspan734">╱ + id="path738" /> + id="g740"> - - - - - - - - detached + sodipodi:role="line" + id="tspan742">v0.1 + d="M 153.9,650.039 H 158.65 V 660.089 H 153.9 Z" + style="fill:#d0d0d0;fill-opacity:1;fill-rule:evenodd;stroke:none" + id="path746" /> + id="g748" /> + + id="tspan752"> - - - + id="g756"> 20s - - - - - - + id="tspan758"> + d="M 168.3,650.039 H 173.05 V 660.089 H 168.3 Z" + style="fill:#007ffe;fill-opacity:1;fill-rule:evenodd;stroke:none" + id="path762" /> + id="g764" /> + + + id="tspan770">+ + d="M 177.9,650.039 H 185.85 V 660.089 H 177.9 Z" + style="fill:#007ffe;fill-opacity:1;fill-rule:evenodd;stroke:none" + id="path774" /> + id="g776"> 125 - - - + id="tspan778">➁ + - + id="g784"> + id="tspan786">╱ + + id="g792"> ├┘└┬┘├┘└──┬──┘└─┬──┘└─┬┘└─┬─┘ ├┘└───┬───┘└┬┘└┬┘└───┬───┘└┬─┘ └┬─┘ ├┘ + id="tspan794">- + + id="g800"> │VCS push!│ │bookmark │ commit! │ stash │ head st. Runtime│ sudo - - + id="tspan802">⁺ itnet upstream branch tag diff untracked error + id="tspan806">⑳ + + + + + + + + + + + + + + + + + + + + + + + detached + + + + + + + + + + ssh + sodipodi:role="line" + id="tspan878">20s + + + + + + id="g892"> + + + + + 125 + + + + + + + + + + ├┘ └┬┘ ├┘└──┬──┘└─┬──┘└─┬┘└─┬─┘ ├┘└───┬───┘└┬┘└┬┘└───┬───┘ └┬─┘ └┬─┘ ├┘ + + + │ VCS push!│ │bookmark │ commit! │ stash │ head st. Runtime│ sudo + + + itnet upstream branch tag diff untracked error + + + ssh + + txt│ guest FQDN chroot shorten + sodipodi:role="line" + id="tspan946">txt│ guest FQDN chroot shorten - - ├┐┌┴┐┌──┴───┐ ┌────┴─────┐┌┴┐ ┌┴┐ - - - - - T - - -  - - - - - - - - - - - rycieos - - - - - - - - - - host.fq.dn - - -  - - - - - - - - - - - - - ~ - - + sodipodi:role="line" + id="tspan952">├┐┌┴┐┌──┴───┐ ┌────┴─────┐┌┴┐ ┌┴┐ - + id="g956" /> + + code + sodipodi:role="line" + id="tspan962">T - + sodipodi:role="line" + id="tspan968"> - + id="g972"> + id="tspan974"> + d="M 24.1,538.939 H 28.85 V 548.989 H 24.1 Z" + style="fill:#333;fill-opacity:1;fill-rule:evenodd;stroke:none" + id="path978" /> + id="g980"> + id="tspan982">█ + d="M 28.9,538.939 H 62.55 V 548.989 H 28.9 Z" + style="fill:#007ffe;fill-opacity:1;fill-rule:evenodd;stroke:none" + id="path986" /> + id="g988"> files + sodipodi:role="line" + id="tspan990">rycieos +   + id="tspan998"> - - - - ━ pyenv ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - + id="g1004" /> + d="M 72.2,538.939 H 125.15 V 548.989 H 72.2 Z" + style="fill:#d0d0d0;fill-opacity:1;fill-rule:evenodd;stroke:none" + id="path1006" /> + id="g1008"> host.fq.dn + + + + sodipodi:role="line" + id="tspan1016"> - + id="g1020"> + id="tspan1022"> + d="M 139.7,538.939 H 144.45 V 548.989 H 139.7 Z" + style="fill:#333;fill-opacity:1;fill-rule:evenodd;stroke:none" + id="path1026" /> + id="g1028"> + id="tspan1030">█ + d="M 144.5,538.939 H 149.25 V 548.989 H 144.5 Z" + style="fill:#4c4c4c;fill-opacity:1;fill-rule:evenodd;stroke:none" + id="path1034" /> + id="g1036" /> + + 1 + sodipodi:role="line" + id="tspan1042">~ + - - - - - - telnet chroot + RO - - - ┌─┴─┐ ┌─┴──┐ - - - - - T + sodipodi:role="line" + id="tspan1050">╱ + + id="g1056"> + sodipodi:role="line" + id="tspan1058">code + + + + + + + + + + + + +  + sodipodi:role="line" + id="tspan1090">files + sodipodi:role="line" + id="tspan1096">  + id="tspan1104"> - + id="g1108"> nojhan - - - - - - - - - - host + id="tspan1110">━ + id="g1114"> + id="tspan1116"> + id="g1120">  + sodipodi:role="line" + id="tspan1122">pyenv + id="g1126"> + + + ━━━━ + + + ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + + + + + + + + id="tspan1156"> + d="M 9.6,518.739 H 14.35 V 528.789 H 9.6 Z" + style="fill:#e8e8e8;fill-opacity:1;fill-rule:evenodd;stroke:none" + id="path1160" /> + id="g1162"> + id="tspan1164">█ + d="M 14.4,518.739 H 19.15 V 528.789 H 14.4 Z" + style="fill:#ffd800;fill-opacity:1;fill-rule:evenodd;stroke:none" + id="path1168" /> - - + id="g1170"> ~ + id="tspan1172">1 - + id="tspan1178"> - + id="g1182"> code + sodipodi:role="line" + id="tspan1184"> - + id="g1188" /> + + sodipodi:role="line" + id="tspan1192">└┬┘ - + id="g1196"> + sodipodi:role="line" + id="tspan1198">shell-level + + + Tag - - - - - here + sodipodi:role="line" + id="tspan1210">│ telnet chroot + RO -   - - - - - - 15:20:34 - - + id="g1214"> ━ devtoolset-8 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + sodipodi:role="line" + id="tspan1216">├┐┌─┴─┐ ┌─┴──┐ + + d="M 0,427.839 H 9.65 V 437.889 H 0 Z" + style="fill:#d0d0d0;fill-opacity:1;fill-rule:evenodd;stroke:none" + id="path1222" /> + id="g1224"> - - -  + sodipodi:role="line" + id="tspan1226">T - + id="g1230"> ± + id="tspan1232"> + + +  + + + + + + + + + nojhan + + + id="path1264" /> + id="g1266"> + id="tspan1268"> + + - - + id="g1278"> main + sodipodi:role="line" + id="tspan1280">host - - + id="g1284">   + id="tspan1286"> + id="g1290"> └┬┘ + sodipodi:role="line" + id="tspan1292"> + + + + proxy - - - Generic example: - - - - X + id="tspan1306">█ + + + + + ~ + + + sodipodi:role="line" + id="tspan1326">╱ + sodipodi:role="line" + id="tspan1334">code + sodipodi:role="line" + id="tspan1342">╱ + sodipodi:role="line" + id="tspan1350">… - - + id="g1356"> - - - - - - - - - - - - - - - - - - ~ - - - - - - + sodipodi:role="line" + id="tspan1358">╱ + id="path1362" /> + id="g1364"> code + sodipodi:role="line" + id="tspan1366">here - + id="g1370"> + sodipodi:role="line" + id="tspan1372">  + id="path1376" /> + + + + 15:20:34 + + + GIT ━ + + + + + + devtoolset-8 + + + + + + ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + + + + + + + liquidprompt - - - + id="tspan1434"> + + + id="tspan1446"> theme + sodipodi:role="line" + id="tspan1454">± + id="tspan1462"> - dotmatrix - + id="g1468" /> + + id="g1472">   + sodipodi:role="line" + id="tspan1474">main + d="M 65.7,407.639 H 70.45 V 417.689 H 65.7 Z" + style="fill:#d0d0d0;fill-opacity:1;fill-rule:evenodd;stroke:none" + id="path1478" /> - + id="g1480" /> + id="g1482"> 15:20:34 + sodipodi:role="line" + id="tspan1484">  + id="g1488"> + └┬┘ + + + proxy + + ━━━━━━━━━━━━━━ - - - ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + sodipodi:role="line" + id="tspan1502">Generic example: + d="M 0,326.839 H 4.75 V 336.889 H 0 Z" + style="fill:#d0d0d0;fill-opacity:1;fill-rule:evenodd;stroke:none" + id="path1506" /> + id="g1508"> + id="tspan1510">X - + id="tspan1516">█ ± - - - - - - + id="tspan1524"> + d="M 14.4,326.839 H 19.15 V 336.889 H 14.4 Z" + style="fill:#333;fill-opacity:1;fill-rule:evenodd;stroke:none" + id="path1528" /> + id="g1530"> + + + + + + + id="g1546" /> + + + id="tspan1552"> - - + id="tspan1560">█ - - + id="g1566"> dotmatrix + sodipodi:role="line" + id="tspan1568">⌂ + d="M 48.1,326.839 H 52.85 V 336.889 H 48.1 Z" + style="fill:#4c4c4c;fill-opacity:1;fill-rule:evenodd;stroke:none" + id="path1572" /> - + id="g1574"> + id="tspan1576"> + + + + id="tspan1588">~ + sodipodi:role="line" + id="tspan1600">╱ - - + id="g1606"> + sodipodi:role="line" + id="tspan1608">code + d="M 101,326.839 H 110.65 V 336.889 H 101 Z" + style="fill:#4c4c4c;fill-opacity:1;fill-rule:evenodd;stroke:none" + id="path1612" /> + id="g1614"> + + liquidprompt + + + + + + + + sodipodi:role="line" + id="tspan1636">╱ + + id="g1642"> theme + + + + + + + + dotmatrix + + +   + + + + + + + sodipodi:role="line" + id="tspan1678">15:20:34 - + id="g1682"> + sodipodi:role="line" + id="tspan1684">━━━━━━━━━━━━━━ + id="g1688"> + ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + + + + + + + + + + + + + + + ± + + + + + + + + + + + + + + + + + + + + + + + + dotmatrix + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +  + + + + + + ⚀⚁⚂⚃⚄⚅ + - - - - Liquid Prompt DotMatrix Design - 2021-02-07 - - - nojhan - - - - - +