Skip to content

ublue-fastfetch doesn't correctly show the shell other than bash #1139

@kriszentner

Description

@kriszentner

I sleuthed this from my Bluefin install. This is also the same as this reported issue: #365. The difference between that issue and this one is that I'm providing a fix to create an easy PR.

Basically, because the wrapper script at /usr/bin/ublue-fastfetch is run as a bash script and not the user's shell, fastfetch will still report bash as the shell. This is because, since there is a bash script being used as a wrapper, it's using bash to execute fastfetch. Fastfetch itself doesn't have a way to override what it sees the user's shell as. The fastfetch code looks at the shell that invoked it, and will use that as the shell. The fix for this is simple, just put exec in front of the fastfetch calls.

The full fixed script:

#!/usr/bin/bash

get_config() {
    FASTFETCH_CONFIG_FILE="${FASTFETCH_CONFIG_FILE:-/etc/ublue-os/fastfetch.json}"
    QUERY="$1"
    FALLBACK="$2"
    shift
    shift
    OUTPUT="$(jq -r "${QUERY}" "${FASTFETCH_CONFIG_FILE}" 2>/dev/null || echo "${FALLBACK}")"
    if [ "${OUTPUT}" == "null" ] ; then
        echo "${FALLBACK}"
        return
    fi
    echo "${OUTPUT}"
}

FASTFETCH_CONFIG="$(get_config '."fastfetch-config"' "/usr/share/ublue-os/fastfetch.jsonc")"
SHUFFLE_LOGO="$(get_config '."shuffle-logo"' "false")"
LOGO_DIRECTORY="$(get_config '."logo-directory"' "/usr/share/ublue-os/fastfetch")"

export DEFAULT_THEME # Gets passed to `ublue-bling-fastfetch`
DEFAULT_THEME="$(get_config '."default-theme"' "slate")"
if [ "$SHUFFLE_LOGO" == "true" ] ; then
  FETCH_LOGO="$(find "$LOGO_DIRECTORY" -type f | shuf -n 1)"
  exec fastfetch --logo "$FETCH_LOGO" --color "$(ublue-bling-fastfetch)" --config "${FASTFETCH_CONFIG}" "${@}"
else
  exec fastfetch --color "$(ublue-bling-fastfetch)" --config "${FASTFETCH_CONFIG}" "${@}"
fi

Below is the diff:

25c25
<   fastfetch --logo "$FETCH_LOGO" --color "$(ublue-bling-fastfetch)" --config "${FASTFETCH_CONFIG}" "${@}"
---
>   exec fastfetch --logo "$FETCH_LOGO" --color "$(ublue-bling-fastfetch)" --config "${FASTFETCH_CONFIG}" "${@}"
27c27
<   fastfetch --color "$(ublue-bling-fastfetch)" --config "${FASTFETCH_CONFIG}" "${@}"
---
>   exec fastfetch --color "$(ublue-bling-fastfetch)" --config "${FASTFETCH_CONFIG}" "${@}"
29,30d28
< 
< 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions