Update Bfetch Config

Signed-off-by: The-Repo-Club <wayne6324@gmail.com>
This commit is contained in:
The-Repo-Club 2021-12-31 09:14:47 +00:00
parent 79b6a96641
commit 841c11962f
No known key found for this signature in database
GPG Key ID: E30EC2FBFB05C44F

View File

@ -1,46 +1,48 @@
setterm -linewrap off
# See this wiki page for more info:
# https://github.com/The-Repo-Club/bfetch/wiki/Customizing-Info
print_info() {
info title
info underline
info "Uptime " uptime
info "Uptime " uptime
info " " hwinfo
info "Host " model
info "CPU " cpu
info "CPU Usage " cpu_usage
info "GPU " gpu
info "Memory " memory
info "Resolution " resolution
info "Disk " disk
info " " prinfo
info "Keyboard " keyboard
info "Mouse " mouse
info "Monitor " monitor
info "Audio " audio
info " " swinfo
info "Distro " distro
info "Init " init
info "Locale " locale # This only works on glibc systems.
info "Kernel " kernel
info "Packages " packages
info "Shell " shell
info "DE " de
info "WM " wm
info "WM Theme " wm_theme
info "Theme " theme
info "Icons " icons
info "Font " font
info "Terminal " term
info "Terminal Font " term_font
info " " bottom
prin "$(color 1)╔════════════════ $(color 2)Hardware Information $(color 1)════════════════╗"
info "Host " model
info "CPU " cpu
info "CPU Usage " cpu_usage
info "GPU " gpu
info "Memory " memory
info "Resolution " resolution
info "Disk " disk
prin "$(color 1)╠════════════════ $(color 2)Software Information $(color 1)════════════════╣"
info "Distro " distro
prin "Init " $init
info "Kernel " kernel
info "Packages " packages
info "Shell " shell
info "DE " de
info "WM " wm
info "WM Theme " wm_theme
info "Theme " theme
info "Icons " icons
info "Font " font
info "Terminal " term
info "Terminal Font " term_font
prin "$(color 1)╚══════════════════════════════════════════════════════╝"
# info "Network " network
# info "GPU Driver " gpu_driver # Linux/macOS only
# info "Battery " battery
# info "Song " song
# info "Local IP " local_ip
# info "Public IP " public_ip
# info "Users " users
# info "Locale " locale # This only works on glibc systems.
# info "Network " network
# info "GPU Driver " gpu_driver # Linux/macOS only
# info "Battery " battery
# info "Song " song
# info "Local IP " local_ip
# info "Public IP " public_ip
# info "Users " users
info cols
}
@ -565,14 +567,14 @@ underline_char="~"
# Example:
# separator="->": 'Shell-> bash'
# separator=" =": 'WM = dwm'
separator=" » "
separator="\a"
# Align Text
#
# Default: 'off'
# Values: 'left', 'right', 'off'
# Flag: --align_output
align_output="off"
align_output="right"
# Color Blocks
@ -872,14 +874,148 @@ background_color=
stdout="off"
# Custom functions
init() {
init=$(readlink /sbin/init)
init=${init##*/}
init=${init%%-*}
export init
}
main() {
init
#=== PRINT OUT ================================================================
# Name: init, hwinfo, swinfo, prinfo and bottom
# Description: Prints init, hwinfo, swinfo, prinfo and bottom to bfetch.
#==============================================================================
#
printf -v init "%b" "$(strings /sbin/init | awk 'match($0, /(upstart|systemd|sysvinit|runit)/) { print substr($0, RSTART, RLENGTH); exit; }')"
printf -v hwinfo "%b" "$(color 1)╔════════════════$(color 2) Hardware Information $(color 1)═════════════════╗"
printf -v swinfo "%b" "$(color 1)╠════════════════$(color 2) Software Information $(color 1)═════════════════╣"
printf -v prinfo "%b" "$(color 1)╠═══════════════$(color 2) Peripherals Information $(color 1)═══════════════╣"
printf -v bottom "%b" "$(color 1)╚═══════════════════════════════════════════════════════╝"
#=== FUNCTION =================================================================
# Name: get_keyboard
# Description: Prints keyboard info to bfetch.
#==============================================================================
get_keyboard () {
declare -A AArr
DataOut=
keyboard="Unknown"
if command -v hwinfo &> /dev/null; then
while IFS= read -r Line; do
if [[ $Line == *"Keyboard"* ]]; then
keyboard="${Line%,*}"
fi
done <<< $( hwinfo --short )
fi
IFS=' ' read -a Arr <<< $keyboard
for Val in "${Arr[@]}"; do
LCase=${Val,,}
[ -z "${AArr[$LCase]}" ] && AArr[$LCase]=$Val && DataOut=$DataOut' '$Val
done
keyboard="${DataOut:1}"
keyboard=${keyboard#"${keyboard%%[![:space:]]*}"}
if [ -n "$keyboard" ]; then
if [ ! "$keyboard" == "Unknown" ]; then
printf -v keyboard "%b" "$keyboard"
fi
fi
}
main
get_keyboard
#=== FUNCTION =================================================================
# Name: get_mouse
# Description: Prints mouse info to bfetch.
#==============================================================================
get_mouse () {
declare -A AArr
DataOut=
mouse="Unknown"
if command -v hwinfo &> /dev/null; then
while IFS= read -r Line; do
if [[ $Line == *"Mouse"* ]]; then
mouse="${Line%,*}"
fi
done <<< $( hwinfo --short )
fi
IFS=' ' read -a Arr <<< $mouse
for Val in "${Arr[@]}"; do
LCase=${Val,,}
[ -z "${AArr[$LCase]}" ] && AArr[$LCase]=$Val && DataOut=$DataOut' '$Val
done
mouse="${DataOut:1}"
mouse=${mouse#* }
mouse=${mouse#"${mouse%%[![:space:]]*}"}
if [ -n "$mouse" ]; then
if [ ! "$mouse" == "Unknown" ]; then
printf -v mouse "%b" "$mouse"
fi
fi
}
get_mouse
#=== FUNCTION =================================================================
# Name: get_monitor
# Description: Prints monitor info to bfetch.
#==============================================================================
get_monitor () {
declare -A AArr
DataOut=
monitor="Unknown"
if command -v hwinfo &> /dev/null; then
while IFS= read -r Line; do
if [[ ! $Line == "monitor"* ]]; then
monitor="${Line%,*}"
fi
done <<< $( hwinfo --short --monitor )
fi
IFS=' ' read -a Arr <<< $monitor
for Val in "${Arr[@]}"; do
LCase=${Val,,}
[ -z "${AArr[$LCase]}" ] && AArr[$LCase]=$Val && DataOut=$DataOut' '$Val
done
monitor="${DataOut:1}"
monitor=${monitor#"${monitor%%[![:space:]]*}"}
if [ -n "$monitor" ]; then
if [ ! "$monitor" == "Unknown" ]; then
printf -v monitor "%b" "$monitor"
fi
fi
}
get_monitor
#=== FUNCTION =================================================================
# Name: get_audio
# Description: Prints audio info to bfetch.
#==============================================================================
get_audio () {
declare -A AArr
DataOut=
audio="Unknown"
if command -v pactl &> /dev/null; then
while IFS= read -r Line; do
if [[ $Line == *"Server Name"* ]]; then
IFS=':' read Type Server <<< "$Line";
audio="${Server%,*}"
fi
done <<< $( pactl info )
fi
IFS=' ' read -a Arr <<< $audio
for Val in "${Arr[@]}"; do
LCase=${Val,,}
[ -z "${AArr[$LCase]}" ] && AArr[$LCase]=$Val && DataOut=$DataOut' '$Val
done
audio="${DataOut:1}"
audio=${audio#"${audio%%[![:space:]]*}"}
if [ -n "$audio" ]; then
if [ ! "$audio" == "Unknown" ]; then
printf -v audio "%b" "$audio"
fi
fi
}
get_audio