motd fixes

This commit is contained in:
Brian Zalewski 2023-11-27 21:40:44 +00:00
parent 8a53a33c3f
commit f39ed01079
4 changed files with 94 additions and 73 deletions

View file

@ -359,6 +359,7 @@ softwareGroups:
- emoj - emoj
- fdupes - fdupes
- fig - fig
- figlet
- filebrowser - filebrowser
- fm - fm
- gitmoji-cli - gitmoji-cli
@ -380,6 +381,7 @@ softwareGroups:
- jqp - jqp
- just - just
- litecli - litecli
- lolcat
- marp - marp
- mods - mods
- mycli - mycli

View file

@ -202,84 +202,86 @@ generate_bar_disk() {
} }
print_banner() { print_banner() {
### Fancy banner
if [ ! -f "${XDG_CACHE_HOME:-$HOME/.cache}/hey-banner-printed" ]; then if [ ! -f "${XDG_CACHE_HOME:-$HOME/.cache}/hey-banner-printed" ]; then
if command -v lolcat >/dev/null && command -v figlet >/dev/null; then if command -v lolcat > /dev/null && command -v figlet > /dev/null; then
figlet "Hey" | lolcat -f figlet "Hey, wsg?" | lolcat -f
printf "\\n" printf "\\n"
elif command -v figlet >/dev/null; then mkdir -p "${XDG_CACHE_HOME:-$HOME/.cache}"
printf "\\n%s\\n" "$(figlet -t -f "$BANNER_FONTPATH" " Hey")" touch "${XDG_CACHE_HOME:-$HOME/.cache}/hey-banner-printed"
elif command -v figlet > /dev/null; then
figlet "Hey, wsg?"
printf "\\n" printf "\\n"
fi mkdir -p "${XDG_CACHE_HOME:-$HOME/.cache}"
mkdir -p "${XDG_CACHE_HOME:-$HOME/.cache}" touch "${XDG_CACHE_HOME:-$HOME/.cache}/hey-banner-printed"
touch "${XDG_CACHE_HOME:-$HOME/.cache}/hey-banner-printed"
else
if command -v neofetch > /dev/null; then
neofetch
fi fi
fi fi
printf "\\n" ### Information section
printf " \\033[1;37mHostname:\\033[0m %s\\n" "$(hostname)" if command -v neofetch > /dev/null; then
printf "\\n" neofetch
if [ -f /etc/os-release ]; then
. /etc/os-release
if [ "$ID" = "debian" ]; then
banner_distro_icon="$BANNER_DEBIAN_ICON"
banner_distro_color="$BANNER_DEBIAN_COLOR"
banner_distro_name="Debian"
banner_distro_version="$(cat /etc/debian_version)"
elif [ "$ID" = "fedora" ]; then
banner_distro_icon="$BANNER_FEDORA_ICON"
banner_distro_color="$BANNER_FEDORA_COLOR"
banner_distro_name="Fedora"
banner_distro_version="$VERSION_ID"
else
banner_distro_icon="$OS_ICON"
banner_distro_color="0"
if [ -n "$NAME" ]; then
banner_distro_name="$NAME"
elif [ -n "$PRETTY_NAME" ]; then
banner_distro_name="$PRETTY_NAME"
else
banner_distro_name="Linux"
fi
if [ -n "$VERSION" ]; then
banner_distro_version="$VERSION"
elif [ -n "$VERSION_ID" ]; then
banner_distro_version="$VERSION_ID"
elif [ -n "$BUILD_ID" ]; then
banner_distro_version="$BUILD_ID"
else
banner_distro_version="Version Unknown"
fi
fi
banner_distro_space="$(generate_space "$banner_distro_name" 13)"
if [ "$(hostname)" = 'dom0' ]; then
# Qubes dom0
banner_distro_space="$(generate_space "$NAME" 13)"
printf " \\033[%sm%s %s\\033[0m%s%s\\n" "$banner_distro_color" "" "$NAME" "$banner_distro_space" "$VERSION"
else
printf " \\033[%sm%s %s\\033[0m%s%s\\n" "$banner_distro_color" "$banner_distro_icon" "$banner_distro_name" "$banner_distro_space" "$banner_distro_version"
fi
printf " \\033[%sm%s Linux\\033[0m %s\\n" "$BANNER_KERNEL_COLOR" "$BANNER_KERNEL_ICON" "$(cut -d ' ' -f 3 </proc/version)"
printf " \\033[%sm%s Uptime\\033[0m %s\\n" "$BANNER_UPTIME_COLOR" "$BANNER_UPTIME_ICON" "$(uptime -p | cut -d ' ' -f 2-)"
else else
if [ -d '/Applications' ] && [ -d '/System' ]; then ## non-neofetch
printf " \\033[%sm%s OS \\033[0m %s\\n" "$UPDATES_ZERO_COLOR" "" "macOS $(sw_vers -productVersion) / Build $(sw_vers -buildVersion)" printf "\\n"
printf " \\033[%sm%s UUID \\033[0m %s\\n" "$PODMAN_RUNNING_COLOR" "" "$(ioreg -d2 -c IOPlatformExpertDevice | awk -F\" '/IOPlatformUUID/{print $(NF-1)}')" printf " \\033[1;37mHostname:\\033[0m %s\\n" "$(hostname)"
printf " \\033[%sm%s LAN IP \\033[0m %s\\n" "$BANNER_KERNEL_COLOR" "ﯱ" "$(ifconfig en0 2>/dev/null | grep 'inet ' | cut -d ' ' -f 2)" printf "\\n"
### Disabled because it causes slight delay due to server call for public IP if [ -f /etc/os-release ]; then
# if command -v timeout > /dev/null; then . /etc/os-release
# IP_ADDR_PUB="$(timeout 1 sh -c 'curl -sSL ifconfig.me')" if [ "$ID" = "debian" ]; then
# else banner_distro_icon="$BANNER_DEBIAN_ICON"
# IP_ADDR_PUB="$(sh -c 'curl -sSL ifconfig.me')" banner_distro_color="$BANNER_DEBIAN_COLOR"
# fi banner_distro_name="Debian"
# if [ -n "$IP_ADDR_PUB" ]; then banner_distro_version="$(cat /etc/debian_version)"
# printf " \\033[%sm%s Public IP\\033[0m %s\\n" "$UPDATES_SECURITY_COLOR" "" "$IP_ADDR_PUB" elif [ "$ID" = "fedora" ]; then
# fi banner_distro_icon="$BANNER_FEDORA_ICON"
banner_distro_color="$BANNER_FEDORA_COLOR"
banner_distro_name="Fedora"
banner_distro_version="$VERSION_ID"
else
banner_distro_icon="$OS_ICON"
banner_distro_color="0"
if [ -n "$NAME" ]; then
banner_distro_name="$NAME"
elif [ -n "$PRETTY_NAME" ]; then
banner_distro_name="$PRETTY_NAME"
else
banner_distro_name="Linux"
fi
if [ -n "$VERSION" ]; then
banner_distro_version="$VERSION"
elif [ -n "$VERSION_ID" ]; then
banner_distro_version="$VERSION_ID"
elif [ -n "$BUILD_ID" ]; then
banner_distro_version="$BUILD_ID"
else
banner_distro_version="Version Unknown"
fi
fi
banner_distro_space="$(generate_space "$banner_distro_name" 13)"
if [ "$(hostname)" = 'dom0' ]; then
# Qubes dom0
banner_distro_space="$(generate_space "$NAME" 13)"
printf " \\033[%sm%s %s\\033[0m%s%s\\n" "$banner_distro_color" "" "$NAME" "$banner_distro_space" "$VERSION"
else
printf " \\033[%sm%s %s\\033[0m%s%s\\n" "$banner_distro_color" "$banner_distro_icon" "$banner_distro_name" "$banner_distro_space" "$banner_distro_version"
fi
printf " \\033[%sm%s Linux\\033[0m %s\\n" "$BANNER_KERNEL_COLOR" "$BANNER_KERNEL_ICON" "$(cut -d ' ' -f 3 </proc/version)"
printf " \\033[%sm%s Uptime\\033[0m %s\\n" "$BANNER_UPTIME_COLOR" "$BANNER_UPTIME_ICON" "$(uptime -p | cut -d ' ' -f 2-)"
else
if [ -d '/Applications' ] && [ -d '/System' ]; then
printf " \\033[%sm%s OS \\033[0m %s\\n" "$UPDATES_ZERO_COLOR" "" "macOS $(sw_vers -productVersion) / Build $(sw_vers -buildVersion)"
printf " \\033[%sm%s UUID \\033[0m %s\\n" "$PODMAN_RUNNING_COLOR" "" "$(ioreg -d2 -c IOPlatformExpertDevice | awk -F\" '/IOPlatformUUID/{print $(NF-1)}')"
printf " \\033[%sm%s LAN IP \\033[0m %s\\n" "$BANNER_KERNEL_COLOR" "ﯱ" "$(ifconfig en0 2>/dev/null | grep 'inet ' | cut -d ' ' -f 2)"
### Disabled because it causes slight delay due to server call for public IP
# if command -v timeout > /dev/null; then
# IP_ADDR_PUB="$(timeout 1 sh -c 'curl -sSL ifconfig.me')"
# else
# IP_ADDR_PUB="$(sh -c 'curl -sSL ifconfig.me')"
# fi
# if [ -n "$IP_ADDR_PUB" ]; then
# printf " \\033[%sm%s Public IP\\033[0m %s\\n" "$UPDATES_SECURITY_COLOR" "" "$IP_ADDR_PUB"
# fi
fi
fi fi
fi fi
} }

View file

@ -125,7 +125,7 @@ fi
### McFly ### McFly
export MCFLY_PROMPT="" export MCFLY_PROMPT=""
if [ -d /Applications ] && [ -d /System ]; then if [ -d /Applications ] && [ -d /System ]; then
if [ "$(defaults read -g AppleInterfaceStyle)" != "Dark" ]; then if [ "$(defaults read -g AppleInterfaceStyle 2> /dev/null)" != "Dark" ]; then
export MCFLY_LIGHT=TRUE export MCFLY_LIGHT=TRUE
fi fi
fi fi

View file

@ -519,6 +519,23 @@ softwarePackages:
brew: ansifilter brew: ansifilter
choco: ansifilter choco: ansifilter
port: ansifilter port: ansifilter
figlet:
_bin: figlet
_github: https://github.com/cmatsuoka/figlet
_name: Figlet
apt: figlet
dnf: figlet
pacman: figlet
zypper: figlet
choco: figlet
brew: figlet
lolcat:
_bin: lolcat
_github: https://github.com/busyloop/lolcat
_name: lolcat
brew: lolcat
choco: lolcat
snap: lolcat
android-commandlinetools: android-commandlinetools:
_deps: _deps:
- java - java