From 92595e8bc61d734d33596dbdcc329d259f4eb03c Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sat, 22 Oct 2016 10:20:14 +1100 Subject: [PATCH 01/54] Fix cursor artifacts in termux --- neofetch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neofetch b/neofetch index 7328ae6b..7032f499 100755 --- a/neofetch +++ b/neofetch @@ -2929,7 +2929,7 @@ dynamicprompt() { # Set the prompt location if [ "$lines" -lt 0 ]; then - printf "\033[${lines}A" + printf "\033[${lines/-}A" else printf "\033[${lines}B" fi From 0fb2b661bacdfdf656020e4cba87d592254a9503 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sat, 22 Oct 2016 15:11:52 +1100 Subject: [PATCH 02/54] Song: Add support for Audacious. @ncmprhnsbl --- neofetch | 3 +++ 1 file changed, 3 insertions(+) diff --git a/neofetch b/neofetch index 7032f499..41be6a7f 100755 --- a/neofetch +++ b/neofetch @@ -1277,6 +1277,9 @@ getsong() { elif [ -n "$(ps x | awk '!(/awk/) && /deadbeef/')" ]; then song="$(deadbeef --nowplaying '%a - %t')" + elif [ -n "$(ps x | awk '!(/awk/) && /audacious/')" ]; then + song="$(audtool current-song)" + else song="Not Playing" fi From 365390dc785304970cf4768bfe5304213c3e4ca2 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sat, 22 Oct 2016 15:13:09 +1100 Subject: [PATCH 03/54] Changelog --- Changelog.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Changelog.md b/Changelog.md index 561598b2..f8d0b22d 100644 --- a/Changelog.md +++ b/Changelog.md @@ -3,6 +3,7 @@ - **[@konimex](https://github.com/konimex)** - **[@iandrewt](https://github.com/iandrewt)** - **[@coypoop](https://github.com/coypoop)** +- **[@ncmprhnsbl](https://github.com/ncmprhnsbl)**
@@ -128,3 +129,4 @@ Note: `\033[14t` is still supported, if images already work for you then you don **Song**
- [macOS] Fix iTunes automatically opening. **[@iandrewt](https://github.com/iandrewt)** +- Added support for Audacious. **[@ncmprhnsbl](https://github.com/ncmprhnsbl)** From 919da277164e6fbf701d6167a62da1b94c1067a1 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sat, 22 Oct 2016 15:19:56 +1100 Subject: [PATCH 04/54] Added support for Porteus, closes #388 --- ascii/distro/porteus | 25 +++++++++++++++++++++++++ neofetch | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 ascii/distro/porteus diff --git a/ascii/distro/porteus b/ascii/distro/porteus new file mode 100644 index 00000000..cd521b70 --- /dev/null +++ b/ascii/distro/porteus @@ -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\` + .+: + \` +" diff --git a/neofetch b/neofetch index 41be6a7f..ea9c8cb6 100755 --- a/neofetch +++ b/neofetch @@ -2571,7 +2571,7 @@ colors() { setcolors 4 3 ;; - "Mageia"*) + "Mageia"* | "Porteus"*) setcolors 6 7 ;; From eaae9efb9d49cd4cfe0cd5cb4da4d4fddbd0fc14 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sat, 22 Oct 2016 15:20:32 +1100 Subject: [PATCH 05/54] Changelog --- Changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/Changelog.md b/Changelog.md index f8d0b22d..f16c3710 100644 --- a/Changelog.md +++ b/Changelog.md @@ -19,6 +19,7 @@ - Added support for Bitrig. **[@konimex](https://github.com/konimex)** - Added support for Sparky Linux. +- Added support for Porteus. **[@ncmprhnsbl](https://github.com/ncmprhnsbl)** ## Packages From 17d17f448038595f28ef2d81c2b0e7cefda16aec Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sat, 22 Oct 2016 19:59:25 +1100 Subject: [PATCH 06/54] Theme: Fix gtk2/3 comparison when whitespace is involved --- neofetch | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/neofetch b/neofetch index ea9c8cb6..9b236b7e 100755 --- a/neofetch +++ b/neofetch @@ -1500,6 +1500,10 @@ getstyle() { [ "$gtk2" == "off" ] && unset gtk2theme [ "$gtk3" == "off" ] && unset gtk3theme + # Trim whitespace + gtk2theme="$(trim "$gtk2theme")" + gtk3theme="$(trim "$gtk3theme")" + # Format the string based on which themes exist if [ "$gtk2theme" ] && [ "$gtk2theme" == "$gtk3theme" ]; then gtk3theme+=" [GTK2/3]" From fe8e15d5d6f5bf26dc7beb448579c080987b188e Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sat, 22 Oct 2016 20:25:41 +1100 Subject: [PATCH 07/54] Simplify cursor position --- neofetch | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/neofetch b/neofetch index 9b236b7e..5b625040 100755 --- a/neofetch +++ b/neofetch @@ -2918,10 +2918,9 @@ kdeconfigdir() { dynamicprompt() { # Calculate image height in terminal cells. - # The '+ 1' adds a gap between the prompt and the content. if [ "$image" != "ascii" ]; then - lines="$((${height:-1} / ${font_height:-1} + 3))" - cursor_yoffset="$((${yoffset:-1} / ${font_height:-1}))" + lines="$((height / font_height))" + cursor_yoffset="$((${yoffset:-1} / font_height))" else cursor_yoffset="0 - 2" fi @@ -2942,7 +2941,7 @@ dynamicprompt() { fi # Add some padding - [ "$image" == "ascii" ] && printf "\n\n" + printf "\n\n" } # }}} From a59cf169e4ac8d26b82c30658efda42383619afb Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sat, 22 Oct 2016 23:14:54 +1100 Subject: [PATCH 08/54] Cmus: Fix broken output, closes #389 --- neofetch | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/neofetch b/neofetch index 5b625040..132f21a5 100755 --- a/neofetch +++ b/neofetch @@ -1215,12 +1215,11 @@ getsong() { elif [ -n "$(ps x | awk '!(/awk/) && /cmus/')" ]; then 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 }" title="${song[2]/tag title }" - state="${song[0]/status }" - - song="$artist - $title" + song="${artist/tag title } - ${title/tag artist }" elif pgrep "mocp" >/dev/null 2>&1; then song="$(mocp -Q "%artist - %song" 2>/dev/null)" From 6457b3276f1d164863d56d33be09c69162b5a9c5 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 23 Oct 2016 09:07:04 +1100 Subject: [PATCH 09/54] Windows: Print DE --- neofetch | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/neofetch b/neofetch index 132f21a5..cc6cfecb 100755 --- a/neofetch +++ b/neofetch @@ -481,6 +481,13 @@ getshell() { getde() { case "$os" in "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="${de/'X-'}" From 9838c7cc5bc195d7611266dc6d7e7084b71adeb0 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 23 Oct 2016 09:10:48 +1100 Subject: [PATCH 10/54] Changelog --- Changelog.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Changelog.md b/Changelog.md index f16c3710..a3fafde7 100644 --- a/Changelog.md +++ b/Changelog.md @@ -76,6 +76,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)** - Removed `osx_buildversion` and `osx_codename` in favour of `distro_shorthand`. **[@konimex](https://github.com/konimex)** +**Desktop Environment**
+ +- [Windows] Added support for showing DE. + - Windows 8 and above: `Modern UI/Metro` + - Windows 7 and below: `Aero` + **Window Manager**
- [Windows] Added support for custom WMs/Shells. From 3ef6aeea423502d55ec2bace1e68b9f5d6f517ce Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 23 Oct 2016 09:45:03 +1100 Subject: [PATCH 11/54] Linux: Add CPU temperature --- README.md | 3 +++ config/config | 11 +++++++++++ neofetch | 29 +++++++++++++++++++++++------ neofetch.1 | 8 ++++++++ 4 files changed, 45 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index e6b53b45..04352c52 100644 --- a/README.md +++ b/README.md @@ -434,6 +434,9 @@ alias neofetch2="neofetch \ --cpu_cores type Whether or not to display the number of CPU cores Takes: logical, physical, off 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) NOTE: This is only possible on Linux, macOS, and Solaris --kernel_shorthand on/off Shorten the output of kernel diff --git a/config/config b/config/config index 18b52af9..ebdb8dec 100644 --- a/config/config +++ b/config/config @@ -106,6 +106,11 @@ cpu_shorthand="off" # --cpu_display bar, infobar, barinfo, off cpu_display="off" +# CPU Speed +# Hide/Show CPU speed. +# --cpu_speed on, off +cpu_speed="on" + # CPU Cores # Display CPU cores in output # Logical: All virtual cores @@ -114,6 +119,12 @@ cpu_display="off" # Note: 'physical' doesn't work on BSD. cpu_cores="logical" +# CPU Temperature +# Hide/Show CPU temperature. +# --cpu_temp on, off +# Note: Only works on Linux. +cpu_temp="on" + # GPU diff --git a/neofetch b/neofetch index cc6cfecb..6ed8c8e0 100755 --- a/neofetch +++ b/neofetch @@ -686,10 +686,11 @@ getcpu() { "Linux" | "Windows") # Get cpu name cpu="$(awk -F ': | @' '/model name/ {printf $2; exit}' /proc/cpuinfo)" - 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 - if [ -d "$cpu_dir" ]; then + if [ -d "$speed_dir" ]; then case "$speed_type" in current) speed_type="scaling_cur_freq" ;; min) speed_type="scaling_min_freq" ;; @@ -701,8 +702,8 @@ getcpu() { esac # Fallback to cpuinfo_max_freq if $speed_type fails - read -t 1 -r speed < "${cpu_dir}/${speed_type}" || \ - read -t 1 -r speed < "${cpu_dir}/cpuinfo_max_freq" + read -t 1 -r speed < "${speed_dir}/${speed_type}" || \ + read -t 1 -r speed < "${speed_dir}/cpuinfo_max_freq" speed="$((speed / 100000))" else @@ -710,6 +711,13 @@ getcpu() { speed="$((speed / 100))" 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 case "$cpu_cores" in "logical" | "on") cores="$(grep -c ^processor /proc/cpuinfo)" ;; @@ -723,7 +731,7 @@ getcpu() { speed="${speed:0:1}.${speed:1}" fi - cpu="$cpu @ ${speed}GHz" + cpu="$cpu @ ${speed}GHz $temp" ;; "Mac OS X") @@ -914,6 +922,10 @@ getcpu() { [ "$cpu_cores" != "off" ] && [ "$cores" ] && \ cpu="${cpu/@/(${cores}) @}" + # Remove speed from output + [ "$cpu_speed" == "off" ] && \ + cpu="${cpu/@ *GHz}" + # Make the output of cpu shorter case "$cpu_shorthand" in "name") cpu="${cpu/@*}" ;; @@ -2991,7 +3003,10 @@ usage() { cat << EOF Possible values: name, speed, tiny, on, off --cpu_cores type Whether or not to display the number of CPU cores 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) NOTE: This is only possible on Linux, macOS, and Solaris --kernel_shorthand on/off Shorten the output of kernel @@ -3119,6 +3134,8 @@ getargs() { # Info --os_arch) os_arch="$2" ;; --cpu_cores) cpu_cores="$2" ;; + --cpu_speed) cpu_speed="$2" ;; + --cpu_temp) cpu_temp="$2" ;; --speed_type) speed_type="$2" ;; --distro_shorthand) distro_shorthand="$2" ;; --kernel_shorthand) kernel_shorthand="$2" ;; diff --git a/neofetch.1 b/neofetch.1 index 62d98dd4..5fa7c980 100644 --- a/neofetch.1 +++ b/neofetch.1 @@ -40,6 +40,14 @@ Whether or not to display the number of CPU cores .br Note: 'physical' doesn't work on BSD. .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' Shorten the output of distro (tiny, on, off) .br From 4e741ef8ef81d5a516ad270df2eeeda12ab70e0e Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 23 Oct 2016 09:47:01 +1100 Subject: [PATCH 12/54] CPU Temp: Off by default --- config/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/config b/config/config index ebdb8dec..ea523942 100644 --- a/config/config +++ b/config/config @@ -123,7 +123,7 @@ cpu_cores="logical" # Hide/Show CPU temperature. # --cpu_temp on, off # Note: Only works on Linux. -cpu_temp="on" +cpu_temp="off" # GPU From a06fc79debbcd24de784173c7324d28fbd0619d2 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 23 Oct 2016 09:50:05 +1100 Subject: [PATCH 13/54] Changelog --- Changelog.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Changelog.md b/Changelog.md index a3fafde7..0ae971f0 100644 --- a/Changelog.md +++ b/Changelog.md @@ -94,9 +94,13 @@ Note: `\033[14t` is still supported, if images already work for you then you don **CPU**
+- 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`. - `logical`: Show all virtual cores (hyperthreaded). - `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)** **Uptime**
From 664556d13709c3a2bf24d914b030ea6bcc24bd4c Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 23 Oct 2016 09:51:16 +1100 Subject: [PATCH 14/54] Test mode: Show CPU temp --- neofetch | 1 + 1 file changed, 1 insertion(+) diff --git a/neofetch b/neofetch index 6ed8c8e0..efdd7b2e 100755 --- a/neofetch +++ b/neofetch @@ -3282,6 +3282,7 @@ getargs() { cpu_display="infobar" memory_display="infobar" disk_display="infobar" + cpu_temp="on" printinfo() { if [ "$TRAVIS_OS_NAME" ]; then From 5a855e667fca39f28ae5eec61001b4eabc649d59 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 23 Oct 2016 09:54:47 +1100 Subject: [PATCH 15/54] Config: Change formatting --- config/config | 53 ++++++++++++++++++++++++++------------------------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/config/config b/config/config index ea523942..e6df2965 100644 --- a/config/config +++ b/config/config @@ -55,7 +55,7 @@ printinfo () { # Kernel # Show more kernel info -# --kernel_shorthand on/off +# --kernel_shorthand on, off kernel_shorthand="on" @@ -66,7 +66,7 @@ kernel_shorthand="on" distro_shorthand="off" # Show 'x86_64' and 'x86' in 'Distro:' output. -# --os_arch on/off +# --os_arch on, off os_arch="on" @@ -80,11 +80,11 @@ uptime_shorthand="off" # Shell # Show the path to $SHELL -# --shell_path on/off +# --shell_path on, off shell_path="off" # Show $SHELL's version -# --shell_version on/off +# --shell_version on, off shell_version="on" @@ -129,34 +129,35 @@ cpu_temp="off" # GPU # Shorten output of the getgpu funcion -# --gpu_shorthand on/off/tiny +# --gpu_shorthand on, off, tiny gpu_shorthand="on" # Enable/Disable GPU Brand -# --gpu_brand on/off +# --gpu_brand on, off gpu_brand="on" + # Resolution # Display refresh rate next to each monitor # Unsupported on Windows -# --refresh_rate on/off +# --refresh_rate on, off refresh_rate="off" # Gtk Theme / Icons # Shorten output (Hide [GTK2] etc) -# --gtk_shorthand on/off +# --gtk_shorthand on, off gtk_shorthand="off" # Enable/Disable gtk2 theme/icons output -# --gtk2 on/off +# --gtk2 on, off gtk2="on" # Enable/Disable gtk3 theme/icons output -# --gtk3 on/off +# --gtk3 on, off gtk3="on" @@ -171,7 +172,7 @@ 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 on, off battery_shorthand="off" @@ -185,7 +186,7 @@ public_ip_host="http://ident.me" # Song # Print the Artist and Title on seperate lines -# --song_shorthand on/off +# --song_shorthand on, off song_shorthand="off" @@ -194,11 +195,11 @@ song_shorthand="off" # Whether to show a long pretty output # or a shortened one # NOTE: Long pretty output doesn't work on OpenBSD or NetBSD. -# --birthday_shorthand on/off +# --birthday_shorthand on, off birthday_shorthand="off" # Whether to show the time in the output -# --birthday_time on/off +# --birthday_time on, off birthday_time="on" # Date format to use when printing birthday @@ -227,11 +228,11 @@ colors=(distro) # Toggle bold text -# --bold on/off +# --bold on, off bold="on" # Enable/Disable Underline -# --underline on/off +# --underline on, off underline_enabled="on" # Underline character @@ -250,7 +251,7 @@ start=0 end=7 # Toggle color blocks -# --color_blocks on/off +# --color_blocks on, off color_blocks="on" # Color block width in spaces @@ -273,7 +274,7 @@ progress_char_elapsed="-" progress_char_total="=" # Progress border -# --progress_border on/off +# --progress_border on, off progress_border="on" # Progress bar length in spaces @@ -294,9 +295,9 @@ progress_color_total="distro" # barinfo: The bar is displayed before the info. # off: Only the info is displayed. # -# --memory_display bar/infobar/barinfo/off -# --battery_display bar/infobar/barinfo/off -# --disk_display bar/infobar/barinfo/off +# --memory_display bar, infobar, barinfo, off +# --battery_display bar, infobar, barinfo, off +# --disk_display bar, infobar, barinfo, off memory_display="off" battery_display="off" disk_display="off" @@ -321,17 +322,17 @@ w3m_img_path="/usr/lib/w3m/w3mimgdisplay" # Image position # Only works with the w3m backend. -# --image_position left/right +# --image_position left, right image_position="left" # Crop mode -# --crop_mode normal/fit/fill +# --crop_mode normal, fit, fill crop_mode="normal" # Crop offset # Only affects normal mode. -# --crop_offset northwest/north/northeast/west/center -# east/southwest/south/southeast +# --crop_offset northwest, north, northeast, west, center +# east, southwest, south, southeast crop_offset="center" # Image size @@ -391,7 +392,7 @@ ascii_logo_size="normal" # Bold ascii logo # Whether or not to bold the ascii logo. -# --ascii_bold on/off +# --ascii_bold on, off ascii_bold="on" From 187dfe7a79067cf23cf9aa94902e94129eac9b32 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 23 Oct 2016 09:57:00 +1100 Subject: [PATCH 16/54] Config: Small formatting change --- config/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/config b/config/config index e6df2965..80271b8a 100644 --- a/config/config +++ b/config/config @@ -14,7 +14,7 @@ export LANG=C # Info # See this wiki page for more info: # https://github.com/dylanaraps/neofetch/wiki/Customizing-Info -printinfo () { +printinfo() { info title info underline From f41e0ef660b2f1aeeb9af7133964e250c010d29d Mon Sep 17 00:00:00 2001 From: ncmprhnsbl Date: Sun, 23 Oct 2016 09:05:29 +1000 Subject: [PATCH 17/54] update void ascii fixes to make more like original screenfetch ascii --- ascii/distro/void | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ascii/distro/void b/ascii/distro/void index 7e7dba62..92d53126 100644 --- a/ascii/distro/void +++ b/ascii/distro/void @@ -6,11 +6,11 @@ ${c1} __.;=====;.__ _vi, \` --+=++++: .uvnvi. _._ -==+==+. .vvnvnI\` .;==|==;. :|=||=|. -${c2}+QmQQmpvvnv; ${c2}_yYsyQQWUUQQQm #QmQ#${c1}:${c2}QQQWUV\$QQmL -${c2} -QQWQWpvvo${c2}wZ?.wQQQE${c1}==<${c2}QWWQ/QWQW.QQWW${c1}(: ${c2}jQWQE +${c2}+QmQQm${c1}pvvnv; ${c2}_yYsyQQWUUQQQm #QmQ#${c1}:${c2}QQQWUV\$QQmL +${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} -\$WQ8YnI: ${c2}QWQQwgQQWV${c1}\`${c2}mWQQ.jQWQQgyyWW@! - -1vvnvv. ${c1}\`~+++\` ++|+++ +${c2} -\$WQ8Y${c1}nI: ${c2}QWQQwgQQWV${c1}\`${c2}mWQQ.jQWQQgyyWW@! +${c1} -1vvnvv. \`~+++\` ++|+++ +vnvnnv, \`-|=== +vnvnvns. . :=- -Invnvvnsi..___..=sv=. \` @@ -18,3 +18,4 @@ ${c2} -\$WQ8YnI: ${c2}QWQQwgQQWV${c1}\`${c2}mWQQ.jQWQQgyyWW@! ~|Invnvnvvnvvvnnv}+\` -~\|{*l}*|\\~ " + From 49cdb2f95cae78260730f2c314c5409bc298a872 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 23 Oct 2016 11:03:46 +1100 Subject: [PATCH 18/54] Linux: Correctly calculate memory usage --- neofetch | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/neofetch b/neofetch index efdd7b2e..83525fec 100755 --- a/neofetch +++ b/neofetch @@ -1174,16 +1174,18 @@ getgpu() { getmemory() { case "$os" in "Linux" | "Windows") - if grep -F "MemAvail" /proc/meminfo >/dev/null 2>&1; then - mem=($(awk -F ':| kB' '/MemTotal|MemAvail/ {printf $2}' /proc/meminfo)) - memused="$((mem[0] - mem[1]))" - else - mem=($(awk -F ':| kB' '/MemTotal|MemFree|Buffers|Cached/ {printf $2}' /proc/meminfo) 0 0) - memused="$((mem[0] - mem[1] - mem[2] - mem[3]))" - fi + # MemUsed = Memtotal + Shmem - MemFree - Buffers - Cached - SReclaimable + # Source: https://github.com/KittyKatt/screenFetch/issues/386#issuecomment-249312716 + while IFS=":" read -r a b; do + case "$a" in + "MemTotal") memused="$((memused+=${b/kB}))"; memtotal="${b/kB}" ;; + "Shmem") memused="$((memused+=${b/kB}))" ;; + "MemFree" | "Buffers" | "Cached" | "SReclaimable") memused="$((memused-=${b/kB}))" ;; + esac + done < /proc/meminfo memused="$((memused / 1024))" - memtotal="$((mem[0] / 1024))" + memtotal="$((memtotal / 1024))" ;; "Mac OS X" | "iPhone OS") From 47d8fe1bf6d3272580478cf10d8742535d38c52c Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 23 Oct 2016 11:09:20 +1100 Subject: [PATCH 19/54] Changelog --- Changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/Changelog.md b/Changelog.md index 0ae971f0..1a154340 100644 --- a/Changelog.md +++ b/Changelog.md @@ -114,6 +114,7 @@ Note: `\033[14t` is still supported, if images already work for you then you don **Memory**
+- [Linux] Correctly calculate used memory. - [NetBSD] Fix memory output for sizes over 4GB. **[@coypoop](https://github.com/coypoop)** **Shell**
From 8c93c3b6c3fc91edfe0bf9860f4cc1143a2d6ee4 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 23 Oct 2016 11:10:16 +1100 Subject: [PATCH 20/54] Changelog --- Changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/Changelog.md b/Changelog.md index 1a154340..b0520039 100644 --- a/Changelog.md +++ b/Changelog.md @@ -67,6 +67,7 @@ Note: `\033[14t` is still supported, if images already work for you then you don - Bold ascii art by default. - Fixed incorrect prompt location when using `ascii_logo_size small`. +- Update Void Linux ascii art. **[@ncmprhnsbl](https://github.com/ncmprhnsbl)** ## Info From f4b266b5c6efd58685b8f860191c13c5ed747666 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 23 Oct 2016 11:13:40 +1100 Subject: [PATCH 21/54] CPU Speed: Don't use read --- neofetch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/neofetch b/neofetch index 83525fec..c97fbae6 100755 --- a/neofetch +++ b/neofetch @@ -702,8 +702,8 @@ getcpu() { esac # Fallback to cpuinfo_max_freq if $speed_type fails - read -t 1 -r speed < "${speed_dir}/${speed_type}" || \ - read -t 1 -r speed < "${speed_dir}/cpuinfo_max_freq" + speed="$(< "${speed_dir}/${speed_type}")" || \ + speed="$(< "${speed_dir}/cpuinfo_max_freq")" speed="$((speed / 100000))" else From 5dddaa0b260d115d1db2f06c5e6c7838f6e6a48d Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 23 Oct 2016 11:22:17 +1100 Subject: [PATCH 22/54] GPU: Remove duplicate substitutions --- neofetch | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/neofetch b/neofetch index c97fbae6..a8e23a5d 100755 --- a/neofetch +++ b/neofetch @@ -1013,6 +1013,8 @@ getgpu() { gpu="${gpu/* VGA compatible controller: }" gpu="${gpu/* 3D controller: }" gpu="${gpu/(rev*)}" + gpu="${gpu/\[}" + gpu="${gpu/\]}" case "$gpu" in intel*) @@ -1025,8 +1027,6 @@ getgpu() { gpu="${gpu/Tahiti PRO}" gpu="${gpu/XTX}" gpu="${gpu/ OEM}" - gpu="${gpu/ \[}" - gpu="${gpu/\]}" gpu="${gpu/*Radeon/Radeon}" brand="AMD " @@ -1036,8 +1036,6 @@ getgpu() { gpu="${gpu/NVIDIA Corporation }" gpu="${gpu/G????M }" gpu="${gpu/G???? }" - gpu="${gpu/\[}" - gpu="${gpu/\] }" brand="NVIDIA " ;; From f1b55fb9d10e8b7c07e45480b289dda26de658ba Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 23 Oct 2016 13:46:20 +1100 Subject: [PATCH 23/54] Update Changelog.md --- Changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/Changelog.md b/Changelog.md index b0520039..25887c6c 100644 --- a/Changelog.md +++ b/Changelog.md @@ -13,6 +13,7 @@ - Change all `OS X` references to `macOS`. **[@iandrewt](https://github.com/iandrewt)** - Fix corrupted text when long lines are cut-off. - Don't dynamically place prompt in `image=off` mode. +- Cursor Position: Fix issues when using URxvt+Padding ## Operating System From d09cf5879060682266ad6b2fcb3c81dff9a207fa Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 23 Oct 2016 13:47:49 +1100 Subject: [PATCH 24/54] Cursor Position: Fix issues when using URxvt+Padding --- neofetch | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/neofetch b/neofetch index a8e23a5d..e894792f 100755 --- a/neofetch +++ b/neofetch @@ -2932,12 +2932,38 @@ 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 {{{ dynamicprompt() { # Calculate image height in terminal cells. if [ "$image" != "ascii" ]; then - lines="$((height / font_height))" + gettermpadding + + lines="$(((height + border) / font_height))" cursor_yoffset="$((${yoffset:-1} / font_height))" else cursor_yoffset="0 - 2" From 09a4ac132e5fbfe05e6235374c3b6ad57779edee Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 23 Oct 2016 14:08:45 +1100 Subject: [PATCH 25/54] Simplify cursor positioning --- neofetch | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/neofetch b/neofetch index e894792f..d0011a13 100755 --- a/neofetch +++ b/neofetch @@ -2962,11 +2962,9 @@ dynamicprompt() { # Calculate image height in terminal cells. if [ "$image" != "ascii" ]; then gettermpadding - - lines="$(((height + border) / font_height))" - cursor_yoffset="$((${yoffset:-1} / font_height))" + lines="$(((height + ${border:-0} + ${yoffset:-0}) / font_height))" else - cursor_yoffset="0 - 2" + lines="$((lines-=2))" fi # If the info is higher than the ascii/image place the prompt @@ -2974,7 +2972,7 @@ dynamicprompt() { if [ "${lines:-0}" -lt "${info_height:-0}" ]; then lines="-2" else - lines="$((lines - info_height + cursor_yoffset))" + lines="$((lines - info_height))" fi # Set the prompt location From d39bebb2a42e2f34c1badde4ebb439cf26aeef7f Mon Sep 17 00:00:00 2001 From: Muhammad Herdiansyah Date: Sun, 23 Oct 2016 18:36:59 +0700 Subject: [PATCH 26/54] Solaris: Unified package detection with Linux Some OpenSolaris/illumos-based distribution used various Linux package managers such as dpkg, rpm, and portage (see more at http://wiki.illumos.org/display/illumos/Distributions). It would make sense for Solaris' case to be unified with Linux. However, Linux's `pkg` detection (I don't know which distro is that) are vastly different from Oracle Solaris/OpenIndiana's `pkg`, so a workaround is used. --- neofetch | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/neofetch b/neofetch index d0011a13..87830da8 100755 --- a/neofetch +++ b/neofetch @@ -343,7 +343,7 @@ getuptime() { getpackages() { case "$os" in - "Linux" | "iPhone OS") + "Linux" | "iPhone OS" | "Solaris") type -p pacman >/dev/null 2>&1 && \ packages="$(pacman -Qq --color never | wc -l)" @@ -367,6 +367,7 @@ getpackages() { type -p pkg >/dev/null 2>&1 && \ packages="$((packages+=$(ls -1 /var/db/pkg | wc -l)))" + [ "$packages" == "0" ] && packages="$((packages+=$(pkg list | wc -l)))" type -p emerge >/dev/null 2>&1 && \ packages="$((packages+=$(ls -d /var/db/pkg/*/* | wc -l)))" @@ -426,10 +427,6 @@ getpackages() { [ -d "/cygdrive/c/ProgramData/chocolatey/lib" ] && \ packages="$((packages+=$(ls -1 /cygdrive/c/ProgramData/chocolatey/lib | wc -l)))" ;; - - "Solaris") - packages="$(pkg list | wc -l)" - ;; esac } From 24e7216777841a7942e0ef7a236792d648c2740a Mon Sep 17 00:00:00 2001 From: Muhammad Herdiansyah Date: Sun, 23 Oct 2016 18:41:22 +0700 Subject: [PATCH 27/54] Solaris: Strip out crap from getdistro output --- neofetch | 1 + 1 file changed, 1 insertion(+) diff --git a/neofetch b/neofetch index 87830da8..d9dba1b3 100755 --- a/neofetch +++ b/neofetch @@ -233,6 +233,7 @@ getdistro() { "on" | "tiny") distro="$(awk 'NR==1{print $1 " " $2;}' /etc/release)" ;; *) distro="$(awk 'NR==1{print $1 " " $2 " " $3;}' /etc/release)" ;; esac + distro="${distro/\(*}" ;; esac From bb3ffbbeb881349f2ceedc30d9038c0df34d6a13 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 24 Oct 2016 08:49:13 +1100 Subject: [PATCH 28/54] Remove old config option --- config/config | 5 ----- 1 file changed, 5 deletions(-) diff --git a/config/config b/config/config index 80271b8a..eeecf851 100644 --- a/config/config +++ b/config/config @@ -320,11 +320,6 @@ thumbnail_dir="$HOME/.cache/thumbnails/neofetch" # Some systems have this in another location 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 normal, fit, fill crop_mode="normal" From c869e81e3b7bc8d6a74d775d966ac03ef710d769 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 24 Oct 2016 08:53:54 +1100 Subject: [PATCH 29/54] Fix w3m-img being used even when images were off --- neofetch | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/neofetch b/neofetch index d9dba1b3..926b469a 100755 --- a/neofetch +++ b/neofetch @@ -3381,11 +3381,15 @@ main() { # Print the info printinfo - [ "$image" != "off" ] && dynamicprompt - # w3m-img: Draw the image a second time to fix - # rendering issues in specific terminal emulators. - [ "$image_backend" == "w3m" ] && displayimage + # Prompt calculation + if [ "$image" != "off" ]; then + dynamicprompt + + # w3m-img: Draw the image a second time to fix + # rendering issues in specific terminal emulators. + [ "$image_backend" == "w3m" ] && displayimage + fi # Re-enable line wrap printf "%b%s" "\033[?7h" From e92e691751b6b8adc40a2af2efe682d5af74a983 Mon Sep 17 00:00:00 2001 From: Muhammad Herdiansyah Date: Mon, 24 Oct 2016 21:53:13 +0700 Subject: [PATCH 30/54] SUSE: Changed ASCII behavior In SUSE's `lsb_release`, they have different behavior for `-ir` and `-d`, one output will be `openSUSE Leap 42.1` and the other will be `SUSE LINUX 42.1`. This new behavior would also extend compatibility with SUSE Linux Enterprise. --- ascii/distro/{opensuse => suse} | 0 neofetch | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename ascii/distro/{opensuse => suse} (100%) diff --git a/ascii/distro/opensuse b/ascii/distro/suse similarity index 100% rename from ascii/distro/opensuse rename to ascii/distro/suse diff --git a/neofetch b/neofetch index 926b469a..713ef412 100755 --- a/neofetch +++ b/neofetch @@ -2616,7 +2616,7 @@ colors() { setcolors 3 7 6 1 8 ;; - "OpenSuse"* | "Manjaro"* | "Deepin"*) + *"SUSE"* | "Manjaro"* | "Deepin"*) setcolors 2 7 ;; From 192014ca9f333995486b7e620de51b98d4f3a7ec Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Tue, 25 Oct 2016 10:25:10 +1100 Subject: [PATCH 31/54] Model: Remove useless use of cat --- neofetch | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/neofetch b/neofetch index 713ef412..467950cd 100755 --- a/neofetch +++ b/neofetch @@ -43,7 +43,8 @@ getmodel() { "Linux") if [ -f /sys/devices/virtual/dmi/id/product_name ] ||\ [ -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*}" elif [ -f /sys/firmware/devicetree/base/model ]; then From ab1de702f9776ac8e2fce9a497e4db7599cea7ae Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Tue, 25 Oct 2016 10:30:41 +1100 Subject: [PATCH 32/54] Distro: Simplify shorthand for lsb_release --- neofetch | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/neofetch b/neofetch index 467950cd..214fb195 100755 --- a/neofetch +++ b/neofetch @@ -131,10 +131,11 @@ getdistro() { elif type -p lsb_release >/dev/null 2>&1; then case "$distro_shorthand" in - "on") distro="$(lsb_release -sir 2>/dev/null)" ;; - "tiny") distro="$(lsb_release -si 2>/dev/null)" ;; - *) distro="$(lsb_release -sd 2>/dev/null)" ;; + "on") lsb_flags="-sir" ;; + "tiny") lsb_flags="-si" ;; + *) lsb_flags="-sd" ;; esac + distro="$(lsb_release $lsb_flags 2>/dev/null)" elif type -p guix >/dev/null 2>&1; then distro="GuixSD" From cc9095ccd5bcd31383fb51d754cd998d118e16d6 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Tue, 25 Oct 2016 10:39:56 +1100 Subject: [PATCH 33/54] Refactor GPU --- neofetch | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/neofetch b/neofetch index 214fb195..bd2f45b7 100755 --- a/neofetch +++ b/neofetch @@ -987,12 +987,12 @@ getcpu_usage() { getgpu() { case "$os" in "Linux") - gpu="$(PATH="/sbin:$PATH" lspci | grep -F "3D")" + gpu="$(PATH="/sbin:$PATH" lspci -mm | awk -F '\\"|\\" \\"' '/3D|VGA/ {print $3 " " $4}')" # If a GPU with a prefix of '3D' doesn't exist # fallback to looking for a prefix of 'VGA' - [ -z "$gpu" ] && \ - gpu="$(PATH="/sbin:$PATH" lspci | grep -F "VGA")" + # [ -z "$gpu" ] && \ + # gpu="$(PATH="/sbin:$PATH" lspci | grep -F "VGA")" gpu="${gpu//??':'??'.'?}" @@ -2427,7 +2427,7 @@ info() { eval output="\$${1}" else - "get$2" 2>/dev/null + time "get$2" 2>/dev/null eval output="\$${2}" fi From fa312af1ee0057f09af6e661ea34fdaf513cc478 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Wed, 26 Oct 2016 11:18:37 +1100 Subject: [PATCH 34/54] Misc fixes/changes --- neofetch | 135 ++++++++++--------------------------------------------- 1 file changed, 24 insertions(+), 111 deletions(-) diff --git a/neofetch b/neofetch index 214fb195..0249656a 100755 --- a/neofetch +++ b/neofetch @@ -368,9 +368,10 @@ getpackages() { type -p pisi >/dev/null 2>&1 && \ 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" == "0" ] && packages="$((packages+=$(pkg list | wc -l)))" + fi type -p emerge >/dev/null 2>&1 && \ packages="$((packages+=$(ls -d /var/db/pkg/*/* | wc -l)))" @@ -530,12 +531,7 @@ getwm() { "Windows") wm="$(tasklist | grep -m 1 -o "bugn\|Windawesome\|blackbox\|emerge\|litestep")" [ "$wm" == "blackbox" ] && wm="bbLean (Blackbox)" - - if [ "$wm" ]; then - wm="$wm, Explorer" - else - wm="Explorer" - fi + wm="${wm:+$wm, }Explorer" ;; esac fi @@ -746,110 +742,27 @@ getcpu() { "iPhone OS") case "${ios_model:-$(uname -m)}" in - "iPhone1,1" | "iPhone1,2" | "iPod1,1") - cpu="Samsung S5L8900 @ 412MHz" - cores="1" - ;; - - "iPhone2,1") - cpu="Samsung S5PC100 @ 600MHz" - cores="1" - ;; - - "iPhone3,1" | "iPhone3,2" | "iPhone3,3" | "iPod4,1") - cpu="Apple A4 @ 800MHz" - cores="1" - ;; - - "iPhone4,1" | "iPod5,1") - cpu="Apple A5 @ 800MHz" - cores="2" - ;; - - "iPhone5,1" | "iPhone5,2" | "iPhone5,3" | "iPhone5,4") - 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" - ;; + "iPhone1,"[1-2] | "iPod1,1") cpu="Samsung S5L8900 (1) @ 412MHz" ;; + "iPhone2,1") cpu="Samsung S5PC100 (1) @ 600MHz" ;; + "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" ;; + "iPhone6,"[1-2]) cpu="Apple A7 (2) @ 1.3GHz" ;; + "iPhone7,"[1-2]) cpu="Apple A8 (2) @ 1.4GHz" ;; + "iPhone8,"[1-4]) cpu="Apple A9 (2) @ 1.85GHz" ;; + "iPod2,1") cpu="Samsung S5L8720 (1) @ 533MHz" ;; + "iPod3,1") cpu="Samsung S5L8922 (1) @ 600MHz" ;; + "iPod7,1") cpu="Apple A8 (2) @ 1.1GHz" ;; + "iPad1,1") cpu="Apple A4 (1) @ 1GHz" ;; + "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" ;; + "iPad4,"[1-3]) cpu="Apple A7 (2) @ 1.4GHz" ;; + "iPad4,"[4-9]) cpu="Apple A7 (2) @ 1.4GHz" ;; + "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" ;; + "iPad6,"[7-8]) cpu="Apple A9X (2) @ 2.26GHz" ;; esac ;; From 252d56ab498220e3ddad3a564278169d09d7c606 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Wed, 26 Oct 2016 11:29:46 +1100 Subject: [PATCH 35/54] Reduce sise of iOS GPU function --- neofetch | 45 ++++++++++++--------------------------------- 1 file changed, 12 insertions(+), 33 deletions(-) diff --git a/neofetch b/neofetch index 0249656a..d3350931 100755 --- a/neofetch +++ b/neofetch @@ -974,55 +974,34 @@ getgpu() { ;; "iPhone OS") - ios_model="${ios_model:-"$(uname -m)"}" - case "$ios_model" in - "iPhone1,1" | "iPhone1,2") - gpu="PowerVR MBX Lite 3D" - ;; + case "${ios_model:-"$(uname -m)"}" in + "iPhone1,"[1-2]) gpu="PowerVR MBX Lite 3D" ;; + "iPhone5,"[1-4]) gpu="PowerVR SGX543MP3" ;; + "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" ;; - "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" ;; - "iPhone5,1" | "iPhone5,2" | "iPhone5,3" | "iPhone5,4") - 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") + "iPhone6,"[1-2] | "iPad4,"[1-9]) gpu="PowerVR G6430" ;; - "iPhone7,1" | "iPhone7,2" | "iPod7,1" | "iPad5,1" | "iPad5,2") + "iPhone7,"[1-2] | "iPod7,1" | "iPad5,"[1-2]) gpu="PowerVR GX6450" ;; - "iPhone8,1" | "iPhone8,2" | "iPhone8,4") - gpu="PowerVR GT7600" - ;; - "iPod1,1" | "iPod2,1") 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 ;; From bc906abb4e0eb3a725705d4e28bf534d02ed52c9 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Wed, 26 Oct 2016 15:17:31 +1100 Subject: [PATCH 36/54] Update Changelog.md --- Changelog.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Changelog.md b/Changelog.md index 25887c6c..d3f58a5e 100644 --- a/Changelog.md +++ b/Changelog.md @@ -104,6 +104,11 @@ Note: `\033[14t` is still supported, if images already work for you then you don - 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)** +- [iOS] Rewrite CPU function. + +**GPU** + +- [iOS] Rewrite GPU function. **Uptime**
From efa55b28b0887c7bc5b08a4d7dc688cc4c475178 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Wed, 26 Oct 2016 15:18:11 +1100 Subject: [PATCH 37/54] Rewrite getsong --- neofetch | 135 ++++++++++++++++++++++++++++++------------------------- 1 file changed, 74 insertions(+), 61 deletions(-) diff --git a/neofetch b/neofetch index d3350931..dd03065b 100755 --- a/neofetch +++ b/neofetch @@ -1120,79 +1120,92 @@ getmemory() { # Song {{{ getsong() { - if mpc version >/dev/null 2>&1; then - song="$(mpc current 2>/dev/null)" - state="$(mpc | awk -F '\\[|\\]' '/\[/ {printf $2}' 2>/dev/null)" + player="$(ps x | awk '!(/awk|Helper|Cache/) && /mpd|cmus|mocp|spotify|Google Play|iTunes.app|rhythmbox|banshee|amarok|deadbeef|audacious/ {printf $5 " " $6; exit}')" - elif [ -n "$(ps x | awk '!(/awk/) && /cmus/')" ]; then - IFS=$'\n' - song=($(cmus-remote -Q | grep "tag artist \|tag title \|status" 2>/dev/null | sort)) - state="${song[0]/status }" - artist="${song[1]/tag artist }" - title="${song[2]/tag title }" - song="${artist/tag title } - ${title/tag artist }" + case "$player" in + "mpd"*) + song="$(mpc current 2>/dev/null)" + state="$(mpc | awk -F '\\[|\\]' '/\[/ {printf $2}' 2>/dev/null)" + ;; - elif pgrep "mocp" >/dev/null 2>&1; then - song="$(mocp -Q "%artist - %song" 2>/dev/null)" - state="$(mocp -Q "%state" 2>/dev/null)" + "cmus"*) + IFS=$'\n' + song=($(cmus-remote -Q | grep "tag artist \|tag title \|status" 2>/dev/null | sort)) + state="${song[0]/status }" + artist="${song[1]/tag artist }" + title="${song[2]/tag title }" + song="${artist/tag title } - ${title/tag artist }" + ;; - elif [ -n "$(ps x | awk '!(/awk/) && /spotify/')" ]; then - case "$os" in - "Linux") - # This command is way too long - song="$(\ - dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /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="${song/'('*}" - song="${song//'['*}" - ;; + "mocp"*) + song="$(mocp -Q "%artist - %song" 2>/dev/null)" + state="$(mocp -Q "%state" 2>/dev/null)" + ;; - "Mac OS X") - song="$(osascript -e 'tell application "Spotify" to artist of current track as string & " - " & name of current track as string')" - state="$(osascript -e 'tell application "Spotify" to player state as string')" - ;; - esac + "spotify"*) + case "$os" in + "Linux") + # Thanks dbus + song="$(\ + dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /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="${song/'('*}" + song="${song//'['*}" + ;; - elif [ -n "$(ps x | awk '!(/awk/ || /Helper/) && /Google Play Music Desktop Player/')" ] && type -p gpmdp-remote >/dev/null 2>&1; then - song="$(gpmdp-remote current)" - state="$(gpmdp-remote status)" + "Mac OS X") + song="$(osascript -e 'tell application "Spotify" to artist of current track as string & " - " & name of current track as string')" + state="$(osascript -e 'tell application "Spotify" to player state as string')" + ;; + esac + ;; - elif [ -n "$(ps x | awk '!(/awk/ || /Helper/ || /Cache/) && /iTunes.app/')" ]; then - 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')" + "google play"*) + song="$(gpmdp-remote current 2>/dev/null)" + state="$(gpmdp-remote status 2>/dev/null)" + ;; - elif [ -n "$(ps x | awk '!(/awk/) && /rhythmbox/')" ]; then - song="$(rhythmbox-client --print-playing)" - # Well, what can you expect? It's dbus after all. - 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' |\ - awk -F 'string "' '{printf $2}')" - state="${state//\"}" + "itunes.app"*) + 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')" + ;; - elif [ -n "$(ps x | awk '!(/awk/) && /banshee/')" ]; then - artist="$(banshee --query-artist | awk -F':' '{print $2}')" - title="$(banshee --query-title | awk -F':' '{print $2}')" - song="$artist - $title" - state="$(banshee --query-current-state | awk -F':' '{print $2}')" + "rhythmbox"*) + song="$(rhythmbox-client --print-playing)" + # Well, what can you expect? It's dbus after all. + 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' |\ + awk -F 'string "' '{printf $2}')" + state="${state//\"}" + ;; - elif [ -n "$(ps x | awk '!(/awk/) && /amarok/')" ]; then - artist="$(qdbus org.kde.amarok /Player GetMetadata | awk -F':' '/^artist/ {print $2}')" - title="$(qdbus org.kde.amarok /Player GetMetadata | awk -F':' '/title/ {print $2}')" - song="$artist - $title" + "banshee"*) + artist="$(banshee --query-artist | awk -F':' '{print $2}')" + title="$(banshee --query-title | awk -F':' '{print $2}')" + song="$artist - $title" + state="$(banshee --query-current-state | awk -F':' '{print $2}')" + ;; - elif [ -n "$(ps x | awk '!(/awk/) && /deadbeef/')" ]; then - song="$(deadbeef --nowplaying '%a - %t')" + "amarok"*) + artist="$(qdbus org.kde.amarok /Player GetMetadata | awk -F':' '/^artist/ {print $2}')" + title="$(qdbus org.kde.amarok /Player GetMetadata | awk -F':' '/title/ {print $2}')" + song="$artist - $title" + ;; - elif [ -n "$(ps x | awk '!(/awk/) && /audacious/')" ]; then - song="$(audtool current-song)" + "deadbeef"*) + song="$(deadbeef --nowplaying '%a - %t')" + ;; - else - song="Not Playing" - fi + "audacious"*) + song="$(audtool current-song)" + ;; + + *) song="Not Playing" ;; + esac case "$state" in "paused" | "PAUSE" | "Paused") From 931660d31aabc888a3488242f00e54e44c121085 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Wed, 26 Oct 2016 15:38:45 +1100 Subject: [PATCH 38/54] Remove pointless if " --- neofetch | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/neofetch b/neofetch index d3350931..a1d49fff 100755 --- a/neofetch +++ b/neofetch @@ -2294,11 +2294,7 @@ scrot_upload() { ;; esac - if [ "$image_url" ]; then - printf "%s\n" "$image_url" - else - printf "%s\n" "[!] Image failed to upload" - fi + printf "%s\n" "${image_url:-'[!] Image failed to upload'}" } # }}} From b23ccd6709310c7b643cb6e1e8e7970dd707df2f Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Wed, 26 Oct 2016 17:56:50 +1100 Subject: [PATCH 39/54] Battery: [Linux] Rewrite battery --- neofetch | 51 ++++++++++++++++----------------------------------- 1 file changed, 16 insertions(+), 35 deletions(-) diff --git a/neofetch b/neofetch index a1d49fff..44061111 100755 --- a/neofetch +++ b/neofetch @@ -1618,44 +1618,25 @@ getdisk() { getbattery() { case "$os" in "Linux") - if [ "$(ls /sys/class/power_supply/)" ]; then - # Set the index to the battery number. - case "$battery_num" in - "all") battery_num="*" index=0 ;; - *) index="$battery_num" ;; - esac + # We use 'prin' here and exit the function early so that we can + # do multi battery support with a single battery per line. + if [ -f /sys/class/power_supply/**/capacity ]; then + for bat in "/sys/class/power_supply/BAT"*; do + capacity="$(< ${bat}/capacity)" + status="$(< ${bat}/status)" + battery="${capacity}% [${status}]" - batteries=("$(cat /sys/class/power_supply/BAT$battery_num/capacity)") - battery_state=("$(cat /sys/class/power_supply/BAT${battery_num}/status)") + case "$battery_display" in + "bar") battery="$(bar "$capacity" 100)" ;; + "infobar") battery+=" $(bar "$capacity" 100)" ;; + "barinfo") battery="$(bar "$capacity" 100) ${battery}" ;; + 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 - "bar") prin "${title}${index:-0}" "$(bar "${bat/'%'}" 100)" ;; - "infobar") prin "${title}${index:-0}" "${bat}% $(bar "${bat/'%'}" 100)" ;; - "barinfo") prin "${title}${index:-0}" "$(bar "${bat/'%'}" 100) ${bat}%" ;; - *) prin "${title}${index:-0}" "${bat}%" ;; - esac - index="$((index+=1))" - done - return - fi - battery="${batteries[0]}%" - fi + prin "${subtitle}${bat: -1}" "$battery" + done fi + unset battery + return ;; "BSD") From 72de6686416f5e43062cf876676a0757284a74ff Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Wed, 26 Oct 2016 17:59:03 +1100 Subject: [PATCH 40/54] Battery: [Linux] Remove old options --- config/config | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/config/config b/config/config index eeecf851..7390acac 100644 --- a/config/config +++ b/config/config @@ -161,21 +161,6 @@ gtk2="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 # Website to ping for the public IP From 6c5eb6a7ae718cc243430d0404acd938f9627a2b Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Wed, 26 Oct 2016 18:08:35 +1100 Subject: [PATCH 41/54] Changelog --- Changelog.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Changelog.md b/Changelog.md index d3f58a5e..f22a190b 100644 --- a/Changelog.md +++ b/Changelog.md @@ -13,7 +13,7 @@ - Change all `OS X` references to `macOS`. **[@iandrewt](https://github.com/iandrewt)** - Fix corrupted text when long lines are cut-off. - Don't dynamically place prompt in `image=off` mode. -- Cursor Position: Fix issues when using URxvt+Padding +- Cursor Position: Fix issues when using URxvt+Padding ## Operating System @@ -129,6 +129,12 @@ Note: `\033[14t` is still supported, if images already work for you then you don - Hide shell path by default. - Show shell version by default. +**Battery**
+ +- [Linux] Rewrote and simplified battery function. +- Removed `battery_shorthand` +- Removed `battery_num` + **Theme Font**
- [XFCE] Fixed incorrect font output. From 0c41c285a76e068f7632cfe1e31c3486368a4252 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Wed, 26 Oct 2016 18:09:59 +1100 Subject: [PATCH 42/54] Fix processes with paths in name' --- neofetch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neofetch b/neofetch index dd03065b..99b0e665 100755 --- a/neofetch +++ b/neofetch @@ -1122,7 +1122,7 @@ getmemory() { getsong() { 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 + case "${player/*\/}" in "mpd"*) song="$(mpc current 2>/dev/null)" state="$(mpc | awk -F '\\[|\\]' '/\[/ {printf $2}' 2>/dev/null)" From 43ac9dfcb247a6f0233de03fa647af4f7e16dfa2 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Wed, 26 Oct 2016 18:22:08 +1100 Subject: [PATCH 43/54] Docs --- neofetch | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/neofetch b/neofetch index 99b0e665..f133a273 100755 --- a/neofetch +++ b/neofetch @@ -1120,6 +1120,7 @@ getmemory() { # Song {{{ getsong() { + # 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 @@ -1176,7 +1177,7 @@ getsong() { "rhythmbox"*) 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 \ org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string: 'PlayBackStatus' |\ awk -F 'string "' '{printf $2}')" From bf67d5be11b9c594548c1c981eba719262eae26d Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Wed, 26 Oct 2016 18:23:15 +1100 Subject: [PATCH 44/54] Docs: Remove battery options --- README.md | 2 -- neofetch | 4 ---- neofetch.1 | 6 ------ 3 files changed, 12 deletions(-) diff --git a/README.md b/README.md index 04352c52..33e3f53b 100644 --- a/README.md +++ b/README.md @@ -450,8 +450,6 @@ alias neofetch2="neofetch \ --gtk3 on/off Enable/Disable gtk3 theme/icons output --shell_path on/off Enable/Disable showing \$SHELL path --shell_version on/off Enable/Disable showing \$SHELL version - --battery_num num Which battery to display, default value is 'all' - --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 --birthday_shorthand on/off Shorten the output of birthday diff --git a/neofetch b/neofetch index 44061111..9a05dd07 100755 --- a/neofetch +++ b/neofetch @@ -2913,8 +2913,6 @@ usage() { cat << EOF --gtk3 on/off Enable/Disable gtk3 theme/icons output --shell_path on/off Enable/Disable showing \$SHELL path --shell_version on/off Enable/Disable showing \$SHELL version - --battery_num num Which battery to display, default value is 'all' - --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 --birthday_shorthand on/off Shorten the output of birthday @@ -3042,8 +3040,6 @@ getargs() { --gtk3) gtk3="$2" ;; --shell_path) shell_path="$2" ;; --shell_version) shell_version="$2" ;; - --battery_num) battery_num="$2" ;; - --battery_shorthand) battery_shorthand="$2" ;; --ip_host) public_ip_host="$2" ;; --song_shorthand) song_shorthand="$2" ;; --birthday_shorthand) birthday_shorthand="$2" ;; diff --git a/neofetch.1 b/neofetch.1 index 5fa7c980..8d67bbcc 100644 --- a/neofetch.1 +++ b/neofetch.1 @@ -85,12 +85,6 @@ Enable/Disable showing $SHELL path .B \--shell_version 'on/off' Enable/Disable showing $SHELL version .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' URL to ping for public IP .TP From 314c2547943c469a0f4e1e96b0636fbe17516237 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Wed, 26 Oct 2016 18:24:37 +1100 Subject: [PATCH 45/54] Docs: misc --- README.md | 2 +- neofetch | 2 +- neofetch.1 | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 33e3f53b..ebda0ac8 100644 --- a/README.md +++ b/README.md @@ -450,7 +450,7 @@ alias neofetch2="neofetch \ --gtk3 on/off Enable/Disable gtk3 theme/icons output --shell_path on/off Enable/Disable showing \$SHELL path --shell_version on/off Enable/Disable showing \$SHELL version - --ip_host url Url to ping for public IP + --ip_host url Url to query for public IP --song_shorthand on/off Print the Artist/Title on seperate lines --birthday_shorthand on/off Shorten the output of birthday --birthday_time on/off Enable/Disable showing the time in birthday output diff --git a/neofetch b/neofetch index 9a05dd07..56260203 100755 --- a/neofetch +++ b/neofetch @@ -2913,7 +2913,7 @@ usage() { cat << EOF --gtk3 on/off Enable/Disable gtk3 theme/icons output --shell_path on/off Enable/Disable showing \$SHELL path --shell_version on/off Enable/Disable showing \$SHELL version - --ip_host url Url to ping for public IP + --ip_host url Url to query for public IP --song_shorthand on/off Print the Artist/Title on seperate lines --birthday_shorthand on/off Shorten the output of birthday --birthday_time on/off Enable/Disable showing the time in birthday output diff --git a/neofetch.1 b/neofetch.1 index 8d67bbcc..c32cd182 100644 --- a/neofetch.1 +++ b/neofetch.1 @@ -86,7 +86,7 @@ Enable/Disable showing $SHELL path Enable/Disable showing $SHELL version .TP .B \--ip_host 'url' -URL to ping for public IP +URL to query for public IP .TP .B \--song_shorthand 'on/off' Print the Artist/Title on seperate lines From 9889ba14cbc938162ba4036a2e2ee4451f5f1dcd Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Wed, 26 Oct 2016 21:04:58 +1100 Subject: [PATCH 46/54] Song: Fix iTunes --- neofetch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neofetch b/neofetch index f133a273..b9bb8986 100755 --- a/neofetch +++ b/neofetch @@ -1121,7 +1121,7 @@ getmemory() { getsong() { # 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|rhythmbox|banshee|amarok|deadbeef|audacious/ {printf $5 " " $6; exit}')" case "${player/*\/}" in "mpd"*) From 6f41167eb5034d211ee17ca6625dd6b973e14596 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Wed, 26 Oct 2016 21:18:46 +1100 Subject: [PATCH 47/54] Song: Fix iTunes 2 --- neofetch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/neofetch b/neofetch index b9bb8986..6cb7e3bf 100755 --- a/neofetch +++ b/neofetch @@ -1121,7 +1121,7 @@ getmemory() { getsong() { # This is absurdly long. - player="$(ps x | awk '!(/awk|Helper|Cache/) && /mpd|cmus|mocp|spotify|Google Play|iTunes|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/ {printf $5 " " $6; exit}')" case "${player/*\/}" in "mpd"*) @@ -1170,7 +1170,7 @@ getsong() { state="$(gpmdp-remote status 2>/dev/null)" ;; - "itunes.app"*) + "itunes"*) 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')" ;; From df93b8cff1cc419f1fd7a0e3d52c080440666d76 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Wed, 26 Oct 2016 21:24:06 +1100 Subject: [PATCH 48/54] Changelog --- Changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/Changelog.md b/Changelog.md index f22a190b..bd799920 100644 --- a/Changelog.md +++ b/Changelog.md @@ -155,3 +155,4 @@ Note: `\033[14t` is still supported, if images already work for you then you don - [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. From 0177837f69c02d31e41d98be20798f91149266d4 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Wed, 26 Oct 2016 22:48:20 +1100 Subject: [PATCH 49/54] GPU: Start rewrite --- neofetch | 56 +++++++------------------------------------------------- 1 file changed, 7 insertions(+), 49 deletions(-) diff --git a/neofetch b/neofetch index bd2f45b7..204e932e 100755 --- a/neofetch +++ b/neofetch @@ -989,63 +989,25 @@ getgpu() { "Linux") gpu="$(PATH="/sbin:$PATH" lspci -mm | awk -F '\\"|\\" \\"' '/3D|VGA/ {print $3 " " $4}')" - # If a GPU with a prefix of '3D' doesn't exist - # 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 - unset count - fi - - # Format the output - gpu="${gpu/* VGA compatible controller: }" - gpu="${gpu/* 3D controller: }" - gpu="${gpu/(rev*)}" - gpu="${gpu/\[}" - gpu="${gpu/\]}" - case "$gpu" in - intel*) - gpu="Intel Integrated Graphics" - ;; + intel*) gpu="Intel Integrated Graphics" ;; advanced*) - gpu="${gpu/Advanced Micro Devices, Inc\. }" gpu="${gpu/'[AMD/ATI]' }" - gpu="${gpu/Tahiti PRO}" - gpu="${gpu/XTX}" - gpu="${gpu/ OEM}" - gpu="${gpu/*Radeon/Radeon}" - - brand="AMD " + gpu="${gpu/'[AMD]' }" + gpu="${gpu/*\[}" + gpu="${gpu/\]*}" ;; nvidia*) - gpu="${gpu/NVIDIA Corporation }" - gpu="${gpu/G????M }" - gpu="${gpu/G???? }" - - brand="NVIDIA " + gpu="${gpu/*\[}" + gpu="${gpu/\]*}" ;; *virtualbox*) gpu="VirtualBox Graphics Adapter" ;; esac - - gpu="${brand}${gpu}" ;; "Mac OS X") @@ -1137,11 +1099,7 @@ getgpu() { 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/\/*}" @@ -2427,7 +2385,7 @@ info() { eval output="\$${1}" else - time "get$2" 2>/dev/null + "get$2" 2>/dev/null eval output="\$${2}" fi From b2d17711f97b7a19d4c7aacf9e1c09c98914ad0b Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Wed, 26 Oct 2016 23:16:57 +1100 Subject: [PATCH 50/54] GPU: Add brand --- neofetch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/neofetch b/neofetch index 204e932e..2c3b5f0b 100755 --- a/neofetch +++ b/neofetch @@ -997,11 +997,13 @@ getgpu() { gpu="${gpu/'[AMD]' }" gpu="${gpu/*\[}" gpu="${gpu/\]*}" + gpu="AMD $gpu" ;; nvidia*) gpu="${gpu/*\[}" gpu="${gpu/\]*}" + gpu="NVIDIA $gpu" ;; *virtualbox*) @@ -1119,8 +1121,6 @@ getgpu() { gpu="${gpu/NVIDIA}" gpu="${gpu/Intel}" fi - - gpu="${gpu}${count}" } # }}} From 4e7955bc94bbcb259f0d85f0951eeb4783960544 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Wed, 26 Oct 2016 23:22:08 +1100 Subject: [PATCH 51/54] Cache GPU output --- neofetch | 44 +++++++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/neofetch b/neofetch index 2c3b5f0b..7675029d 100755 --- a/neofetch +++ b/neofetch @@ -987,29 +987,35 @@ getcpu_usage() { getgpu() { case "$os" in "Linux") - gpu="$(PATH="/sbin:$PATH" lspci -mm | awk -F '\\"|\\" \\"' '/3D|VGA/ {print $3 " " $4}')" + # Use cache if it exists + if [ -f "/tmp/neofetch/gpu" ]; then + source "/tmp/neofetch/gpu" + else + gpu="$(PATH="/sbin:$PATH" lspci -mm | awk -F '\\"|\\" \\"' '/3D|VGA/ {print $3 " " $4}')" - case "$gpu" in - intel*) gpu="Intel Integrated Graphics" ;; + case "$gpu" in + intel*) gpu="Intel Integrated Graphics" ;; - advanced*) - gpu="${gpu/'[AMD/ATI]' }" - gpu="${gpu/'[AMD]' }" - gpu="${gpu/*\[}" - gpu="${gpu/\]*}" - gpu="AMD $gpu" - ;; + advanced*) + gpu="${gpu/'[AMD/ATI]' }" + gpu="${gpu/'[AMD]' }" + gpu="${gpu/*\[}" + gpu="${gpu/\]*}" + gpu="AMD $gpu" + ;; - nvidia*) - gpu="${gpu/*\[}" - gpu="${gpu/\]*}" - gpu="NVIDIA $gpu" - ;; + nvidia*) + gpu="${gpu/*\[}" + gpu="${gpu/\]*}" + gpu="NVIDIA $gpu" + ;; - *virtualbox*) - gpu="VirtualBox Graphics Adapter" - ;; - esac + *virtualbox*) + gpu="VirtualBox Graphics Adapter" + ;; + esac + cache "gpu" "$gpu" "/tmp" + fi ;; "Mac OS X") From 8cbf7e7febaf8f14f322c8c4fb6b3f63a4715bd1 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Wed, 26 Oct 2016 23:41:17 +1100 Subject: [PATCH 52/54] Remove GPU shorthand --- README.md | 1 - config/config | 4 ---- neofetch | 21 +-------------------- neofetch.1 | 3 --- 4 files changed, 1 insertion(+), 28 deletions(-) diff --git a/README.md b/README.md index 04352c52..b24fddeb 100644 --- a/README.md +++ b/README.md @@ -443,7 +443,6 @@ alias neofetch2="neofetch \ --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 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) --gtk_shorthand on/off Shorten output of gtk theme/icons --gtk2 on/off Enable/Disable gtk2 theme/icons output diff --git a/config/config b/config/config index eeecf851..c02fb537 100644 --- a/config/config +++ b/config/config @@ -128,10 +128,6 @@ cpu_temp="off" # GPU -# Shorten output of the getgpu funcion -# --gpu_shorthand on, off, tiny -gpu_shorthand="on" - # Enable/Disable GPU Brand # --gpu_brand on, off gpu_brand="on" diff --git a/neofetch b/neofetch index 7675029d..baa1279e 100755 --- a/neofetch +++ b/neofetch @@ -1001,6 +1001,7 @@ getgpu() { gpu="${gpu/'[AMD]' }" gpu="${gpu/*\[}" gpu="${gpu/\]*}" + gpu="${gpu/\/*}" gpu="AMD $gpu" ;; @@ -1104,24 +1105,6 @@ getgpu() { ;; esac - case "$gpu_shorthand" in - "on" | "tiny") - gpu="${gpu// Rev\. ?}" - gpu="${gpu// OEM}" - 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 gpu="${gpu/AMD}" gpu="${gpu/NVIDIA}" @@ -3001,7 +2984,6 @@ usage() { cat << EOF --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 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) --gtk_shorthand on/off Shorten output of gtk theme/icons --gtk2 on/off Enable/Disable gtk2 theme/icons output @@ -3129,7 +3111,6 @@ getargs() { --kernel_shorthand) kernel_shorthand="$2" ;; --uptime_shorthand) uptime_shorthand="$2" ;; --cpu_shorthand) cpu_shorthand="$2" ;; - --gpu_shorthand) gpu_shorthand="$2" ;; --gpu_brand) gpu_brand="$2" ;; --refresh_rate) refresh_rate="$2" ;; --gtk_shorthand) gtk_shorthand="$2" ;; diff --git a/neofetch.1 b/neofetch.1 index 5fa7c980..d69fbe20 100644 --- a/neofetch.1 +++ b/neofetch.1 @@ -64,9 +64,6 @@ Whether to display the refresh rate of each monitor .br Note: Unsupported on Windows .TP -.B \--gpu_shorthand 'on/off' -Shorten the output of GPU (tiny, on, off) -.TP .B \--gpu_brand on/off Enable/Disable GPU brand in output. (AMD/NVIDIA/Intel) .TP From 64b8e02812c2c10741e8c72c1559644eb9d5dadc Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Wed, 26 Oct 2016 23:50:54 +1100 Subject: [PATCH 53/54] Fix --- neofetch | 1 + 1 file changed, 1 insertion(+) diff --git a/neofetch b/neofetch index baa1279e..0a2befc4 100755 --- a/neofetch +++ b/neofetch @@ -3190,6 +3190,7 @@ getargs() { --clean) rm -rf "$thumbnail_dir" rm -rf "/Library/Caches/neofetch/" + rm -rf "/tmp/neofetch/" exit ;; From 466e92b2d4608858930e6212c65c4eba5ed5f3ca Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Wed, 26 Oct 2016 23:54:46 +1100 Subject: [PATCH 54/54] Changelog --- Changelog.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Changelog.md b/Changelog.md index bd799920..130ed372 100644 --- a/Changelog.md +++ b/Changelog.md @@ -109,6 +109,8 @@ Note: `\033[14t` is still supported, if images already work for you then you don **GPU** - [iOS] Rewrite GPU function. +- [Linux] Rewrite GPU function. + - Neofetch also caches the info until reboot. **Uptime**