mirror of
https://github.com/dylanaraps/neofetch.git
synced 2025-10-04 01:00:17 +00:00
Compare commits
3 Commits
wm_theme-m
...
rewrites
Author | SHA1 | Date | |
---|---|---|---|
|
4217626cff | ||
|
ce91e2f39a | ||
|
cac22ec505 |
113
neofetch
113
neofetch
@@ -812,27 +812,26 @@ EOF
|
|||||||
# DETECT INFORMATION
|
# DETECT INFORMATION
|
||||||
|
|
||||||
get_os() {
|
get_os() {
|
||||||
# $kernel_name is set in a function called cache_uname and is
|
# $kernel_name is the output of 'uname -s'.
|
||||||
# just the output of "uname -s".
|
case $kernel_name in
|
||||||
case "$kernel_name" in
|
Darwin): "$darwin_name" ;;
|
||||||
"Darwin"): "$darwin_name" ;;
|
SunOS): Solaris ;;
|
||||||
"SunOS"): "Solaris" ;;
|
Haiku): Haiku ;;
|
||||||
"Haiku"): "Haiku" ;;
|
MINIX): MINIX ;;
|
||||||
"MINIX"): "MINIX" ;;
|
AIX): AIX ;;
|
||||||
"AIX"): "AIX" ;;
|
IRIX*): IRIX ;;
|
||||||
"IRIX"*): "IRIX" ;;
|
FreeMiNT): FreeMiNT ;;
|
||||||
"FreeMiNT"): "FreeMiNT" ;;
|
|
||||||
|
|
||||||
"Linux" | "GNU"*)
|
Linux|GNU*)
|
||||||
: "Linux"
|
: Linux
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*"BSD" | "DragonFly" | "Bitrig")
|
*BSD|DragonFly|Bitrig)
|
||||||
: "BSD"
|
: BSD
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"CYGWIN"* | "MSYS"* | "MINGW"*)
|
CYGWIN*|MSYS*|MINGW*)
|
||||||
: "Windows"
|
: Windows
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
@@ -841,6 +840,7 @@ get_os() {
|
|||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
os="$_"
|
os="$_"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1393,7 +1393,6 @@ get_packages() {
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
"IRIX")
|
"IRIX")
|
||||||
manager="swpkg"
|
|
||||||
tot versions -b && ((packages-=3))
|
tot versions -b && ((packages-=3))
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@@ -1753,23 +1752,15 @@ get_wm_theme() {
|
|||||||
"Quartz Compositor")
|
"Quartz Compositor")
|
||||||
global_preferences="${HOME}/Library/Preferences/.GlobalPreferences.plist"
|
global_preferences="${HOME}/Library/Preferences/.GlobalPreferences.plist"
|
||||||
wm_theme="$(PlistBuddy -c "Print AppleInterfaceStyle" "$global_preferences")"
|
wm_theme="$(PlistBuddy -c "Print AppleInterfaceStyle" "$global_preferences")"
|
||||||
wm_theme_color="$(PlistBuddy -c "Print AppleAccentColor" "$global_preferences")"
|
wm_theme_color="$(PlistBuddy -c "Print AppleAquaColorVariant" "$global_preferences")"
|
||||||
|
|
||||||
[[ -z "$wm_theme" ]] && \
|
[[ -z "$wm_theme" ]] && \
|
||||||
wm_theme="Light"
|
wm_theme="Light"
|
||||||
|
|
||||||
case "$wm_theme_color" in
|
[[ -z "$wm_theme_color" ]] || ((wm_theme_color == 1)) && \
|
||||||
"-1") wm_theme_color="Graphite" ;;
|
wm_theme_color="Blue"
|
||||||
"0") wm_theme_color="Red" ;;
|
|
||||||
"1") wm_theme_color="Orange" ;;
|
|
||||||
"2") wm_theme_color="Yellow" ;;
|
|
||||||
"3") wm_theme_color="Green" ;;
|
|
||||||
"5") wm_theme_color="Purple" ;;
|
|
||||||
"6") wm_theme_color="Pink" ;;
|
|
||||||
*) wm_theme_color="Blue" ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
wm_theme="${wm_theme_color} ($wm_theme)"
|
wm_theme="${wm_theme_color:-Graphite} ($wm_theme)"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*"Explorer")
|
*"Explorer")
|
||||||
@@ -4075,6 +4066,8 @@ get_full_path() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get_user_config() {
|
get_user_config() {
|
||||||
|
mkdir -p "${XDG_CONFIG_HOME}/neofetch/"
|
||||||
|
|
||||||
# --config /path/to/config.conf
|
# --config /path/to/config.conf
|
||||||
if [[ -f "$config_file" ]]; then
|
if [[ -f "$config_file" ]]; then
|
||||||
source "$config_file"
|
source "$config_file"
|
||||||
@@ -4089,11 +4082,10 @@ get_user_config() {
|
|||||||
source "${XDG_CONFIG_HOME}/neofetch/config"
|
source "${XDG_CONFIG_HOME}/neofetch/config"
|
||||||
err "Config: Sourced user config. (${XDG_CONFIG_HOME}/neofetch/config)"
|
err "Config: Sourced user config. (${XDG_CONFIG_HOME}/neofetch/config)"
|
||||||
|
|
||||||
elif [[ -z "$no_config" ]]; then
|
else
|
||||||
config_file="${XDG_CONFIG_HOME}/neofetch/config.conf"
|
config_file="${XDG_CONFIG_HOME}/neofetch/config.conf"
|
||||||
|
|
||||||
# The config file doesn't exist, create it.
|
# The config file doesn't exist, create it.
|
||||||
mkdir -p "${XDG_CONFIG_HOME}/neofetch/"
|
|
||||||
printf '%s\n' "$config" > "$config_file"
|
printf '%s\n' "$config" > "$config_file"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -4467,7 +4459,6 @@ IMAGE:
|
|||||||
OTHER:
|
OTHER:
|
||||||
--config /path/to/config Specify a path to a custom config file
|
--config /path/to/config Specify a path to a custom config file
|
||||||
--config none Launch the script without a config file
|
--config none Launch the script without a config file
|
||||||
--no_config Don't create the user config file.
|
|
||||||
--print_config Print the default config file to stdout.
|
--print_config Print the default config file to stdout.
|
||||||
--stdout Turn off all colors and disables any ASCII/image backend.
|
--stdout Turn off all colors and disables any ASCII/image backend.
|
||||||
--help Print this text and exit
|
--help Print this text and exit
|
||||||
@@ -4487,7 +4478,7 @@ exit 1
|
|||||||
|
|
||||||
get_args() {
|
get_args() {
|
||||||
# Check the commandline flags early for '--config'.
|
# Check the commandline flags early for '--config'.
|
||||||
[[ "$*" != *--config* && "$*" != *--no_config* ]] && get_user_config
|
[[ "$*" != *--config* ]] && get_user_config
|
||||||
|
|
||||||
while [[ "$1" ]]; do
|
while [[ "$1" ]]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
@@ -4648,7 +4639,6 @@ get_args() {
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
"--no_config") no_config="on" ;;
|
|
||||||
"--stdout") stdout="on" ;;
|
"--stdout") stdout="on" ;;
|
||||||
"-v") verbose="on" ;;
|
"-v") verbose="on" ;;
|
||||||
"--print_config") printf '%s\n' "$config"; exit ;;
|
"--print_config") printf '%s\n' "$config"; exit ;;
|
||||||
@@ -5209,26 +5199,22 @@ EOF
|
|||||||
"Artix"*)
|
"Artix"*)
|
||||||
set_colors 6 6 7 1
|
set_colors 6 6 7 1
|
||||||
read -rd '' ascii_data <<'EOF'
|
read -rd '' ascii_data <<'EOF'
|
||||||
${c1} '
|
${c1} .'
|
||||||
'o'
|
.cc'
|
||||||
'ooo'
|
.cccc.
|
||||||
'ooxoo'
|
cccccc.
|
||||||
'ooxxxoo'
|
:ccccccc.
|
||||||
'oookkxxoo'
|
;ccccccccc
|
||||||
'oiioxkkxxoo'
|
.;cccccc:
|
||||||
':;:iiiioxxxoo'
|
.. .;cccc;
|
||||||
`'.;::ioxxoo'
|
'cccc;.. .,cc;
|
||||||
'-. `':;jiooo'
|
'ccccccccc:'. ''
|
||||||
'oooio-.. `'i:io'
|
.cccccccccccccc:;.
|
||||||
'ooooxxxxoio:,. `'-;'
|
.cccccccccccccc:,. .
|
||||||
'ooooxxxxxkkxoooIi:-. `'
|
ccccccccccc;'. .;cc.
|
||||||
'ooooxxxxxkkkkxoiiiiiji'
|
cccccccc,.. ':cccccc.
|
||||||
'ooooxxxxxkxxoiiii:'` .i'
|
:ccc:'. .';ccccc
|
||||||
'ooooxxxxxoi:::'` .;ioxo'
|
;;.. .';:
|
||||||
'ooooxooi::'` .:iiixkxxo'
|
|
||||||
'ooooi:'` `'';ioxxo'
|
|
||||||
'i:'` '':io'
|
|
||||||
'` `'
|
|
||||||
EOF
|
EOF
|
||||||
;;
|
;;
|
||||||
|
|
||||||
@@ -8829,10 +8815,9 @@ EOF
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Overwrite distro colors if '$ascii_colors' doesn't
|
# Overwrite distro colors if '$ascii_colors' doesn't equal 'distro'.
|
||||||
# equal 'distro'.
|
if [[ ${ascii_colors[0]} != distro ]]; then
|
||||||
if [[ "${ascii_colors[0]}" != "distro" ]]; then
|
color_text=off
|
||||||
color_text="off"
|
|
||||||
set_colors "${ascii_colors[@]}"
|
set_colors "${ascii_colors[@]}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -8846,14 +8831,14 @@ main() {
|
|||||||
|
|
||||||
get_args "$@"
|
get_args "$@"
|
||||||
get_simple "$@"
|
get_simple "$@"
|
||||||
[[ "$verbose" != "on" ]] && exec 2>/dev/null
|
[[ $verbose != on ]] && exec 2>/dev/null
|
||||||
get_distro
|
get_distro
|
||||||
get_bold
|
get_bold
|
||||||
get_distro_ascii
|
get_distro_ascii
|
||||||
[[ "$stdout" == "on" ]] && stdout
|
[[ $stdout == on ]] && stdout
|
||||||
|
|
||||||
# Minix doesn't support these sequences.
|
# Minix doesn't support these sequences.
|
||||||
if [[ "$TERM" != "minix" && "$stdout" != "on" ]]; then
|
if [[ $TERM != minix && $stdout != on ]]; then
|
||||||
# If the script exits for any reason, unhide the cursor.
|
# If the script exits for any reason, unhide the cursor.
|
||||||
trap 'printf "\e[?25h\e[?7h"' EXIT
|
trap 'printf "\e[?25h\e[?7h"' EXIT
|
||||||
|
|
||||||
@@ -8869,17 +8854,17 @@ main() {
|
|||||||
|
|
||||||
# w3m-img: Draw the image a second time to fix
|
# w3m-img: Draw the image a second time to fix
|
||||||
# rendering issues in specific terminal emulators.
|
# rendering issues in specific terminal emulators.
|
||||||
[[ "$image_backend" == *w3m* ]] && display_image
|
[[ $image_backend == *w3m* ]] && display_image
|
||||||
|
|
||||||
# Add neofetch info to verbose output.
|
# Add neofetch info to verbose output.
|
||||||
err "Neofetch command: $0 $*"
|
err "Neofetch command: $0 $*"
|
||||||
err "Neofetch version: $version"
|
err "Neofetch version: $version"
|
||||||
|
|
||||||
# Show error messages.
|
# Show error messages.
|
||||||
[[ "$verbose" == "on" ]] && printf "%b" "$err" >&2
|
[[ $verbose == on ]] && printf '%b' "$err" >&2
|
||||||
|
|
||||||
# If `--loop` was used, constantly redraw the image.
|
# If `--loop` was used, constantly redraw the image.
|
||||||
while [[ "$image_loop" == "on" && "$image_backend" == "w3m" ]]; do display_image; sleep 1; done
|
while [[ $image_loop == on && $image_backend == w3m ]]; do display_image; sleep 1; done
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user