Compare commits

..

5 Commits

Author SHA1 Message Date
Andrew Titmuss
3b713ca92f WM Theme: update for Mojave 2019-03-12 17:32:43 +11:00
Dylan Araps
c690118884 general: Added --no_config to disable config file creation. 2019-03-11 22:18:33 +02:00
Dylan Araps
3546ec347c Merge branch 'master' of github.com:dylanaraps/neofetch 2019-03-11 15:10:38 +02:00
Dylan Araps
625fdcf7c4 packages: Show IRIX package manager name 2019-03-11 14:20:07 +02:00
Muhammad Herdiansyah
288a81a9e2 ASCII: Update Artix logo 2019-02-26 08:25:29 +07:00

113
neofetch
View File

@@ -812,26 +812,27 @@ EOF
# DETECT INFORMATION # DETECT INFORMATION
get_os() { get_os() {
# $kernel_name is the output of 'uname -s'. # $kernel_name is set in a function called cache_uname and is
case $kernel_name in # just the output of "uname -s".
Darwin): "$darwin_name" ;; case "$kernel_name" in
SunOS): Solaris ;; "Darwin"): "$darwin_name" ;;
Haiku): Haiku ;; "SunOS"): "Solaris" ;;
MINIX): MINIX ;; "Haiku"): "Haiku" ;;
AIX): AIX ;; "MINIX"): "MINIX" ;;
IRIX*): IRIX ;; "AIX"): "AIX" ;;
FreeMiNT): FreeMiNT ;; "IRIX"*): "IRIX" ;;
"FreeMiNT"): "FreeMiNT" ;;
Linux|GNU*) "Linux" | "GNU"*)
: Linux : "Linux"
;; ;;
*BSD|DragonFly|Bitrig) *"BSD" | "DragonFly" | "Bitrig")
: BSD : "BSD"
;; ;;
CYGWIN*|MSYS*|MINGW*) "CYGWIN"* | "MSYS"* | "MINGW"*)
: Windows : "Windows"
;; ;;
*) *)
@@ -840,7 +841,6 @@ get_os() {
exit 1 exit 1
;; ;;
esac esac
os="$_" os="$_"
} }
@@ -1393,6 +1393,7 @@ get_packages() {
;; ;;
"IRIX") "IRIX")
manager="swpkg"
tot versions -b && ((packages-=3)) tot versions -b && ((packages-=3))
;; ;;
esac esac
@@ -1752,15 +1753,23 @@ 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 AppleAquaColorVariant" "$global_preferences")" wm_theme_color="$(PlistBuddy -c "Print AppleAccentColor" "$global_preferences")"
[[ -z "$wm_theme" ]] && \ [[ -z "$wm_theme" ]] && \
wm_theme="Light" wm_theme="Light"
[[ -z "$wm_theme_color" ]] || ((wm_theme_color == 1)) && \ case "$wm_theme_color" in
wm_theme_color="Blue" "-1") wm_theme_color="Graphite" ;;
"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:-Graphite} ($wm_theme)" wm_theme="${wm_theme_color} ($wm_theme)"
;; ;;
*"Explorer") *"Explorer")
@@ -4066,8 +4075,6 @@ 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"
@@ -4082,10 +4089,11 @@ 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)"
else elif [[ -z "$no_config" ]]; then
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
} }
@@ -4459,6 +4467,7 @@ 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
@@ -4478,7 +4487,7 @@ exit 1
get_args() { get_args() {
# Check the commandline flags early for '--config'. # Check the commandline flags early for '--config'.
[[ "$*" != *--config* ]] && get_user_config [[ "$*" != *--config* && "$*" != *--no_config* ]] && get_user_config
while [[ "$1" ]]; do while [[ "$1" ]]; do
case "$1" in case "$1" in
@@ -4639,6 +4648,7 @@ 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 ;;
@@ -5199,22 +5209,26 @@ 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} '
.cc' 'o'
.cccc. 'ooo'
cccccc. 'ooxoo'
:ccccccc. 'ooxxxoo'
;ccccccccc 'oookkxxoo'
.;cccccc: 'oiioxkkxxoo'
.. .;cccc; ':;:iiiioxxxoo'
'cccc;.. .,cc; `'.;::ioxxoo'
'ccccccccc:'. '' '-. `':;jiooo'
.cccccccccccccc:;. 'oooio-.. `'i:io'
.cccccccccccccc:,. . 'ooooxxxxoio:,. `'-;'
ccccccccccc;'. .;cc. 'ooooxxxxxkkxoooIi:-. `'
cccccccc,.. ':cccccc. 'ooooxxxxxkkkkxoiiiiiji'
:ccc:'. .';ccccc 'ooooxxxxxkxxoiiii:'` .i'
;;.. .';: 'ooooxxxxxoi:::'` .;ioxo'
'ooooxooi::'` .:iiixkxxo'
'ooooi:'` `'';ioxxo'
'i:'` '':io'
'` `'
EOF EOF
;; ;;
@@ -8815,9 +8829,10 @@ EOF
;; ;;
esac esac
# Overwrite distro colors if '$ascii_colors' doesn't equal 'distro'. # Overwrite distro colors if '$ascii_colors' doesn't
if [[ ${ascii_colors[0]} != distro ]]; then # equal 'distro'.
color_text=off if [[ "${ascii_colors[0]}" != "distro" ]]; then
color_text="off"
set_colors "${ascii_colors[@]}" set_colors "${ascii_colors[@]}"
fi fi
} }
@@ -8831,14 +8846,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
@@ -8854,17 +8869,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
} }