Bug 2239152

Summary: Usability regression in the proposed colored bash prompt
Product: [Fedora] Fedora Reporter: Thomas M Steenholdt <tmus>
Component: shell-color-promptAssignee: Jens Petersen <petersen>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: unspecified    
Version: 39CC: admiller, information, kasal, kdudka, petersen, svashisht
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: shell-color-prompt-0.2-1.fc37 shell-color-prompt-0.2-1.fc38 shell-color-prompt-0.2-1.el9 shell-color-prompt-0.4-1.fc39 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-11-20 00:50:57 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2233267    

Description Thomas M Steenholdt 2023-09-15 14:18:07 UTC
I love the idea of a colorized prompt by default on Fedora, but the current proposal has some issues that I feel are regressions in usability:


1. The format of the prompt changes from the well known Fedora format to a more Ubuntu-esque prompt:

Current:
[user@workstation ~]$

Proposed:
user@workstation:~$

Suggestion:
Keep the current format, just add colors.


2. The proposal includes the RC code in the prompt, which is a major nuisance in most situations (regardless of the format), and in this case also clashes with the path:

Proposed:
user@workstation:/1$

Suggestion:
Remove the RC from the prompt by default. We never had this before and it seems too busy for a default.


3. username, hostname and path are all the same color, which is not ideal:

Suggestion:
Select a different color for that path-portion of the prompt.


Overall, I feel something like this strikes a better balance between usability and not changing the stuff that works.

PROMPT_COLOR=""
PROMPT_PATH_COLOR=""
PS1="[\[\e[${PROMPT_COLOR:-1;32}m\]\u@\h\[\e[0m\] \[\e[${PROMPT_PATH_COLOR:-1;34}m\]\w\[\e[0m\]]\$ "



Reproducible: Always

Comment 1 Lukáš Zaoral 2023-09-15 14:23:10 UTC
Hello,
this feature is not part of bash package nor is maintained by any current bash maintainer.  Reassigning to shell-color-prompt.

Regards
Lukas

Comment 2 Thomas M Steenholdt 2023-09-20 00:22:18 UTC
Another thing, the proposal has changed the basic look of the prompt for normal users, but no change has been implemented for root (even as a colorless variant). Things should probably be aligned either way.

Comment 3 Jens Petersen 2023-11-10 06:21:50 UTC
You are right that the working dir format changed.
I am not a fan of "information hiding": to me \W is too terse/ambiguous.
So I would like to see the bash system default change to \w.
I can open such an RFE and see.
I certainly agree consistency does make sense.

Not changing root was kind of intentional - though personally I would like to color root too.
So of the original feedback was sceptical about color blindness etc, so I took a conservative minimal approach.

I have made the exit code opt-in in rawhide yesterday and I am adding a PROMPT_DIR_COLOR envvar to allow changing the dir color easily.
I will backport those soon to current releases too.

Overall tighter integration with the main bash package would help here (and is still possible in the future I hope),
but I also wanted to start with something that can be disabled/removed with just one command.

Thanks for the good feedback.

Comment 4 Jens Petersen 2023-11-10 06:22:41 UTC
And sorry I didn't see this earlier, my bad :-(

Comment 5 Jens Petersen 2023-11-10 17:16:47 UTC
I pushed 0.2 to rawhide which tries to address a few more of your concerns.
I wish there was an easy way to toggle \w and \W
(if only bash supported ternary expansions:
the only workaround around I know is to introduce another envvar for the directory expansion).
I may do that in the future: I think it might also require a second envvar for the separator (space or colon)
(short of an if statement with separate PS1's, which I would rather avoid so far).

I would like to revisit root color later too.

Comment 6 Fedora Update System 2023-11-10 17:18:03 UTC
FEDORA-2023-3e862eb724 has been submitted as an update to Fedora 39. https://bodhi.fedoraproject.org/updates/FEDORA-2023-3e862eb724

Comment 7 Fedora Update System 2023-11-11 02:24:03 UTC
FEDORA-2023-fb9fbe1bed has been submitted as an update to Fedora 38. https://bodhi.fedoraproject.org/updates/FEDORA-2023-fb9fbe1bed

Comment 8 Fedora Update System 2023-11-11 02:30:59 UTC
FEDORA-2023-3e862eb724 has been pushed to the Fedora 39 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2023-3e862eb724`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2023-3e862eb724

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 9 Fedora Update System 2023-11-11 06:03:39 UTC
FEDORA-2023-79d91fcab0 has been submitted as an update to Fedora 37. https://bodhi.fedoraproject.org/updates/FEDORA-2023-79d91fcab0

Comment 10 Fedora Update System 2023-11-11 08:49:35 UTC
FEDORA-EPEL-2023-dc012e88bc has been submitted as an update to Fedora EPEL 9. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2023-dc012e88bc

Comment 11 Fedora Update System 2023-11-12 01:28:58 UTC
FEDORA-2023-fb9fbe1bed has been pushed to the Fedora 38 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2023-fb9fbe1bed`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2023-fb9fbe1bed

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 12 Fedora Update System 2023-11-12 02:23:37 UTC
FEDORA-EPEL-2023-dc012e88bc has been pushed to the Fedora EPEL 9 testing repository.

You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2023-dc012e88bc

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 13 Fedora Update System 2023-11-12 03:08:41 UTC
FEDORA-2023-79d91fcab0 has been pushed to the Fedora 37 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2023-79d91fcab0`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2023-79d91fcab0

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 14 Thomas M Steenholdt 2023-11-12 11:21:41 UTC
The latest changes massively improves on the customizability of the default shell, which I believe is an improvement.

I'm still not a big fan of the new "layout", however. But if given the possibility to tweak the ":" delimiter between hostname and path in addition to the other improvements, I can actually make it look just the way I like it (which I believe is more in line with previous Fedora prompts and makes it easier to distinguish the prompt from other terminal content), without changing the actual PS1 variable myself.

# This is the new prompt, but with PROMPT_DELIMITER added as a way to customize the ":" part:
PS1='${PROMPT_BRACKETS:+[}\[\e[${PROMPT_COLOR:-32}m\]\u@\h\[\e[0m\]${PROMPT_DELIMITER:-:}\[\e[${PROMPT_DIR_COLOR:-${PROMPT_COLOR:-32}}m\]\w${PROMPT_ERROR:+\[\e[0;31m\]${?#0}}\[\e[0m\]${PROMPT_BRACKETS:+]}\$ '

With this in place, "the perfect prompt" can be set with:

PROMPT_BRACKETS=1
PROMPT_COLOR='1;32'
PROMPT_DELIMITER=' '
PROMPT_DIR_COLOR='1;34'

Sure, it's easier to just set the PS1 value the way I like it, but we're so close. :-)

Comment 15 Jens Petersen 2023-11-13 03:26:43 UTC
Thanks Thomas, glad you liked the improvements.
I agree with you and I think we are thinking the same. :-)

I basically also implemented your idea with a $PROMPT_SEPARATOR.
Took me some days to get it right and together with $PROMPT_DIRECTORY
for those that prefer '\W`.

I replaced PROMPT_BRACKETS with PROMPT_START and PROMPT_END
for further flexibility.

Thanks for the great feedback and suggestions.
Really helped to improve bash-color-prompt.

Now your perfect prompt might look like this:
```
PROMPT_START='['
PROMPT_END=']'
PROMPT_SEPARATOR=' '
PROMPT_DIRECTORY='\W'
PROMPT_COLOR='1;32'
PROMPT_DIR_COLOR='1;34'
```

Comment 16 Jens Petersen 2023-11-13 03:59:50 UTC
(In reply to Jens Petersen from comment #15)
> ```
> PROMPT_START='['
> PROMPT_END=']'
> PROMPT_SEPARATOR=' '
> PROMPT_DIRECTORY='\W'
> PROMPT_COLOR='1;32'
> PROMPT_DIR_COLOR='1;34'
> ```

or just: $ prompt_traditional '1;32' '1;34'

Comment 17 Thomas M Steenholdt 2023-11-13 10:47:06 UTC
That's pretty cool, and very useful for me. :-)

Comment 18 Fedora Update System 2023-11-14 01:44:07 UTC
FEDORA-2023-3e862eb724 has been pushed to the Fedora 39 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 19 Fedora Update System 2023-11-14 04:20:34 UTC
FEDORA-2023-2345dc7e62 has been submitted as an update to Fedora 39. https://bodhi.fedoraproject.org/updates/FEDORA-2023-2345dc7e62

Comment 20 Fedora Update System 2023-11-15 04:06:46 UTC
FEDORA-2023-2345dc7e62 has been pushed to the Fedora 39 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2023-2345dc7e62`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2023-2345dc7e62

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 21 Fedora Update System 2023-11-20 00:50:57 UTC
FEDORA-2023-79d91fcab0 has been pushed to the Fedora 37 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 22 Fedora Update System 2023-11-20 01:29:32 UTC
FEDORA-2023-fb9fbe1bed has been pushed to the Fedora 38 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 23 Fedora Update System 2023-11-20 02:22:22 UTC
FEDORA-EPEL-2023-dc012e88bc has been pushed to the Fedora EPEL 9 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 24 Fedora Update System 2023-11-21 02:48:50 UTC
FEDORA-2023-2345dc7e62 has been pushed to the Fedora 39 stable repository.
If problem still persists, please make note of it in this bug report.