petobens / trueline

Fast and extensible bash powerline prompt with true color and fancy icon support
MIT License
385 stars 36 forks source link

Added option for raw prompt #39

Closed dgtlife closed 1 year ago

dgtlife commented 3 years ago

I use the newline option, and prefer a "raw" prompt on the second line as opposed to one wrapped in a segment with non-default background and segment separator. Perhaps there may be others who have this preference.

In order to enable this choice I added a TRUELINE_NEWLINE_PROMPT_WITHOUT_SEGMENT option and the logic to process the choices. If the option is "true", then the segment separator is removed and the user can enable the "newline" prompt segment with default_bg and default_fg in order to get the raw prompt on the default terminal background. If the option is false, then the "newline" segment operates as it does now with a segment-enclosed prompt character on the second line.

petobens commented 3 years ago

Can you post a screenshot with the new (and old) behaviours?

dgtlife commented 3 years ago

I can do that later today.

dgtlife commented 3 years ago

Here are some window shots to illustrate this "raw" prompt option.

Following is a window shot of the default Trueline prompt, i.e. nothing in .bashrc Bash_with_Trueline--default

Following is a window shot of the Trueline prompt adding the newline segment enabled with following lines in .bashrc:

declare -a TRUELINE_SEGMENTS=(
    'user,black,white,bold'
    'working_dir,mono,black,normal'
    'newline,black,light_blue,bold'
)

Bash_with_Trueline--default-newline

Following is a window shot of the Trueline prompt with the newline segment using default_fg and default_bg with the following lines in .bashrc:

declare -a TRUELINE_SEGMENTS=(
    'user,black,white,bold'
    'working_dir,mono,black,normal'
    'newline,default_fg,default_bg,bold'
)

Bash_with_Trueline--newline-with-default-fg-on-bg

Following is a window shot of the Trueline prompt with the newline segment using default_fg and default_bg and enabling the TRUELINE_NEWLINE_PROMPT_WITHOUT_SEGMENT option with the following lines in .bashrc:

declare -a TRUELINE_SEGMENTS=(
    'user,black,white,bold'
    'working_dir,mono,black,normal'
    'newline,default_fg,default_bg,bold'
)
TRUELINE_NEWLINE_PROMPT_WITHOUT_SEGMENT=true

Bash_with_Trueline--newline-with-default-fg-on-bg-and-no-segment

petobens commented 3 years ago

Using:

declare -a TRUELINE_SEGMENTS=(
    'user,black,white,bold'
    'working_dir,mono,black,normal'
    'newline,default_fg,black,bold'
)

I get: image

which keeps the separator but hides it by using the same color as the default background. Isn't this good enough? I want to avoid adding more options/configs unless it's strictly necessary

dgtlife commented 3 years ago

This tactic does not produce the results I want, and have achieved through my modification. I want to remove segments from the second line in order to reclaim maximum space for commands, which can sometimes be long.

Your suggestion requires the black color to be exactly the same as the terminal background. This is an unnecessary constraint. What if I want 95% transparency on the terminal background. What if I want a terminal theme with a slightly lighter background.

Anyway, I think the most significant portion of your response is this:

"Isn't this good enough? I want to avoid adding more options/configs unless it's strictly necessary"

No user preference is ever "strictly necessary", and "good enough" means settling for your preferences. The more options you provide, the more user preferences you can support, and the more people can, and will, use Trueline.

petobens commented 3 years ago

Ok. Let's add this but simplify it in a single conditional (no else branch), rename it to TREUELINE_SHOW_TRAILING_SEPARATOR=true and add default configs and a readme entry.

dgtlife commented 3 years ago

OK, my last commit should be mutually acceptable.

petobens commented 1 year ago

Closing due to inactivity