Merge master

This commit is contained in:
Dylan Araps 2016-10-27 08:09:08 +11:00
commit e8e859b590
8 changed files with 360 additions and 443 deletions

View file

@ -3,6 +3,7 @@
- **[@konimex](https://github.com/konimex)** - **[@konimex](https://github.com/konimex)**
- **[@iandrewt](https://github.com/iandrewt)** - **[@iandrewt](https://github.com/iandrewt)**
- **[@coypoop](https://github.com/coypoop)** - **[@coypoop](https://github.com/coypoop)**
- **[@ncmprhnsbl](https://github.com/ncmprhnsbl)**
<br \> <br \>
@ -12,12 +13,14 @@
- Change all `OS X` references to `macOS`. **[@iandrewt](https://github.com/iandrewt)** - Change all `OS X` references to `macOS`. **[@iandrewt](https://github.com/iandrewt)**
- Fix corrupted text when long lines are cut-off. - Fix corrupted text when long lines are cut-off.
- Don't dynamically place prompt in `image=off` mode. - Don't dynamically place prompt in `image=off` mode.
- Cursor Position: Fix issues when using URxvt+Padding
## Operating System ## Operating System
- Added support for Bitrig. **[@konimex](https://github.com/konimex)** - Added support for Bitrig. **[@konimex](https://github.com/konimex)**
- Added support for Sparky Linux. - Added support for Sparky Linux.
- Added support for Porteus. **[@ncmprhnsbl](https://github.com/ncmprhnsbl)**
## Packages ## Packages
@ -65,6 +68,7 @@ Note: `\033[14t` is still supported, if images already work for you then you don
- Bold ascii art by default. - Bold ascii art by default.
- Fixed incorrect prompt location when using `ascii_logo_size small`. - Fixed incorrect prompt location when using `ascii_logo_size small`.
- Update Void Linux ascii art. **[@ncmprhnsbl](https://github.com/ncmprhnsbl)**
## Info ## Info
@ -74,6 +78,12 @@ Note: `\033[14t` is still supported, if images already work for you then you don
- Expanded `distro_shorthand` to macOS and Solaris. **[@konimex](https://github.com/konimex)** - Expanded `distro_shorthand` to macOS and Solaris. **[@konimex](https://github.com/konimex)**
- Removed `osx_buildversion` and `osx_codename` in favour of `distro_shorthand`. **[@konimex](https://github.com/konimex)** - Removed `osx_buildversion` and `osx_codename` in favour of `distro_shorthand`. **[@konimex](https://github.com/konimex)**
**Desktop Environment**<br \>
- [Windows] Added support for showing DE.
- Windows 8 and above: `Modern UI/Metro`
- Windows 7 and below: `Aero`
**Window Manager**<br \> **Window Manager**<br \>
- [Windows] Added support for custom WMs/Shells. - [Windows] Added support for custom WMs/Shells.
@ -86,10 +96,21 @@ Note: `\033[14t` is still supported, if images already work for you then you don
**CPU**<br \> **CPU**<br \>
- Added `cpu_speed` which lets you hide/show the speed in the output.
- Expanded `cpu_cores` option by adding two new values, `logical` and `physical`. - Expanded `cpu_cores` option by adding two new values, `logical` and `physical`.
- `logical`: Show all virtual cores (hyperthreaded). - `logical`: Show all virtual cores (hyperthreaded).
- `physical`: Only show physical cores. - `physical`: Only show physical cores.
- [Linux] Added support for showing CPU temperature.
- Added new option called `cpu_temp`.
- Note: This is disabled by default and can be enabled by changing the value of `cpu_temp` in your config to `on`.
- [macOS] Print physical cores instead of hyper-threaded cores. **[@iandrewt](https://github.com/iandrewt)** - [macOS] Print physical cores instead of hyper-threaded cores. **[@iandrewt](https://github.com/iandrewt)**
- [iOS] Rewrite CPU function.
**GPU**
- [iOS] Rewrite GPU function.
- [Linux] Rewrite GPU function.
- Neofetch also caches the info until reboot.
**Uptime**<br \> **Uptime**<br \>
@ -102,6 +123,7 @@ Note: `\033[14t` is still supported, if images already work for you then you don
**Memory**<br \> **Memory**<br \>
- [Linux] Correctly calculate used memory.
- [NetBSD] Fix memory output for sizes over 4GB. **[@coypoop](https://github.com/coypoop)** - [NetBSD] Fix memory output for sizes over 4GB. **[@coypoop](https://github.com/coypoop)**
**Shell**<br \> **Shell**<br \>
@ -109,6 +131,12 @@ Note: `\033[14t` is still supported, if images already work for you then you don
- Hide shell path by default. - Hide shell path by default.
- Show shell version by default. - Show shell version by default.
**Battery**<br \>
- [Linux] Rewrote and simplified battery function.
- Removed `battery_shorthand`
- Removed `battery_num`
**Theme Font**<br \> **Theme Font**<br \>
- [XFCE] Fixed incorrect font output. - [XFCE] Fixed incorrect font output.
@ -128,3 +156,5 @@ Note: `\033[14t` is still supported, if images already work for you then you don
**Song**<br \> **Song**<br \>
- [macOS] Fix iTunes automatically opening. **[@iandrewt](https://github.com/iandrewt)** - [macOS] Fix iTunes automatically opening. **[@iandrewt](https://github.com/iandrewt)**
- Added support for Audacious. **[@ncmprhnsbl](https://github.com/ncmprhnsbl)**
- Rewrote song function, it's now much faster/cleaner.

View file

@ -434,22 +434,22 @@ alias neofetch2="neofetch \
--cpu_cores type Whether or not to display the number of CPU cores --cpu_cores type Whether or not to display the number of CPU cores
Takes: logical, physical, off Takes: logical, physical, off
Note: 'physical' doesn't work on BSD. Note: 'physical' doesn't work on BSD.
--cpu_speed on/off Hide/Show cpu speed.
--cpu_temp on/off Hide/Show cpu temperature.
NOTE This only works on linux.
--distro_shorthand on/off Shorten the output of distro (tiny, on, off) --distro_shorthand on/off Shorten the output of distro (tiny, on, off)
NOTE: This is only possible on Linux, macOS, and Solaris NOTE: This is only possible on Linux, macOS, and Solaris
--kernel_shorthand on/off Shorten the output of kernel --kernel_shorthand on/off Shorten the output of kernel
--uptime_shorthand on/off Shorten the output of uptime (tiny, on, off) --uptime_shorthand on/off Shorten the output of uptime (tiny, on, off)
--refresh_rate on/off Whether to display the refresh rate of each monitor --refresh_rate on/off Whether to display the refresh rate of each monitor
Unsupported on Windows Unsupported on Windows
--gpu_shorthand on/off Shorten the output of GPU (tiny, on, off)
--gpu_brand on/off Enable/Disable GPU brand in output. (AMD/NVIDIA/Intel) --gpu_brand on/off Enable/Disable GPU brand in output. (AMD/NVIDIA/Intel)
--gtk_shorthand on/off Shorten output of gtk theme/icons --gtk_shorthand on/off Shorten output of gtk theme/icons
--gtk2 on/off Enable/Disable gtk2 theme/icons output --gtk2 on/off Enable/Disable gtk2 theme/icons output
--gtk3 on/off Enable/Disable gtk3 theme/icons output --gtk3 on/off Enable/Disable gtk3 theme/icons output
--shell_path on/off Enable/Disable showing \$SHELL path --shell_path on/off Enable/Disable showing \$SHELL path
--shell_version on/off Enable/Disable showing \$SHELL version --shell_version on/off Enable/Disable showing \$SHELL version
--battery_num num Which battery to display, default value is 'all' --ip_host url Url to query for public IP
--battery_shorthand on/off Whether or not each battery gets its own line/title
--ip_host url Url to ping for public IP
--song_shorthand on/off Print the Artist/Title on seperate lines --song_shorthand on/off Print the Artist/Title on seperate lines
--birthday_shorthand on/off Shorten the output of birthday --birthday_shorthand on/off Shorten the output of birthday
--birthday_time on/off Enable/Disable showing the time in birthday output --birthday_time on/off Enable/Disable showing the time in birthday output

25
ascii/distro/porteus Normal file
View file

@ -0,0 +1,25 @@
"\
${c1} \`.-:::-.\`
-+ydmNNNNNNNmdy+-
.+dNmdhs+//////+shdmdo.
.smmy+-\` ./sdy:
\`omdo. \`.-/+osssso+/-\` \`+dy.
\`yms. \`:shmNmdhsoo++osyyo-\`\`oh.
hm/ .odNmds/.\` \`\`.....:::-+s
/m: \`+dNmy:\` \`./oyhhhhyyooo++so
ys \`yNmy- .+hmmho:-.\` \`\`\`
s: yNm+\` .smNd+.
\`\` /Nm: +dNd+\`
yN+ \`smNy.
dm oNNy\`
hy -mNm.
+y oNNo
\`y\` sNN:
\`: +NN:
\` .mNo
/mm\`
/my\`
.sy\`
.+:
\`
"

View file

@ -6,11 +6,11 @@ ${c1} __.;=====;.__
_vi, \` --+=++++: _vi, \` --+=++++:
.uvnvi. _._ -==+==+. .uvnvi. _._ -==+==+.
.vvnvnI\` .;==|==;. :|=||=|. .vvnvnI\` .;==|==;. :|=||=|.
${c2}+QmQQmpvvnv; ${c2}_yYsyQQWUUQQQm #QmQ#${c1}:${c2}QQQWUV\$QQmL ${c2}+QmQQm${c1}pvvnv; ${c2}_yYsyQQWUUQQQm #QmQ#${c1}:${c2}QQQWUV\$QQmL
${c2} -QQWQWpvvo${c2}wZ?.wQQQE${c1}==<${c2}QWWQ/QWQW.QQWW${c1}(: ${c2}jQWQE ${c2} -QQWQW${c1}pvvo${c2}wZ?.wQQQE${c1}==<${c2}QWWQ/QWQW.QQWW${c1}(: ${c2}jQWQE
${c2} -\$QQQQmmU' jQQQ@${c1}+=<${c2}QWQQ)mQQQ.mQQQC${c1}+;${c2}jWQQ@' ${c2} -\$QQQQmmU' jQQQ@${c1}+=<${c2}QWQQ)mQQQ.mQQQC${c1}+;${c2}jWQQ@'
${c2} -\$WQ8YnI: ${c2}QWQQwgQQWV${c1}\`${c2}mWQQ.jQWQQgyyWW@! ${c2} -\$WQ8Y${c1}nI: ${c2}QWQQwgQQWV${c1}\`${c2}mWQQ.jQWQQgyyWW@!
-1vvnvv. ${c1}\`~+++\` ++|+++ ${c1} -1vvnvv. \`~+++\` ++|+++
+vnvnnv, \`-|=== +vnvnnv, \`-|===
+vnvnvns. . :=- +vnvnvns. . :=-
-Invnvvnsi..___..=sv=. \` -Invnvvnsi..___..=sv=. \`
@ -18,3 +18,4 @@ ${c2} -\$WQ8YnI: ${c2}QWQQwgQQWV${c1}\`${c2}mWQQ.jQWQQgyyWW@!
~|Invnvnvvnvvvnnv}+\` ~|Invnvnvvnvvvnnv}+\`
-~\|{*l}*|\\~ -~\|{*l}*|\\~
" "

View file

@ -14,7 +14,7 @@ export LANG=C
# Info # Info
# See this wiki page for more info: # See this wiki page for more info:
# https://github.com/dylanaraps/neofetch/wiki/Customizing-Info # https://github.com/dylanaraps/neofetch/wiki/Customizing-Info
printinfo () { printinfo() {
info title info title
info underline info underline
@ -55,7 +55,7 @@ printinfo () {
# Kernel # Kernel
# Show more kernel info # Show more kernel info
# --kernel_shorthand on/off # --kernel_shorthand on, off
kernel_shorthand="on" kernel_shorthand="on"
@ -66,7 +66,7 @@ kernel_shorthand="on"
distro_shorthand="off" distro_shorthand="off"
# Show 'x86_64' and 'x86' in 'Distro:' output. # Show 'x86_64' and 'x86' in 'Distro:' output.
# --os_arch on/off # --os_arch on, off
os_arch="on" os_arch="on"
@ -80,11 +80,11 @@ uptime_shorthand="off"
# Shell # Shell
# Show the path to $SHELL # Show the path to $SHELL
# --shell_path on/off # --shell_path on, off
shell_path="off" shell_path="off"
# Show $SHELL's version # Show $SHELL's version
# --shell_version on/off # --shell_version on, off
shell_version="on" shell_version="on"
@ -106,6 +106,11 @@ cpu_shorthand="off"
# --cpu_display bar, infobar, barinfo, off # --cpu_display bar, infobar, barinfo, off
cpu_display="off" cpu_display="off"
# CPU Speed
# Hide/Show CPU speed.
# --cpu_speed on, off
cpu_speed="on"
# CPU Cores # CPU Cores
# Display CPU cores in output # Display CPU cores in output
# Logical: All virtual cores # Logical: All virtual cores
@ -114,56 +119,44 @@ cpu_display="off"
# Note: 'physical' doesn't work on BSD. # Note: 'physical' doesn't work on BSD.
cpu_cores="logical" cpu_cores="logical"
# CPU Temperature
# Hide/Show CPU temperature.
# --cpu_temp on, off
# Note: Only works on Linux.
cpu_temp="off"
# GPU # GPU
# Shorten output of the getgpu funcion
# --gpu_shorthand on/off/tiny
gpu_shorthand="on"
# Enable/Disable GPU Brand # Enable/Disable GPU Brand
# --gpu_brand on/off # --gpu_brand on, off
gpu_brand="on" gpu_brand="on"
# Resolution # Resolution
# Display refresh rate next to each monitor # Display refresh rate next to each monitor
# Unsupported on Windows # Unsupported on Windows
# --refresh_rate on/off # --refresh_rate on, off
refresh_rate="off" refresh_rate="off"
# Gtk Theme / Icons # Gtk Theme / Icons
# Shorten output (Hide [GTK2] etc) # Shorten output (Hide [GTK2] etc)
# --gtk_shorthand on/off # --gtk_shorthand on, off
gtk_shorthand="off" gtk_shorthand="off"
# Enable/Disable gtk2 theme/icons output # Enable/Disable gtk2 theme/icons output
# --gtk2 on/off # --gtk2 on, off
gtk2="on" gtk2="on"
# Enable/Disable gtk3 theme/icons output # Enable/Disable gtk3 theme/icons output
# --gtk3 on/off # --gtk3 on, off
gtk3="on" gtk3="on"
# Battery
# Which battery to display.
# By default we display all batteries.
# NOTE: Only works on Linux.
# --battery_num all, 0, 1, 2, etc
battery_num="all"
# Whether or not to print each battery on the same line.
# By default each battery gets its own line and title.
# NOTE: Only works on Linux.
# --battery_shorthand on/off
battery_shorthand="off"
# IP Address # IP Address
# Website to ping for the public IP # Website to ping for the public IP
@ -174,7 +167,7 @@ public_ip_host="http://ident.me"
# Song # Song
# Print the Artist and Title on seperate lines # Print the Artist and Title on seperate lines
# --song_shorthand on/off # --song_shorthand on, off
song_shorthand="off" song_shorthand="off"
@ -183,11 +176,11 @@ song_shorthand="off"
# Whether to show a long pretty output # Whether to show a long pretty output
# or a shortened one # or a shortened one
# NOTE: Long pretty output doesn't work on OpenBSD or NetBSD. # NOTE: Long pretty output doesn't work on OpenBSD or NetBSD.
# --birthday_shorthand on/off # --birthday_shorthand on, off
birthday_shorthand="off" birthday_shorthand="off"
# Whether to show the time in the output # Whether to show the time in the output
# --birthday_time on/off # --birthday_time on, off
birthday_time="on" birthday_time="on"
# Date format to use when printing birthday # Date format to use when printing birthday
@ -216,11 +209,11 @@ colors=(distro)
# Toggle bold text # Toggle bold text
# --bold on/off # --bold on, off
bold="on" bold="on"
# Enable/Disable Underline # Enable/Disable Underline
# --underline on/off # --underline on, off
underline_enabled="on" underline_enabled="on"
# Underline character # Underline character
@ -239,7 +232,7 @@ start=0
end=7 end=7
# Toggle color blocks # Toggle color blocks
# --color_blocks on/off # --color_blocks on, off
color_blocks="on" color_blocks="on"
# Color block width in spaces # Color block width in spaces
@ -262,7 +255,7 @@ progress_char_elapsed="-"
progress_char_total="=" progress_char_total="="
# Progress border # Progress border
# --progress_border on/off # --progress_border on, off
progress_border="on" progress_border="on"
# Progress bar length in spaces # Progress bar length in spaces
@ -283,9 +276,9 @@ progress_color_total="distro"
# barinfo: The bar is displayed before the info. # barinfo: The bar is displayed before the info.
# off: Only the info is displayed. # off: Only the info is displayed.
# #
# --memory_display bar/infobar/barinfo/off # --memory_display bar, infobar, barinfo, off
# --battery_display bar/infobar/barinfo/off # --battery_display bar, infobar, barinfo, off
# --disk_display bar/infobar/barinfo/off # --disk_display bar, infobar, barinfo, off
memory_display="off" memory_display="off"
battery_display="off" battery_display="off"
disk_display="off" disk_display="off"
@ -308,19 +301,14 @@ thumbnail_dir="$HOME/.cache/thumbnails/neofetch"
# Some systems have this in another location # Some systems have this in another location
w3m_img_path="/usr/lib/w3m/w3mimgdisplay" w3m_img_path="/usr/lib/w3m/w3mimgdisplay"
# Image position
# Only works with the w3m backend.
# --image_position left/right
image_position="left"
# Crop mode # Crop mode
# --crop_mode normal/fit/fill # --crop_mode normal, fit, fill
crop_mode="normal" crop_mode="normal"
# Crop offset # Crop offset
# Only affects normal mode. # Only affects normal mode.
# --crop_offset northwest/north/northeast/west/center # --crop_offset northwest, north, northeast, west, center
# east/southwest/south/southeast # east, southwest, south, southeast
crop_offset="center" crop_offset="center"
# Image size # Image size
@ -380,7 +368,7 @@ ascii_logo_size="normal"
# Bold ascii logo # Bold ascii logo
# Whether or not to bold the ascii logo. # Whether or not to bold the ascii logo.
# --ascii_bold on/off # --ascii_bold on, off
ascii_bold="on" ascii_bold="on"

516
neofetch
View file

@ -46,7 +46,8 @@ getmodel() {
elif [ -f /sys/devices/virtual/dmi/id/product_name ] ||\ elif [ -f /sys/devices/virtual/dmi/id/product_name ] ||\
[ -f /sys/devices/virtual/dmi/id/product_version ]; then [ -f /sys/devices/virtual/dmi/id/product_version ]; then
model="$(cat /sys/devices/virtual/dmi/id/product_{name,version} 2>/dev/null)" model="$(< /sys/devices/virtual/dmi/id/product_name)"
model+=" $(< /sys/devices/virtual/dmi/id/product_version)"
model="${model/To Be Filled*}" model="${model/To Be Filled*}"
elif [ -f /sys/firmware/devicetree/base/model ]; then elif [ -f /sys/firmware/devicetree/base/model ]; then
@ -133,10 +134,11 @@ getdistro() {
elif type -p lsb_release >/dev/null 2>&1; then elif type -p lsb_release >/dev/null 2>&1; then
case "$distro_shorthand" in case "$distro_shorthand" in
"on") distro="$(lsb_release -sir 2>/dev/null)" ;; "on") lsb_flags="-sir" ;;
"tiny") distro="$(lsb_release -si 2>/dev/null)" ;; "tiny") lsb_flags="-si" ;;
*) distro="$(lsb_release -sd 2>/dev/null)" ;; *) lsb_flags="-sd" ;;
esac esac
distro="$(lsb_release $lsb_flags 2>/dev/null)"
elif type -p guix >/dev/null 2>&1; then elif type -p guix >/dev/null 2>&1; then
distro="GuixSD" distro="GuixSD"
@ -239,6 +241,7 @@ getdistro() {
"on" | "tiny") distro="$(awk 'NR==1{print $1 " " $2;}' /etc/release)" ;; "on" | "tiny") distro="$(awk 'NR==1{print $1 " " $2;}' /etc/release)" ;;
*) distro="$(awk 'NR==1{print $1 " " $2 " " $3;}' /etc/release)" ;; *) distro="$(awk 'NR==1{print $1 " " $2 " " $3;}' /etc/release)" ;;
esac esac
distro="${distro/\(*}"
;; ;;
esac esac
@ -349,7 +352,7 @@ getuptime() {
getpackages() { getpackages() {
case "$os" in case "$os" in
"Linux" | "iPhone OS") "Linux" | "iPhone OS" | "Solaris")
type -p pacman >/dev/null 2>&1 && \ type -p pacman >/dev/null 2>&1 && \
packages="$(pacman -Qq --color never | wc -l)" packages="$(pacman -Qq --color never | wc -l)"
@ -371,8 +374,10 @@ getpackages() {
type -p pisi >/dev/null 2>&1 && \ type -p pisi >/dev/null 2>&1 && \
packages="$((packages+=$(pisi list-installed | wc -l)))" packages="$((packages+=$(pisi list-installed | wc -l)))"
type -p pkg >/dev/null 2>&1 && \ if type -p pkg >/dev/null 2>&1; then
packages="$((packages+=$(ls -1 /var/db/pkg | wc -l)))" packages="$((packages+=$(ls -1 /var/db/pkg | wc -l)))"
[ "$packages" == "0" ] && packages="$((packages+=$(pkg list | wc -l)))"
fi
type -p emerge >/dev/null 2>&1 && \ type -p emerge >/dev/null 2>&1 && \
packages="$((packages+=$(ls -d /var/db/pkg/*/* | wc -l)))" packages="$((packages+=$(ls -d /var/db/pkg/*/* | wc -l)))"
@ -432,10 +437,6 @@ getpackages() {
[ -d "/cygdrive/c/ProgramData/chocolatey/lib" ] && \ [ -d "/cygdrive/c/ProgramData/chocolatey/lib" ] && \
packages="$((packages+=$(ls -1 /cygdrive/c/ProgramData/chocolatey/lib | wc -l)))" packages="$((packages+=$(ls -1 /cygdrive/c/ProgramData/chocolatey/lib | wc -l)))"
;; ;;
"Solaris")
packages="$(pkg list | wc -l)"
;;
esac esac
[ "$packages" == "0" ] && unset packages [ "$packages" == "0" ] && unset packages
@ -489,6 +490,13 @@ getshell() {
getde() { getde() {
case "$os" in case "$os" in
"Mac OS X") de="Aqua" ;; "Mac OS X") de="Aqua" ;;
"Windows")
case "$distro" in
"Windows 8"* | "Windows 10"*) de="Modern UI/Metro" ;;
*) de="Aero" ;;
esac
;;
*) *)
de="${XDG_CURRENT_DESKTOP/i3}" de="${XDG_CURRENT_DESKTOP/i3}"
de="${de/'X-'}" de="${de/'X-'}"
@ -531,12 +539,7 @@ getwm() {
"Windows") "Windows")
wm="$(tasklist | grep -m 1 -o "bugn\|Windawesome\|blackbox\|emerge\|litestep")" wm="$(tasklist | grep -m 1 -o "bugn\|Windawesome\|blackbox\|emerge\|litestep")"
[ "$wm" == "blackbox" ] && wm="bbLean (Blackbox)" [ "$wm" == "blackbox" ] && wm="bbLean (Blackbox)"
wm="${wm:+$wm, }Explorer"
if [ "$wm" ]; then
wm="$wm, Explorer"
else
wm="Explorer"
fi
;; ;;
esac esac
fi fi
@ -690,10 +693,11 @@ getcpu() {
"Android"*) cpu="$(getprop ro.product.board)" ;; "Android"*) cpu="$(getprop ro.product.board)" ;;
*) cpu="$(awk -F ': | @' '/model name|Processor/ {printf $2; exit}' /proc/cpuinfo)" ;; *) cpu="$(awk -F ': | @' '/model name|Processor/ {printf $2; exit}' /proc/cpuinfo)" ;;
esac esac
cpu_dir="/sys/devices/system/cpu/cpu0/cpufreq" speed_dir="/sys/devices/system/cpu/cpu0/cpufreq"
temp_dir="/sys/class/hwmon/hwmon0/temp1_input"
# Get cpu speed # Get cpu speed
if [ -d "$cpu_dir" ]; then if [ -d "$speed_dir" ]; then
case "$speed_type" in case "$speed_type" in
current) speed_type="scaling_cur_freq" ;; current) speed_type="scaling_cur_freq" ;;
min) speed_type="scaling_min_freq" ;; min) speed_type="scaling_min_freq" ;;
@ -705,8 +709,8 @@ getcpu() {
esac esac
# Fallback to cpuinfo_max_freq if $speed_type fails # Fallback to cpuinfo_max_freq if $speed_type fails
read -t 1 -r speed < "${cpu_dir}/${speed_type}" || \ speed="$(< "${speed_dir}/${speed_type}")" || \
read -t 1 -r speed < "${cpu_dir}/cpuinfo_max_freq" speed="$(< "${speed_dir}/cpuinfo_max_freq")"
speed="$((speed / 100000))" speed="$((speed / 100000))"
else else
@ -714,6 +718,13 @@ getcpu() {
speed="$((speed / 100))" speed="$((speed / 100))"
fi fi
# Get cpu temp
if [ "$cpu_temp" == "on" ] && [ -f "$temp_dir" ]; then
temp="$(< "$temp_dir")"
temp="$((temp * 100 / 10000))"
temp="[${temp/${temp: -1}}.${temp: -1}°C]"
fi
# Show/hide hyperthreaded cores # Show/hide hyperthreaded cores
case "$cpu_cores" in case "$cpu_cores" in
"logical" | "on") cores="$(grep -c ^processor /proc/cpuinfo)" ;; "logical" | "on") cores="$(grep -c ^processor /proc/cpuinfo)" ;;
@ -727,7 +738,7 @@ getcpu() {
speed="${speed:0:1}.${speed:1}" speed="${speed:0:1}.${speed:1}"
fi fi
cpu="$cpu @ ${speed}GHz" cpu="$cpu @ ${speed}GHz $temp"
;; ;;
"Mac OS X") "Mac OS X")
@ -742,110 +753,27 @@ getcpu() {
"iPhone OS") "iPhone OS")
case "${ios_model:-$(uname -m)}" in case "${ios_model:-$(uname -m)}" in
"iPhone1,1" | "iPhone1,2" | "iPod1,1") "iPhone1,"[1-2] | "iPod1,1") cpu="Samsung S5L8900 (1) @ 412MHz" ;;
cpu="Samsung S5L8900 @ 412MHz" "iPhone2,1") cpu="Samsung S5PC100 (1) @ 600MHz" ;;
cores="1" "iPhone3,"[1-3] | "iPod4,1") cpu="Apple A4 (1) @ 800MHz" ;;
;; "iPhone4,1" | "iPod5,1") cpu="Apple A5 (2) @ 800MHz" ;;
"iPhone5,"[1-4]) cpu="Apple A6 (2) @ 1.3GHz" ;;
"iPhone2,1") "iPhone6,"[1-2]) cpu="Apple A7 (2) @ 1.3GHz" ;;
cpu="Samsung S5PC100 @ 600MHz" "iPhone7,"[1-2]) cpu="Apple A8 (2) @ 1.4GHz" ;;
cores="1" "iPhone8,"[1-4]) cpu="Apple A9 (2) @ 1.85GHz" ;;
;; "iPod2,1") cpu="Samsung S5L8720 (1) @ 533MHz" ;;
"iPod3,1") cpu="Samsung S5L8922 (1) @ 600MHz" ;;
"iPhone3,1" | "iPhone3,2" | "iPhone3,3" | "iPod4,1") "iPod7,1") cpu="Apple A8 (2) @ 1.1GHz" ;;
cpu="Apple A4 @ 800MHz" "iPad1,1") cpu="Apple A4 (1) @ 1GHz" ;;
cores="1" "iPad2,"[1-7]) cpu="Apple A5 (2) @ 1GHz" ;;
;; "iPad3,"[1-3]) cpu="Apple A5X (2) @ 1GHz" ;;
"iPad3,"[4-6]) cpu="Apple A6X (2) @ 1.4GHz" ;;
"iPhone4,1" | "iPod5,1") "iPad4,"[1-3]) cpu="Apple A7 (2) @ 1.4GHz" ;;
cpu="Apple A5 @ 800MHz" "iPad4,"[4-9]) cpu="Apple A7 (2) @ 1.4GHz" ;;
cores="2" "iPad5,"[1-2]) cpu="Apple A8 (2) @ 1.5GHz" ;;
;; "iPad5,"[3-4]) cpu="Apple A8X (3) @ 1.5GHz" ;;
"iPad6,"[3-4]) cpu="Apple A9X (2) @ 2.16GHz" ;;
"iPhone5,1" | "iPhone5,2" | "iPhone5,3" | "iPhone5,4") "iPad6,"[7-8]) cpu="Apple A9X (2) @ 2.26GHz" ;;
cpu="Apple A6 @ 1.3GHz"
cores="2"
;;
"iPhone6,1" | "iPhone6,2")
cpu="Apple A7 @ 1.3GHz"
cores="2"
;;
"iPhone7,1" | "iPhone7,2")
cpu="Apple A8 @ 1.4GHz"
cores="2"
;;
"iPhone8,1" | "iPhone8,2" | "iPhone8,4")
cpu="Apple A9 @ 1.85GHz"
cores="2"
;;
"iPod2,1")
cpu="Samsung S5L8720 @ 533MHz"
cores="1"
;;
"iPod3,1")
cpu="Samsung S5L8922 @ 600MHz"
cores="1"
;;
"iPod7,1")
cpu="Apple A8 @ 1.1GHz"
cores="2"
;;
"iPad1,1")
cpu="Apple A4 @ 1GHz"
cores="1"
;;
"iPad2,1" | "iPad2,2" | "iPad2,3" | "iPad2,4" | "iPad2,5" | "iPad2,6" | "iPad2,7")
cpu="Apple A5 @ 1GHz"
cores="2"
;;
"iPad3,1" | "iPad3,2" | "iPad3,3")
cpu="Apple A5X @ 1GHz"
cores="2"
;;
"iPad3,4" | "iPad3,5" | "iPad3,6")
cpu="Apple A6X @ 1.4GHz"
cores="2"
;;
"iPad4,1" | "iPad4,2" | "iPad4,3")
cpu="Apple A7 @ 1.4GHz"
cores="2"
;;
"iPad4,4" | "iPad4,5" | "iPad4,6" | "iPad4,7" | "iPad4,8" | "iPad4,9")
cpu="Apple A7 @ 1.4GHz"
cores="2"
;;
"iPad5,1" | "iPad5,2")
cpu="Apple A8 @ 1.5GHz"
cores="2"
;;
"iPad5,3" | "iPad5,4")
cpu="Apple A8X @ 1.5GHz"
cores="3"
;;
"iPad6,3" | "iPad6,4")
cpu="Apple A9X @ 2.16GHz"
cores="2"
;;
"iPad6,7" | "iPad6,8")
cpu="Apple A9X @ 2.26GHz"
cores="2"
;;
esac esac
;; ;;
@ -918,6 +846,10 @@ getcpu() {
[ "$cpu_cores" != "off" ] && [ "$cores" ] && \ [ "$cpu_cores" != "off" ] && [ "$cores" ] && \
cpu="${cpu/@/(${cores}) @}" cpu="${cpu/@/(${cores}) @}"
# Remove speed from output
[ "$cpu_speed" == "off" ] && \
cpu="${cpu/@ *GHz}"
# Make the output of cpu shorter # Make the output of cpu shorter
case "$cpu_shorthand" in case "$cpu_shorthand" in
"name") cpu="${cpu/@*}" ;; "name") cpu="${cpu/@*}" ;;
@ -979,67 +911,36 @@ getcpu_usage() {
getgpu() { getgpu() {
case "$os" in case "$os" in
"Linux") "Linux")
gpu="$(PATH="/sbin:$PATH" lspci | grep -F "3D")" # Use cache if it exists
if [ -f "/tmp/neofetch/gpu" ]; then
# If a GPU with a prefix of '3D' doesn't exist source "/tmp/neofetch/gpu"
# fallback to looking for a prefix of 'VGA'
[ -z "$gpu" ] && \
gpu="$(PATH="/sbin:$PATH" lspci | grep -F "VGA")"
gpu="${gpu//??':'??'.'?}"
# Count the number of GPUs
count="$(printf "%s" "$gpu" | uniq -c)"
count="${count/ VGA*}"
count="${count/ 3D*}"
# If there's more than one gpu
# Display the count.
if [ "$count" -gt 1 ]; then
count=" x $count"
else else
unset count gpu="$(PATH="/sbin:$PATH" lspci -mm | awk -F '\\"|\\" \\"' '/3D|VGA/ {print $3 " " $4}')"
fi
# Format the output
gpu="${gpu/* VGA compatible controller: }"
gpu="${gpu/* 3D controller: }"
gpu="${gpu/(rev*)}"
case "$gpu" in case "$gpu" in
intel*) intel*) gpu="Intel Integrated Graphics" ;;
gpu="Intel Integrated Graphics"
;;
advanced*) advanced*)
gpu="${gpu/Advanced Micro Devices, Inc\. }"
gpu="${gpu/'[AMD/ATI]' }" gpu="${gpu/'[AMD/ATI]' }"
gpu="${gpu/Tahiti PRO}" gpu="${gpu/'[AMD]' }"
gpu="${gpu/XTX}" gpu="${gpu/*\[}"
gpu="${gpu/ OEM}" gpu="${gpu/\]*}"
gpu="${gpu/ \[}" gpu="${gpu/\/*}"
gpu="${gpu/\]}" gpu="AMD $gpu"
gpu="${gpu/*Radeon/Radeon}"
brand="AMD "
;; ;;
nvidia*) nvidia*)
gpu="${gpu/NVIDIA Corporation }" gpu="${gpu/*\[}"
gpu="${gpu/G????M }" gpu="${gpu/\]*}"
gpu="${gpu/G???? }" gpu="NVIDIA $gpu"
gpu="${gpu/\[}"
gpu="${gpu/\] }"
brand="NVIDIA "
;; ;;
*virtualbox*) *virtualbox*)
gpu="VirtualBox Graphics Adapter" gpu="VirtualBox Graphics Adapter"
;; ;;
esac esac
cache "gpu" "$gpu" "/tmp"
gpu="${brand}${gpu}" fi
;; ;;
"Mac OS X") "Mac OS X")
@ -1055,55 +956,34 @@ getgpu() {
;; ;;
"iPhone OS") "iPhone OS")
ios_model="${ios_model:-"$(uname -m)"}" case "${ios_model:-"$(uname -m)"}" in
case "$ios_model" in "iPhone1,"[1-2]) gpu="PowerVR MBX Lite 3D" ;;
"iPhone1,1" | "iPhone1,2") "iPhone5,"[1-4]) gpu="PowerVR SGX543MP3" ;;
gpu="PowerVR MBX Lite 3D" "iPhone8,"[1-4]) gpu="PowerVR GT7600" ;;
;; "iPad3,"[1-3]) gpu="PowerVR SGX534MP4" ;;
"iPad3,"[4-6]) gpu="PowerVR SGX554MP4" ;;
"iPad5,"[3-4]) gpu="PowerVR GXA6850" ;;
"iPad6,"[3-8]) gpu="PowerVR 7XT" ;;
"iPhone2,1" | "iPhone3,1" | "iPhone3,2" | "iPhone3,3" | "iPod3,1" | "iPod4,1" | "iPad1,1") "iPhone2,1" | "iPhone3,"[1-3] | "iPod3,1" | "iPod4,1" | "iPad1,1")
gpu="PowerVR SGX535" gpu="PowerVR SGX535"
;; ;;
"iPhone4,1" | "iPad2,1" | "iPad2,2" | "iPad2,3" | "iPad2,4" | "iPad2,5" | "iPad2,6" | "iPad2,7" | "iPod5,1") "iPhone4,1" | "iPad2,"[1-7] | "iPod5,1")
gpu="PowerVR SGX543MP2" gpu="PowerVR SGX543MP2"
;; ;;
"iPhone5,1" | "iPhone5,2" | "iPhone5,3" | "iPhone5,4") "iPhone6,"[1-2] | "iPad4,"[1-9])
gpu="PowerVR SGX543MP3"
;;
"iPhone6,1" | "iPhone6,2" | "iPad4,1" | "iPad4,2" | "iPad4,3" | "iPad4,4" | "iPad4,5" | "iPad4,6" | "iPad4,7" | "iPad4,8" | "iPad4,9")
gpu="PowerVR G6430" gpu="PowerVR G6430"
;; ;;
"iPhone7,1" | "iPhone7,2" | "iPod7,1" | "iPad5,1" | "iPad5,2") "iPhone7,"[1-2] | "iPod7,1" | "iPad5,"[1-2])
gpu="PowerVR GX6450" gpu="PowerVR GX6450"
;; ;;
"iPhone8,1" | "iPhone8,2" | "iPhone8,4")
gpu="PowerVR GT7600"
;;
"iPod1,1" | "iPod2,1") "iPod1,1" | "iPod2,1")
gpu="PowerVR MBX Lite" gpu="PowerVR MBX Lite"
;; ;;
"iPad3,1" | "iPad3,2" | "iPad3,3")
gpu="PowerVR SGX534MP4"
;;
"iPad3,4" | "iPad3,5" | "iPad3,6")
gpu="PowerVR SGX554MP4"
;;
"iPad5,3" | "iPad5,4")
gpu="PowerVR GXA6850"
;;
"iPad6,3" | "iPad6,4" | "iPad6,7" | "iPad6,8")
gpu="PowerVR 7XT"
;;
esac esac
;; ;;
@ -1128,35 +1008,11 @@ getgpu() {
;; ;;
esac esac
case "$gpu_shorthand" in
"on" | "tiny")
gpu="${gpu// Rev\. ?}"
gpu="${gpu//AMD*\/ATI\]/AMD}"
gpu="${gpu// Tahiti}"
gpu="${gpu// PRO}"
gpu="${gpu// OEM}"
gpu="${gpu// Mars}"
gpu="${gpu// Series}"
gpu="${gpu// Controller}"
gpu="${gpu/\/*}"
case "$gpu_shorthand" in
"tiny")
gpu="${gpu/Graphics }"
gpu="${gpu/GeForce }"
gpu="${gpu/Radeon }"
;;
esac
;;
esac
if [ "$gpu_brand" == "off" ]; then if [ "$gpu_brand" == "off" ]; then
gpu="${gpu/AMD}" gpu="${gpu/AMD}"
gpu="${gpu/NVIDIA}" gpu="${gpu/NVIDIA}"
gpu="${gpu/Intel}" gpu="${gpu/Intel}"
fi fi
gpu="${gpu}${count}"
} }
# }}} # }}}
@ -1166,16 +1022,18 @@ getgpu() {
getmemory() { getmemory() {
case "$os" in case "$os" in
"Linux" | "Windows") "Linux" | "Windows")
if grep -F "MemAvail" /proc/meminfo >/dev/null 2>&1; then # MemUsed = Memtotal + Shmem - MemFree - Buffers - Cached - SReclaimable
mem=($(awk -F ':| kB' '/MemTotal|MemAvail/ {printf $2}' /proc/meminfo)) # Source: https://github.com/KittyKatt/screenFetch/issues/386#issuecomment-249312716
memused="$((mem[0] - mem[1]))" while IFS=":" read -r a b; do
else case "$a" in
mem=($(awk -F ':| kB' '/MemTotal|MemFree|Buffers|Cached/ {printf $2}' /proc/meminfo) 0 0) "MemTotal") memused="$((memused+=${b/kB}))"; memtotal="${b/kB}" ;;
memused="$((mem[0] - mem[1] - mem[2] - mem[3]))" "Shmem") memused="$((memused+=${b/kB}))" ;;
fi "MemFree" | "Buffers" | "Cached" | "SReclaimable") memused="$((memused-=${b/kB}))" ;;
esac
done < /proc/meminfo
memused="$((memused / 1024))" memused="$((memused / 1024))"
memtotal="$((mem[0] / 1024))" memtotal="$((memtotal / 1024))"
;; ;;
"Mac OS X" | "iPhone OS") "Mac OS X" | "iPhone OS")
@ -1220,27 +1078,33 @@ getmemory() {
# Song {{{ # Song {{{
getsong() { getsong() {
if mpc version >/dev/null 2>&1; then # 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}')"
case "${player/*\/}" in
"mpd"*)
song="$(mpc current 2>/dev/null)" song="$(mpc current 2>/dev/null)"
state="$(mpc | awk -F '\\[|\\]' '/\[/ {printf $2}' 2>/dev/null)" state="$(mpc | awk -F '\\[|\\]' '/\[/ {printf $2}' 2>/dev/null)"
;;
elif [ -n "$(ps x | awk '!(/awk/) && /cmus/')" ]; then "cmus"*)
IFS=$'\n' IFS=$'\n'
song=("$(cmus-remote -Q | grep "tag artist \|title \|status" 2>/dev/null | sort)") song=($(cmus-remote -Q | grep "tag artist \|tag title \|status" 2>/dev/null | sort))
state="${song[0]/status }"
artist="${song[1]/tag artist }" artist="${song[1]/tag artist }"
title="${song[2]/tag title }" title="${song[2]/tag title }"
state="${song[0]/status }" song="${artist/tag title } - ${title/tag artist }"
;;
song="$artist - $title" "mocp"*)
elif pgrep "mocp" >/dev/null 2>&1; then
song="$(mocp -Q "%artist - %song" 2>/dev/null)" song="$(mocp -Q "%artist - %song" 2>/dev/null)"
state="$(mocp -Q "%state" 2>/dev/null)" state="$(mocp -Q "%state" 2>/dev/null)"
;;
elif [ -n "$(ps x | awk '!(/awk/) && /spotify/')" ]; then "spotify"*)
case "$os" in case "$os" in
"Linux") "Linux")
# This command is way too long # Thanks dbus
song="$(\ song="$(\
dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 \ dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 \
org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata' |\ org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata' |\
@ -1257,40 +1121,50 @@ getsong() {
state="$(osascript -e 'tell application "Spotify" to player state as string')" state="$(osascript -e 'tell application "Spotify" to player state as string')"
;; ;;
esac esac
;;
elif [ -n "$(ps x | awk '!(/awk/ || /Helper/) && /Google Play Music Desktop Player/')" ] && type -p gpmdp-remote >/dev/null 2>&1; then "google play"*)
song="$(gpmdp-remote current)" song="$(gpmdp-remote current 2>/dev/null)"
state="$(gpmdp-remote status)" state="$(gpmdp-remote status 2>/dev/null)"
;;
elif [ -n "$(ps x | awk '!(/awk/ || /Helper/ || /Cache/) && /iTunes.app/')" ]; then "itunes"*)
song="$(osascript -e 'tell application "iTunes" to artist of current track as string & " - " & name of current track as string')" song="$(osascript -e 'tell application "iTunes" to artist of current track as string & " - " & name of current track as string')"
state="$(osascript -e 'tell application "iTunes" to player state as string')" state="$(osascript -e 'tell application "iTunes" to player state as string')"
;;
elif [ -n "$(ps x | awk '!(/awk/) && /rhythmbox/')" ]; then "rhythmbox"*)
song="$(rhythmbox-client --print-playing)" song="$(rhythmbox-client --print-playing)"
# Well, what can you expect? It's dbus after all. # Thanks dbus
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="${state//\"}"
;;
elif [ -n "$(ps x | awk '!(/awk/) && /banshee/')" ]; then "banshee"*)
artist="$(banshee --query-artist | awk -F':' '{print $2}')" artist="$(banshee --query-artist | awk -F':' '{print $2}')"
title="$(banshee --query-title | awk -F':' '{print $2}')" title="$(banshee --query-title | awk -F':' '{print $2}')"
song="$artist - $title" song="$artist - $title"
state="$(banshee --query-current-state | awk -F':' '{print $2}')" state="$(banshee --query-current-state | awk -F':' '{print $2}')"
;;
elif [ -n "$(ps x | awk '!(/awk/) && /amarok/')" ]; then "amarok"*)
artist="$(qdbus org.kde.amarok /Player GetMetadata | awk -F':' '/^artist/ {print $2}')" artist="$(qdbus org.kde.amarok /Player GetMetadata | awk -F':' '/^artist/ {print $2}')"
title="$(qdbus org.kde.amarok /Player GetMetadata | awk -F':' '/title/ {print $2}')" title="$(qdbus org.kde.amarok /Player GetMetadata | awk -F':' '/title/ {print $2}')"
song="$artist - $title" song="$artist - $title"
;;
elif [ -n "$(ps x | awk '!(/awk/) && /deadbeef/')" ]; then "deadbeef"*)
song="$(deadbeef --nowplaying '%a - %t')" song="$(deadbeef --nowplaying '%a - %t')"
;;
else "audacious"*)
song="Not Playing" song="$(audtool current-song)"
fi ;;
*) song="Not Playing" ;;
esac
case "$state" in case "$state" in
"paused" | "PAUSE" | "Paused") "paused" | "PAUSE" | "Paused")
@ -1508,6 +1382,10 @@ getstyle() {
[ "$gtk2" == "off" ] && unset gtk2theme [ "$gtk2" == "off" ] && unset gtk2theme
[ "$gtk3" == "off" ] && unset gtk3theme [ "$gtk3" == "off" ] && unset gtk3theme
# Trim whitespace
gtk2theme="$(trim "$gtk2theme")"
gtk3theme="$(trim "$gtk3theme")"
# Format the string based on which themes exist # Format the string based on which themes exist
if [ "$gtk2theme" ] && [ "$gtk2theme" == "$gtk3theme" ]; then if [ "$gtk2theme" ] && [ "$gtk2theme" == "$gtk3theme" ]; then
gtk3theme+=" [GTK2/3]" gtk3theme+=" [GTK2/3]"
@ -1713,53 +1591,25 @@ getdisk() {
getbattery() { getbattery() {
case "$os" in case "$os" in
"Linux") "Linux")
if [ "$(ls /sys/class/power_supply/)" ]; then # We use 'prin' here and exit the function early so that we can
# Set the index to the battery number. # do multi battery support with a single battery per line.
case "$battery_num" in if [ -f /sys/class/power_supply/**/capacity ]; then
"all") battery_num="*" index=0 ;; for bat in "/sys/class/power_supply/BAT"*; do
*) index="$battery_num" ;; capacity="$(< ${bat}/capacity)"
esac status="$(< ${bat}/status)"
battery="${capacity}% [${status}]"
case "$distro" in
"Android"*)
batteries="$(< /sys/class/power_supply/battery/capacity)"
battery_state="$(< /sys/class/power_supply/battery/status)"
;;
*)
batteries=($(< /sys/class/power_supply/BAT${battery_num}/capacity))
battery_state=($(< /sys/class/power_supply/BAT${battery_num}/status))
;;
esac
# Get the subtitle and reassign it so it doesn't change.
title="$subtitle"
# If shorthand is on, print each value on the same line
if [ "$battery_shorthand" == "on" ]; then
battery="${batteries[*]}"
battery="${battery// /%, }"
battery="${battery}%"
else
if [ "${#batteries[@]}" -gt 1 ]; then
unset battery
# Print each battery on a separate line.
for bat in "${batteries[@]}"; do
case "$battery_display" in case "$battery_display" in
"bar") prin "${title}${index:-0}" "$(bar "${bat/'%'}" 100)" ;; "bar") battery="$(bar "$capacity" 100)" ;;
"infobar") prin "${title}${index:-0}" "${bat}% $(bar "${bat/'%'}" 100)" ;; "infobar") battery+=" $(bar "$capacity" 100)" ;;
"barinfo") prin "${title}${index:-0}" "$(bar "${bat/'%'}" 100) ${bat}%" ;; "barinfo") battery="$(bar "$capacity" 100) ${battery}" ;;
*) prin "${title}${index:-0}" "${bat}%" ;;
esac esac
index="$((index+=1))"
prin "${subtitle}${bat: -1}" "$battery"
done done
fi
unset battery
return return
fi
battery="${batteries[0]}%"
fi
fi
;; ;;
"BSD") "BSD")
@ -2400,11 +2250,7 @@ scrot_upload() {
;; ;;
esac esac
if [ "$image_url" ]; then printf "%s\n" "${image_url:-'[!] Image failed to upload'}"
printf "%s\n" "$image_url"
else
printf "%s\n" "[!] Image failed to upload"
fi
} }
# }}} # }}}
@ -2591,7 +2437,7 @@ colors() {
setcolors 4 3 setcolors 4 3
;; ;;
"Mageia"*) "Mageia"* | "Porteus"*)
setcolors 6 7 setcolors 6 7
;; ;;
@ -2621,7 +2467,7 @@ colors() {
setcolors 3 7 6 1 8 setcolors 3 7 6 1 8
;; ;;
"OpenSuse"* | "Manjaro"* | "Deepin"*) *"SUSE"* | "Manjaro"* | "Deepin"*)
setcolors 2 7 setcolors 2 7
;; ;;
@ -2935,16 +2781,39 @@ kdeconfigdir() {
# }}} # }}}
# Terminal info {{{
#
# Parse terminal config files to get
# info about padding. Due to how w3m-img
# works padding around the terminal throws
# off the cursor placement calculation in
# specific terminals.
#
# Note: This issue only seems to affect
# URxvt.
gettermpadding() {
[ -z "$term" ] && getterm
case "$term" in
"URxvt"*)
border="$(xrdb -query | grep -i "\(URxvt\|\*\)\.InternalBorder")"
border="${border/*:}"
;;
esac
}
# }}}
# Dynamic prompt location {{{ # Dynamic prompt location {{{
dynamicprompt() { dynamicprompt() {
# Calculate image height in terminal cells. # Calculate image height in terminal cells.
# The '+ 1' adds a gap between the prompt and the content.
if [ "$image" != "ascii" ]; then if [ "$image" != "ascii" ]; then
lines="$((${height:-1} / ${font_height:-1} + 3))" gettermpadding
cursor_yoffset="$((${yoffset:-1} / ${font_height:-1}))" lines="$(((height + ${border:-0} + ${yoffset:-0}) / font_height))"
else else
cursor_yoffset="0 - 2" lines="$((lines-=2))"
fi fi
# If the info is higher than the ascii/image place the prompt # If the info is higher than the ascii/image place the prompt
@ -2952,7 +2821,7 @@ dynamicprompt() {
if [ "${lines:-0}" -lt "${info_height:-0}" ]; then if [ "${lines:-0}" -lt "${info_height:-0}" ]; then
lines="-2" lines="-2"
else else
lines="$((lines - info_height + cursor_yoffset))" lines="$((lines - info_height))"
fi fi
# Set the prompt location # Set the prompt location
@ -2963,7 +2832,7 @@ dynamicprompt() {
fi fi
# Add some padding # Add some padding
[ "$image" == "ascii" ] && printf "\n\n" printf "\n\n"
} }
# }}} # }}}
@ -3007,23 +2876,23 @@ usage() { cat << EOF
Possible values: name, speed, tiny, on, off Possible values: name, speed, tiny, on, off
--cpu_cores type Whether or not to display the number of CPU cores --cpu_cores type Whether or not to display the number of CPU cores
Takes: logical, physical, off Takes: logical, physical, off
Note: 'physical' doesn't work on BSD. NOTE: 'physical' doesn't work on BSD.
--cpu_speed on/off Hide/Show cpu speed.
--cpu_temp on/off Hide/Show cpu temperature.
NOTE This only works on linux.
--distro_shorthand on/off Shorten the output of distro (tiny, on, off) --distro_shorthand on/off Shorten the output of distro (tiny, on, off)
NOTE: This is only possible on Linux, macOS, and Solaris NOTE: This is only possible on Linux, macOS, and Solaris
--kernel_shorthand on/off Shorten the output of kernel --kernel_shorthand on/off Shorten the output of kernel
--uptime_shorthand on/off Shorten the output of uptime (tiny, on, off) --uptime_shorthand on/off Shorten the output of uptime (tiny, on, off)
--refresh_rate on/off Whether to display the refresh rate of each monitor --refresh_rate on/off Whether to display the refresh rate of each monitor
Unsupported on Windows Unsupported on Windows
--gpu_shorthand on/off Shorten the output of GPU (tiny, on, off)
--gpu_brand on/off Enable/Disable GPU brand in output. (AMD/NVIDIA/Intel) --gpu_brand on/off Enable/Disable GPU brand in output. (AMD/NVIDIA/Intel)
--gtk_shorthand on/off Shorten output of gtk theme/icons --gtk_shorthand on/off Shorten output of gtk theme/icons
--gtk2 on/off Enable/Disable gtk2 theme/icons output --gtk2 on/off Enable/Disable gtk2 theme/icons output
--gtk3 on/off Enable/Disable gtk3 theme/icons output --gtk3 on/off Enable/Disable gtk3 theme/icons output
--shell_path on/off Enable/Disable showing \$SHELL path --shell_path on/off Enable/Disable showing \$SHELL path
--shell_version on/off Enable/Disable showing \$SHELL version --shell_version on/off Enable/Disable showing \$SHELL version
--battery_num num Which battery to display, default value is 'all' --ip_host url Url to query for public IP
--battery_shorthand on/off Whether or not each battery gets its own line/title
--ip_host url Url to ping for public IP
--song_shorthand on/off Print the Artist/Title on seperate lines --song_shorthand on/off Print the Artist/Title on seperate lines
--birthday_shorthand on/off Shorten the output of birthday --birthday_shorthand on/off Shorten the output of birthday
--birthday_time on/off Enable/Disable showing the time in birthday output --birthday_time on/off Enable/Disable showing the time in birthday output
@ -3135,12 +3004,13 @@ getargs() {
# Info # Info
--os_arch) os_arch="$2" ;; --os_arch) os_arch="$2" ;;
--cpu_cores) cpu_cores="$2" ;; --cpu_cores) cpu_cores="$2" ;;
--cpu_speed) cpu_speed="$2" ;;
--cpu_temp) cpu_temp="$2" ;;
--speed_type) speed_type="$2" ;; --speed_type) speed_type="$2" ;;
--distro_shorthand) distro_shorthand="$2" ;; --distro_shorthand) distro_shorthand="$2" ;;
--kernel_shorthand) kernel_shorthand="$2" ;; --kernel_shorthand) kernel_shorthand="$2" ;;
--uptime_shorthand) uptime_shorthand="$2" ;; --uptime_shorthand) uptime_shorthand="$2" ;;
--cpu_shorthand) cpu_shorthand="$2" ;; --cpu_shorthand) cpu_shorthand="$2" ;;
--gpu_shorthand) gpu_shorthand="$2" ;;
--gpu_brand) gpu_brand="$2" ;; --gpu_brand) gpu_brand="$2" ;;
--refresh_rate) refresh_rate="$2" ;; --refresh_rate) refresh_rate="$2" ;;
--gtk_shorthand) gtk_shorthand="$2" ;; --gtk_shorthand) gtk_shorthand="$2" ;;
@ -3148,8 +3018,6 @@ getargs() {
--gtk3) gtk3="$2" ;; --gtk3) gtk3="$2" ;;
--shell_path) shell_path="$2" ;; --shell_path) shell_path="$2" ;;
--shell_version) shell_version="$2" ;; --shell_version) shell_version="$2" ;;
--battery_num) battery_num="$2" ;;
--battery_shorthand) battery_shorthand="$2" ;;
--ip_host) public_ip_host="$2" ;; --ip_host) public_ip_host="$2" ;;
--song_shorthand) song_shorthand="$2" ;; --song_shorthand) song_shorthand="$2" ;;
--birthday_shorthand) birthday_shorthand="$2" ;; --birthday_shorthand) birthday_shorthand="$2" ;;
@ -3220,6 +3088,7 @@ getargs() {
--clean) --clean)
rm -rf "$thumbnail_dir" rm -rf "$thumbnail_dir"
rm -rf "/Library/Caches/neofetch/" rm -rf "/Library/Caches/neofetch/"
rm -rf "/tmp/neofetch/"
exit exit
;; ;;
@ -3281,6 +3150,7 @@ getargs() {
cpu_display="infobar" cpu_display="infobar"
memory_display="infobar" memory_display="infobar"
disk_display="infobar" disk_display="infobar"
cpu_temp="on"
printinfo() { printinfo() {
if [ "$TRAVIS_OS_NAME" ]; then if [ "$TRAVIS_OS_NAME" ]; then
@ -3357,11 +3227,15 @@ main() {
# Print the info # Print the info
printinfo printinfo
[ "$image" != "off" ] && dynamicprompt
# Prompt calculation
if [ "$image" != "off" ]; then
dynamicprompt
# 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" ] && displayimage [ "$image_backend" == "w3m" ] && displayimage
fi
# Re-enable line wrap # Re-enable line wrap
printf "%b%s" "\033[?7h" printf "%b%s" "\033[?7h"

View file

@ -40,6 +40,14 @@ Whether or not to display the number of CPU cores
.br .br
Note: 'physical' doesn't work on BSD. Note: 'physical' doesn't work on BSD.
.TP .TP
.B \--cpu_speed 'on/off'
Hide/Show cpu speed.
.TP
.B \--cpu_temp 'on/off'
Hide/Show cpu temperature.
.br
NOTE This only works on linux.
.TP
.B \--distro_shorthand 'on/off' .B \--distro_shorthand 'on/off'
Shorten the output of distro (tiny, on, off) Shorten the output of distro (tiny, on, off)
.br .br
@ -56,9 +64,6 @@ Whether to display the refresh rate of each monitor
.br .br
Note: Unsupported on Windows Note: Unsupported on Windows
.TP .TP
.B \--gpu_shorthand 'on/off'
Shorten the output of GPU (tiny, on, off)
.TP
.B \--gpu_brand on/off .B \--gpu_brand on/off
Enable/Disable GPU brand in output. (AMD/NVIDIA/Intel) Enable/Disable GPU brand in output. (AMD/NVIDIA/Intel)
.TP .TP
@ -77,14 +82,8 @@ Enable/Disable showing $SHELL path
.B \--shell_version 'on/off' .B \--shell_version 'on/off'
Enable/Disable showing $SHELL version Enable/Disable showing $SHELL version
.TP .TP
.B \--battery_num 'num'
Which battery to display, default value is 'all'
.TP
.B \--battery_shorthand 'on/off'
Whether or not each battery gets its own line/title
.TP
.B \--ip_host 'url' .B \--ip_host 'url'
URL to ping for public IP URL to query for public IP
.TP .TP
.B \--song_shorthand 'on/off' .B \--song_shorthand 'on/off'
Print the Artist/Title on seperate lines Print the Artist/Title on seperate lines