Merge branch 'master' of https://github.com/dylanaraps/neofetch
This commit is contained in:
commit
4fe0dcd63e
2 changed files with 117 additions and 98 deletions
10
CHANGELOG.md
10
CHANGELOG.md
|
@ -51,11 +51,6 @@
|
||||||
- Fixed images not appearing in st.
|
- Fixed images not appearing in st.
|
||||||
- Added `to_ascii()` and `to_off()`.
|
- Added `to_ascii()` and `to_off()`.
|
||||||
- These functions are used when falling back to different image modes.
|
- These functions are used when falling back to different image modes.
|
||||||
- Renamed `$image_backend` to `$image_program`.
|
|
||||||
- Renamed `$image` to `$image_backend`.
|
|
||||||
- Renamed `$padding` to `$text_padding`.
|
|
||||||
- Renamed `$imgname` to `$img_name`.
|
|
||||||
- Renamed `$img` to `$image`.
|
|
||||||
- Renamed `check_old_flags()` to `old_flags()` to match `old_functions()`.
|
- Renamed `check_old_flags()` to `old_flags()` to match `old_functions()`.
|
||||||
- Split `get_image()` into `get_term_size()`, `get_image_size()`, `get_image_program()` and `make_thumbnail()`.
|
- Split `get_image()` into `get_term_size()`, `get_image_size()`, `get_image_program()` and `make_thumbnail()`.
|
||||||
|
|
||||||
|
@ -94,3 +89,8 @@
|
||||||
**Shell**<br \>
|
**Shell**<br \>
|
||||||
|
|
||||||
- [bash] Simplify bash version.
|
- [bash] Simplify bash version.
|
||||||
|
|
||||||
|
**Song**<br \>
|
||||||
|
|
||||||
|
- Added support for GNOME Music. **[@konimex](https://github.com/konimex)**
|
||||||
|
- Added support for Lollypop. **[@konimex](https://github.com/konimex)**
|
||||||
|
|
205
neofetch
205
neofetch
|
@ -175,8 +175,7 @@ get_distro() {
|
||||||
[[ -z "${distro// }" ]] && distro="$(awk '/BLAG/ {print $1; exit}' /etc/*ease /usr/lib/*ease)"
|
[[ -z "${distro// }" ]] && distro="$(awk '/BLAG/ {print $1; exit}' /etc/*ease /usr/lib/*ease)"
|
||||||
[[ -z "${distro// }" ]] && distro="$(awk -F'=' '{print $2; exit}' /etc/*ease /usr/lib/*ease)"
|
[[ -z "${distro// }" ]] && distro="$(awk -F'=' '{print $2; exit}' /etc/*ease /usr/lib/*ease)"
|
||||||
fi
|
fi
|
||||||
distro="${distro//\"}"
|
distro="$(trim_quotes "$distro")"
|
||||||
distro="${distro//\'}"
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"Mac OS X")
|
"Mac OS X")
|
||||||
|
@ -535,9 +534,8 @@ get_wm() {
|
||||||
wm="${wm/\"*}"
|
wm="${wm/\"*}"
|
||||||
|
|
||||||
# Fallback for Wayland wms
|
# Fallback for Wayland wms
|
||||||
case "$wm" in
|
[[ "$wm" == "xwlc" ]] && \
|
||||||
"xwlc") wm="$(ps -e | grep -m 1 -o -F -e "sway" -e "orbment" -e "velox" -e "orbital")" ;;
|
wm="$(ps -e | grep -m 1 -o -F -e "sway" -e "orbment" -e "velox" -e "orbital")"
|
||||||
esac
|
|
||||||
|
|
||||||
else
|
else
|
||||||
case "$os" in
|
case "$os" in
|
||||||
|
@ -666,8 +664,8 @@ get_wm_theme() {
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
wm_theme="${wm_theme//\'}"
|
wm_theme="$(trim_quotes "$wm_theme")"
|
||||||
(("$bash_version" >= 4)) && wm_theme="${wm_theme^}"
|
wm_theme="$(uppercase "$wm_theme")"
|
||||||
}
|
}
|
||||||
|
|
||||||
get_cpu() {
|
get_cpu() {
|
||||||
|
@ -987,7 +985,7 @@ get_gpu() {
|
||||||
"FreeBSD"* | "DragonFlyBSD"* | "PacBSD"*)
|
"FreeBSD"* | "DragonFlyBSD"* | "PacBSD"*)
|
||||||
gpu="$(pciconf -lv | grep -B 4 -F "VGA" | grep -F "device")"
|
gpu="$(pciconf -lv | grep -B 4 -F "VGA" | grep -F "device")"
|
||||||
gpu="${gpu/*device*= }"
|
gpu="${gpu/*device*= }"
|
||||||
gpu="${gpu//\'}"
|
gpu="$(trim_quotes "$gpu")"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
|
@ -1082,7 +1080,7 @@ get_memory() {
|
||||||
|
|
||||||
get_song() {
|
get_song() {
|
||||||
# This is absurdly long.
|
# This is absurdly long.
|
||||||
player="$(ps x | awk '!(/awk|Helper|Cache/) && /mpd|cmus|mocp|spotify|Google Play|iTunes.app|rhythmbox|banshee|amarok|deadbeef|audacious/ {printf $5 " " $6; exit}')"
|
player="$(ps x | awk '!(/awk|Helper|Cache/) && /mpd|cmus|mocp|spotify|Google Play|iTunes.app|rhythmbox|banshee|amarok|deadbeef|audacious|gnome-music|lollypop/ {printf $5 " " $6; exit}')"
|
||||||
|
|
||||||
case "${player/*\/}" in
|
case "${player/*\/}" in
|
||||||
"mpd"*)
|
"mpd"*)
|
||||||
|
@ -1142,7 +1140,7 @@ get_song() {
|
||||||
state="$(dbus-send --print-reply --dest=org.mpris.MediaPlayer2.rhythmbox /org/mpris/MediaPlayer2 \
|
state="$(dbus-send --print-reply --dest=org.mpris.MediaPlayer2.rhythmbox /org/mpris/MediaPlayer2 \
|
||||||
org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string: 'PlayBackStatus' |\
|
org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string: 'PlayBackStatus' |\
|
||||||
awk -F 'string "' '{printf $2}')"
|
awk -F 'string "' '{printf $2}')"
|
||||||
state="${state//\"}"
|
state="$(trim_quotes "$state")"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"banshee"*)
|
"banshee"*)
|
||||||
|
@ -1166,6 +1164,28 @@ get_song() {
|
||||||
song="$(audtool current-song)"
|
song="$(audtool current-song)"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
"gnome-music"*)
|
||||||
|
# Hello dbus my old friend.
|
||||||
|
song="$(\
|
||||||
|
dbus-send --print-reply --dest=org.mpris.MediaPlayer2.GnomeMusic /org/mpris/MediaPlayer2 \
|
||||||
|
org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata' |\
|
||||||
|
awk -F 'string "' '/string|array/ {printf "%s",$2; next}{print ""}' |\
|
||||||
|
awk -F '"' '/artist|title/ {printf $2 " - "}'
|
||||||
|
)"
|
||||||
|
song="${song% - }"
|
||||||
|
;;
|
||||||
|
|
||||||
|
"lollypop"*)
|
||||||
|
# Hello dbus my old friend.
|
||||||
|
song="$(\
|
||||||
|
dbus-send --print-reply --dest=org.mpris.MediaPlayer2.Lollypop /org/mpris/MediaPlayer2 \
|
||||||
|
org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata' |\
|
||||||
|
awk -F 'string "' '/string|array/ {printf "%s",$2; next}{print ""}' |\
|
||||||
|
awk -F '"' '/artist|title/ {printf $2 " - "}'
|
||||||
|
)"
|
||||||
|
song="${song% - }"
|
||||||
|
;;
|
||||||
|
|
||||||
*) song="Not Playing" ;;
|
*) song="Not Playing" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
@ -1256,38 +1276,13 @@ get_resolution() {
|
||||||
get_style() {
|
get_style() {
|
||||||
# Fix weird output when the function
|
# Fix weird output when the function
|
||||||
# is run multiple times.
|
# is run multiple times.
|
||||||
unset gtk2theme gtk3theme theme path
|
unset gtk2_theme gtk3_theme theme path
|
||||||
|
|
||||||
case "$1" in
|
|
||||||
"theme")
|
|
||||||
name="gtk-theme-name"
|
|
||||||
gsettings="gtk-theme"
|
|
||||||
gconf="gtk_theme"
|
|
||||||
xfconf="/Net/ThemeName"
|
|
||||||
kde="widgetStyle"
|
|
||||||
;;
|
|
||||||
|
|
||||||
"icons")
|
|
||||||
name="gtk-icon-theme-name"
|
|
||||||
gsettings="icon-theme"
|
|
||||||
gconf="icon_theme"
|
|
||||||
xfconf="/Net/IconThemeName"
|
|
||||||
kde="Theme"
|
|
||||||
;;
|
|
||||||
|
|
||||||
"font")
|
|
||||||
name="gtk-font-name"
|
|
||||||
gsettings="font-name"
|
|
||||||
gconf="font_theme"
|
|
||||||
xfconf="/Gtk/FontName"
|
|
||||||
kde="font"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [[ -n "$DISPLAY" && "$os" != "Mac OS X" ]]; then
|
if [[ -n "$DISPLAY" && "$os" != "Mac OS X" ]]; then
|
||||||
# Get DE if user has disabled the function.
|
# Get DE if user has disabled the function.
|
||||||
[[ -z "$de" ]] && get_de
|
[[ -z "$de" ]] && get_de
|
||||||
|
|
||||||
|
# Check for DE Theme.
|
||||||
case "$de" in
|
case "$de" in
|
||||||
"KDE"*)
|
"KDE"*)
|
||||||
kde_config_dir
|
kde_config_dir
|
||||||
|
@ -1297,7 +1292,7 @@ get_style() {
|
||||||
|
|
||||||
theme="$(grep "^[^#]*$kde" "$kde_config_file")"
|
theme="$(grep "^[^#]*$kde" "$kde_config_file")"
|
||||||
theme="${theme/${kde}*=}"
|
theme="${theme/${kde}*=}"
|
||||||
(("$bash_version" >= 4)) && theme="${theme^}"
|
theme="$(uppercase "$theme")"
|
||||||
|
|
||||||
gtk_shorthand="on"
|
gtk_shorthand="on"
|
||||||
return
|
return
|
||||||
|
@ -1306,121 +1301,135 @@ get_style() {
|
||||||
|
|
||||||
*"Cinnamon")
|
*"Cinnamon")
|
||||||
if type -p gsettings >/dev/null; then
|
if type -p gsettings >/dev/null; then
|
||||||
gtk3theme="$(gsettings get org.cinnamon.desktop.interface "$gsettings")"
|
gtk3_theme="$(gsettings get org.cinnamon.desktop.interface "$gsettings")"
|
||||||
gtk2theme="${gtk3theme}"
|
gtk2_theme="$gtk3_theme"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"Gnome"* | "Unity"* | "Budgie"*)
|
"Gnome"* | "Unity"* | "Budgie"*)
|
||||||
if type -p gsettings >/dev/null; then
|
if type -p gsettings >/dev/null; then
|
||||||
gtk3theme="$(gsettings get org.gnome.desktop.interface "$gsettings")"
|
gtk3_theme="$(gsettings get org.gnome.desktop.interface "$gsettings")"
|
||||||
gtk2theme="${gtk3theme}"
|
gtk2_theme="$gtk3_theme"
|
||||||
|
|
||||||
elif type -p gconftool-2 >/dev/null; then
|
elif type -p gconftool-2 >/dev/null; then
|
||||||
gtk2theme="$(gconftool-2 -g /desktop/gnome/interface/"$gconf")"
|
gtk2_theme="$(gconftool-2 -g /desktop/gnome/interface/"$gconf")"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"Mate"*)
|
"Mate"*)
|
||||||
gtk3theme="$(gsettings get org.mate.interface "$gsettings")"
|
gtk3_theme="$(gsettings get org.mate.interface "$gsettings")"
|
||||||
gtk2theme="${gtk3theme}"
|
gtk2_theme="$gtk3_theme"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"Xfce"*)
|
"Xfce"*)
|
||||||
type -p xfconf-query >/dev/null && \
|
type -p xfconf-query >/dev/null && \
|
||||||
gtk2theme="$(xfconf-query -c xsettings -p "$xfconf")"
|
gtk2_theme="$(xfconf-query -c xsettings -p "$xfconf")"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Check for gtk2 theme
|
# Check for general GTK2 Theme
|
||||||
if [[ -z "$gtk2theme" ]]; then
|
if [[ -z "$gtk2_theme" ]]; then
|
||||||
if [[ -f "${GTK2_RC_FILES:-$HOME/.gtkrc-2.0}" ]]; then
|
if [[ -f "${GTK2_RC_FILES:-$HOME/.gtkrc-2.0}" ]]; then
|
||||||
gtk2theme="$(grep "^[^#]*$name" "${GTK2_RC_FILES:-$HOME/.gtkrc-2.0}")"
|
gtk2_theme="$(grep "^[^#]*${name}" "${GTK2_RC_FILES:-$HOME/.gtkrc-2.0}")"
|
||||||
|
|
||||||
elif [[ -f "/usr/share/gtk-2.0/gtkrc" ]]; then
|
elif [[ -f "/usr/share/gtk-2.0/gtkrc" ]]; then
|
||||||
gtk2theme="$(grep "^[^#]*$name" /usr/share/gtk-2.0/gtkrc)"
|
gtk2_theme="$(grep "^[^#]*${name}" /usr/share/gtk-2.0/gtkrc)"
|
||||||
|
|
||||||
elif [[ -f "/etc/gtk-2.0/gtkrc" ]]; then
|
elif [[ -f "/etc/gtk-2.0/gtkrc" ]]; then
|
||||||
gtk2theme="$(grep "^[^#]*$name" /etc/gtk-2.0/gtkrc)"
|
gtk2_theme="$(grep "^[^#]*${name}" /etc/gtk-2.0/gtkrc)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
gtk2theme="${gtk2theme/${name}*=}"
|
gtk2_theme="${gtk2_theme/${name}*=}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check for gtk3 theme
|
# Check for general GTK3 Theme
|
||||||
if [[ -z "$gtk3theme" ]]; then
|
if [[ -z "$gtk3_theme" ]]; then
|
||||||
if [[ -f "$XDG_CONFIG_HOME/gtk-3.0/settings.ini" ]]; then
|
if [[ -f "$XDG_CONFIG_HOME/gtk-3.0/settings.ini" ]]; then
|
||||||
gtk3theme="$(grep "^[^#]*$name" "$XDG_CONFIG_HOME/gtk-3.0/settings.ini")"
|
gtk3_theme="$(grep "^[^#]*$name" "$XDG_CONFIG_HOME/gtk-3.0/settings.ini")"
|
||||||
|
|
||||||
elif type -p gsettings >/dev/null; then
|
elif type -p gsettings >/dev/null; then
|
||||||
gtk3theme="$(gsettings get org.gnome.desktop.interface "$gsettings")"
|
gtk3_theme="$(gsettings get org.gnome.desktop.interface "$gsettings")"
|
||||||
|
|
||||||
elif [[ -f "/usr/share/gtk-3.0/settings.ini" ]]; then
|
elif [[ -f "/usr/share/gtk-3.0/settings.ini" ]]; then
|
||||||
gtk3theme="$(grep "^[^#]*$name" /usr/share/gtk-3.0/settings.ini)"
|
gtk3_theme="$(grep "^[^#]*$name" /usr/share/gtk-3.0/settings.ini)"
|
||||||
|
|
||||||
elif [[ -f "/etc/gtk-3.0/settings.ini" ]]; then
|
elif [[ -f "/etc/gtk-3.0/settings.ini" ]]; then
|
||||||
gtk3theme="$(grep "^[^#]*$name" /etc/gtk-3.0/settings.ini)"
|
gtk3_theme="$(grep "^[^#]*$name" /etc/gtk-3.0/settings.ini)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
gtk3theme="${gtk3theme/${name}*=}"
|
gtk3_theme="${gtk3_theme/${name}*=}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Remove quotes
|
|
||||||
gtk2theme=${gtk2theme//\"}
|
|
||||||
gtk2theme=${gtk2theme//\'}
|
|
||||||
gtk3theme=${gtk3theme//\"}
|
|
||||||
gtk3theme=${gtk3theme//\'}
|
|
||||||
|
|
||||||
# Uppercase the first letter of each gtk theme
|
|
||||||
if (("$bash_version" >= 4)); then
|
|
||||||
gtk2theme="${gtk2theme^}"
|
|
||||||
gtk3theme="${gtk3theme^}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Toggle visibility of gtk themes.
|
|
||||||
[[ "$gtk2" == "off" ]] && unset gtk2theme
|
|
||||||
[[ "$gtk3" == "off" ]] && unset gtk3theme
|
|
||||||
|
|
||||||
# Trim whitespace
|
# Trim whitespace
|
||||||
gtk2theme="$(trim "$gtk2theme")"
|
gtk2_theme="$(trim "$gtk2_theme")"
|
||||||
gtk3theme="$(trim "$gtk3theme")"
|
gtk3_theme="$(trim "$gtk3_theme")"
|
||||||
|
|
||||||
|
# Remove quotes
|
||||||
|
gtk2_theme="$(trim_quotes "$gtk2_theme")"
|
||||||
|
gtk3_theme="$(trim_quotes "$gtk3_theme")"
|
||||||
|
|
||||||
|
# Uppercase the first letter of each gtk theme
|
||||||
|
gtk2_theme="$(uppercase "$gtk2_theme")"
|
||||||
|
gtk3_theme="$(uppercase "$gtk3_theme")"
|
||||||
|
|
||||||
|
# Toggle visibility of gtk themes.
|
||||||
|
[[ "$gtk2" == "off" ]] && unset gtk2_theme
|
||||||
|
[[ "$gtk3" == "off" ]] && unset gtk3_theme
|
||||||
|
|
||||||
# Format the string based on which themes exist
|
# Format the string based on which themes exist
|
||||||
if [[ "$gtk2theme" && "$gtk2theme" == "$gtk3theme" ]]; then
|
if [[ "$gtk2_theme" && "$gtk2_theme" == "$gtk3_theme" ]]; then
|
||||||
gtk3theme+=" [GTK2/3]"
|
gtk3_theme+=" [GTK2/3]"
|
||||||
unset gtk2theme
|
unset gtk2_theme
|
||||||
|
|
||||||
|
elif [[ "$gtk2_theme" && "$gtk3_theme" ]]; then
|
||||||
|
gtk2_theme+=" [GTK2], "
|
||||||
|
gtk3_theme+=" [GTK3] "
|
||||||
|
|
||||||
elif [[ "$gtk2theme" && "$gtk3theme" ]]; then
|
|
||||||
gtk2theme+=" [GTK2], "
|
|
||||||
gtk3theme+=" [GTK3] "
|
|
||||||
else
|
else
|
||||||
[[ "$gtk2theme" ]] && gtk2theme+=" [GTK2] "
|
[[ "$gtk2_theme" ]] && gtk2_theme+=" [GTK2] "
|
||||||
[[ "$gtk3theme" ]] && gtk3theme+=" [GTK3] "
|
[[ "$gtk3_theme" ]] && gtk3_theme+=" [GTK3] "
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Final string
|
# Final string
|
||||||
theme="${gtk2theme}${gtk3theme}"
|
theme="${gtk2_theme}${gtk3_theme}"
|
||||||
|
|
||||||
# Make the output shorter by removing "[GTKX]" from the string
|
# Make the output shorter by removing "[GTKX]" from the string
|
||||||
if [[ "$gtk_shorthand" == "on" ]]; then
|
if [[ "$gtk_shorthand" == "on" ]]; then
|
||||||
theme="${theme/ '[GTK2]'}"
|
theme="${theme// '[GTK'[0-9]']'}"
|
||||||
theme="${theme/ '[GTK3]'}"
|
|
||||||
theme="${theme/ '[GTK2/3]'}"
|
theme="${theme/ '[GTK2/3]'}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
get_theme() {
|
get_theme() {
|
||||||
get_style theme
|
name="gtk-theme-name"
|
||||||
|
gsettings="gtk-theme"
|
||||||
|
gconf="gtk_theme"
|
||||||
|
xfconf="/Net/ThemeName"
|
||||||
|
kde="widgetStyle"
|
||||||
|
|
||||||
|
get_style
|
||||||
}
|
}
|
||||||
|
|
||||||
get_icons() {
|
get_icons() {
|
||||||
get_style icons
|
name="gtk-icon-theme-name"
|
||||||
|
gsettings="icon-theme"
|
||||||
|
gconf="icon_theme"
|
||||||
|
xfconf="/Net/IconThemeName"
|
||||||
|
kde="Theme"
|
||||||
|
|
||||||
|
get_style
|
||||||
icons="$theme"
|
icons="$theme"
|
||||||
}
|
}
|
||||||
|
|
||||||
get_font() {
|
get_font() {
|
||||||
get_style font
|
name="gtk-font-name"
|
||||||
|
gsettings="font-name"
|
||||||
|
gconf="font_theme"
|
||||||
|
xfconf="/Gtk/FontName"
|
||||||
|
kde="font"
|
||||||
|
|
||||||
|
get_style
|
||||||
font="$theme"
|
font="$theme"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1516,7 +1525,7 @@ get_term_font() {
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
(("$bash_version" >= 4)) && term_font="${term_font^}"
|
term_font="$(uppercase "$term_font")"
|
||||||
}
|
}
|
||||||
|
|
||||||
get_disk() {
|
get_disk() {
|
||||||
|
@ -1983,7 +1992,7 @@ get_wallpaper() {
|
||||||
|
|
||||||
# Strip quotes etc from the path.
|
# Strip quotes etc from the path.
|
||||||
image="${image/'file://'}"
|
image="${image/'file://'}"
|
||||||
image="${image//\'}"
|
image="$(trim_quotes "$image")"
|
||||||
image="${image//\%20/ }"
|
image="${image//\%20/ }"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
@ -2411,6 +2420,16 @@ trim() {
|
||||||
set +f
|
set +f
|
||||||
}
|
}
|
||||||
|
|
||||||
|
trim_quotes() {
|
||||||
|
trim_output="${1//\'}"
|
||||||
|
trim_output="${trim_output//\"}"
|
||||||
|
printf "%s" "$trim_output"
|
||||||
|
}
|
||||||
|
|
||||||
|
uppercase() {
|
||||||
|
(("$bash_version" >= 4)) && printf "%s" "${1^}"
|
||||||
|
}
|
||||||
|
|
||||||
# COLORS
|
# COLORS
|
||||||
|
|
||||||
get_distro_colors() {
|
get_distro_colors() {
|
||||||
|
|
Loading…
Reference in a new issue