This commit is contained in:
Dylan Araps 2016-06-14 17:02:29 +10:00
commit 517bde1ce3
5 changed files with 95 additions and 64 deletions

7
1.8.md
View file

@ -33,6 +33,7 @@ bottom of the window. See [#279](https://github.com/dylanaraps/neofetch/pull/279
### OS ### OS
- Added support for Devuan Linux. - Added support for Devuan Linux.
- Added support for macOS Sierra. **[@iandrewt](https://github.com/iandrewt)**
### Terminal and Terminal Font ### Terminal and Terminal Font
@ -76,6 +77,12 @@ block will be.
- [Cmus] The function now works on both OS X and Linux. - [Cmus] The function now works on both OS X and Linux.
- [iTunes] Fix song not displaying. **[@iandrewt](https://github.com/iandrewt)** - [iTunes] Fix song not displaying. **[@iandrewt](https://github.com/iandrewt)**
**CPU Usage**<br \>
- Fixed broken CPU usage output on BSD and Windows
- Fixed misleading output on Linux / Mac OS X
- Moved CPU Usage to its own dedicated function
### Image ### Image

View file

@ -173,15 +173,15 @@ https://github.com/dylanaraps/neofetch/wiki/Following-HEAD
### Gentoo / Funtoo ### Gentoo / Funtoo
1. Add the 3rd party repo 1. Add the 3rd party repo
- `layman -o https://gist.githubusercontent.com/z1lt0id/24d45b15800b98975260/raw/2fdf6645cdc3c1ca0b0af83a7bf8f86598e386ae/fs0ciety.xml -f -a fs0ciety` - `# wget https://git.io/vocNV -O /etc/portage/repos.conf/konimex.conf`
2. Sync the repos 2. Sync the repo
- `layman -S` - `# emerge --sync konimex`
3. To enable w3m and scrot support, enable the appropriate flags. 3. To enable additional features such as w3m and music support, enable the appropriate USE flags. For example:
- `echo "x11-apps/neofetch" >> /etc/portage/package.use` - `# echo "app-misc/neofetch X -moc" >> /etc/portage/package.use`
4. Install the package 4. Install the package
- `emerge -a x11-apps/neofetch` - `# emerge -a app-misc/neofetch`
There is also a git version available: `emerge --autounmask-write =x11-apps/neofetch-9999` To install the git version, just add `app-misc/neofetch ~<your architecture>` to `package.accept_keywords`
### CRUX ### CRUX
@ -389,8 +389,6 @@ alias fetch2="fetch \
--underline_char char Character to use when underlining title --underline_char char Character to use when underlining title
--line_wrap on/off Enable/Disable line wrapping --line_wrap on/off Enable/Disable line wrapping
--bold on/off Enable/Disable bold text --bold on/off Enable/Disable bold text
--prompt_height num Set this to your prompt height to fix issues with
the text going off screen at the top
Color Blocks: Color Blocks:
@ -407,15 +405,14 @@ alias fetch2="fetch \
--progress_length num Length in spaces to make the progress bars. --progress_length num Length in spaces to make the progress bars.
--progress_colors num num Colors to make the progress bar. --progress_colors num num Colors to make the progress bar.
Set in this order: elapsed, total Set in this order: elapsed, total
--cpu_display mode1 mode2 Which shorthand to use and how CPU usage should be printed --cpu_display mode Progress bar mode.
mode1 takes: name, speed, tiny, on, off Takes: bar, infobar, barinfo, off
mode2 takes: info, bar, infobar, barinfo --memory_display mode Progress bar mode.
--memory_display mode Which way should the memory progress bar be added Takes: bar, infobar, barinfo, off
Takes bar, infobar, barinfo --battery_display mode Progress bar mode.
--battery_display mode Which way should the battery progress bar be added Takes: bar, infobar, barinfo, off
Takes bar, infobar, barinfo --disk_display mode Progress bar mode.
--disk_display mode Which way should the disk progress bar be added Takes: bar, infobar, barinfo, off
Takes bar, infobar, barinfo, perc
Image: Image:

View file

@ -35,6 +35,7 @@ printinfo () {
info "GPU" gpu info "GPU" gpu
info "Memory" memory info "Memory" memory
# info "CPU Usage" cpu_usage
# info "Disk" disk # info "Disk" disk
# info "Battery" battery # info "Battery" battery
# info "Font" font # info "Font" font
@ -99,10 +100,14 @@ shell_version="off"
# scaling_current, scaling_min, scaling_max # scaling_current, scaling_min, scaling_max
speed_type="max" speed_type="max"
# CPU Display # CPU Shorthand
# Set shorthand setting and progress bar setting # Set shorthand setting
# --cpu_display (name, speed, tiny, on, off) (bar, infobar, barinfo, off) # --cpu_shorthand name, speed, tiny, on, off
cpu_shorthand="off" cpu_shorthand="off"
# CPU Usage display
# Set CPU usage display setting
# --cpu_display bar, infobar, barinfo, off
cpu_display="off" cpu_display="off"
# CPU Cores # CPU Cores

View file

@ -47,6 +47,7 @@ printinfo () {
info "GPU" gpu info "GPU" gpu
info "Memory" memory info "Memory" memory
# info "CPU Usage" cpu_usage
# info "Disk" disk # info "Disk" disk
# info "Battery" battery # info "Battery" battery
# info "Font" font # info "Font" font
@ -111,11 +112,10 @@ shell_version="off"
# scaling_current, scaling_min, scaling_max # scaling_current, scaling_min, scaling_max
speed_type="max" speed_type="max"
# CPU Display # CPU Shorthand
# Set shorthand setting and progress bar setting # Set shorthand setting
# --cpu_display (name, speed, tiny, on, off) (bar, infobar, barinfo, off) # --cpu_shorthand name, speed, tiny, on, off
cpu_shorthand="off" cpu_shorthand="off"
cpu_display="off"
# CPU Cores # CPU Cores
# Display CPU cores in output # Display CPU cores in output
@ -289,9 +289,11 @@ 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.
# #
# --cpu_display bar/infobar/barinfo/off
# --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
cpu_display="off"
memory_display="off" memory_display="off"
battery_display="off" battery_display="off"
disk_display="off" disk_display="off"
@ -481,6 +483,7 @@ getdistro () {
"10.9") codename="OS X Mavericks" ;; "10.9") codename="OS X Mavericks" ;;
"10.10") codename="OS X Yosemite" ;; "10.10") codename="OS X Yosemite" ;;
"10.11") codename="OS X El Capitan" ;; "10.11") codename="OS X El Capitan" ;;
"10.12") codename="macOS Sierra" ;;
*) codename="Mac OS X" ;; *) codename="Mac OS X" ;;
esac esac
distro="$codename $osx_version $osx_build" distro="$codename $osx_version $osx_build"
@ -1147,22 +1150,46 @@ getcpu () {
[ "$cpu" ] && prin "$subtitle" "$cpu" [ "$cpu" ] && prin "$subtitle" "$cpu"
if [ "$cpu_display" != "off" ]; then
cpu_usage="$(ps aux | awk 'BEGIN { sum = 0 } { sum += $3 }; END { print sum }')"
cpu_usage="${cpu_usage/\.*}%"
case "$cpu_display" in
"info") prin "$subtitle Usage" "$cpu_usage" ;;
"bar") prin "$subtitle Usage" "$(bar "${cpu_usage/'%'}" $(( 100 * cores )))" ;;
"infobar") prin "$subtitle Usage" "${cpu_usage} $(bar "${cpu_usage/'%'}" $(( 100 * cores )))" ;;
"barinfo") prin "$subtitle Usage" "$(bar "${cpu_usage/'%'}" $(( 100 * cores ))) $cpu_usage" ;;
esac
fi
[ "$stdout_mode" != "on" ] && unset cpu [ "$stdout_mode" != "on" ] && unset cpu
} }
# }}} # }}}
# CPU Usage {{{
getcpu_usage () {
case "$os" in
"Windows")
cpu_usage="$(wmic cpu get loadpercentage /value)"
cpu_usage="${cpu_usage/LoadPercentage'='}"
cpu_usage="${cpu_usage//[[:space:]]}"
;;
"Linux" | "Mac OS X" | "iPhone OS" | "BSD")
# Get cores if unset
if [ -z "$cores" ]; then
case "$os" in
"Linux") cores="$(awk -F ': ' '/siblings/ {printf $2; exit}' /proc/cpuinfo)" ;;
"Mac OS X" | "BSD") cores="$(sysctl -n hw.ncpu)" ;;
esac
fi
cpu_usage="$(ps aux | awk 'BEGIN {sum=0} {sum+=$3 }; END {print sum}')"
cpu_usage="$((${cpu_usage/\.*} / ${cores:-1}))"
;;
esac
# Print the bar
case "$cpu_display" in
"info") cpu_usage="${cpu_usage}%" ;;
"bar") cpu_usage="$(bar $cpu_usage 100)" ;;
"infobar") cpu_usage="${cpu_usage}% $(bar $cpu_usage 100)" ;;
"barinfo") cpu_usage="$(bar $cpu_usage 100) ${cpu_usage}%" ;;
esac
}
# }}}
# GPU {{{ # GPU {{{
getgpu () { getgpu () {
@ -2512,6 +2539,7 @@ stdout () {
*) *)
"get$func" 2>/dev/null "get$func" 2>/dev/null
eval output="\$$func" eval output="\$$func"
output="$(trim "$output")"
stdout+="${output}${stdout_separator}" stdout+="${output}${stdout_separator}"
;; ;;
esac esac
@ -2977,15 +3005,14 @@ usage () { cat << EOF
--progress_length num Length in spaces to make the progress bars. --progress_length num Length in spaces to make the progress bars.
--progress_colors num num Colors to make the progress bar. --progress_colors num num Colors to make the progress bar.
Set in this order: elapsed, total Set in this order: elapsed, total
--cpu_display mode1 mode2 Which shorthand to use and how CPU usage should be printed --cpu_display mode Progress bar mode.
mode1 takes: name, speed, tiny, on, off Takes: bar, infobar, barinfo, off
mode2 takes: info, bar, infobar, barinfo --memory_display mode Progress bar mode.
--memory_display mode Which way should the memory progress bar be added Takes: bar, infobar, barinfo, off
Takes bar, infobar, barinfo --battery_display mode Progress bar mode.
--battery_display mode Which way should the battery progress bar be added Takes: bar, infobar, barinfo, off
Takes bar, infobar, barinfo --disk_display mode Progress bar mode.
--disk_display mode Which way should the disk progress bar be added Takes: bar, infobar, barinfo, off
Takes bar, infobar, barinfo, perc
Image: Image:
@ -3124,10 +3151,7 @@ while [ "$1" ]; do
progress_color_elapsed="$2" progress_color_elapsed="$2"
progress_color_total="$3" progress_color_total="$3"
;; ;;
--cpu_display) --cpu_display) cpu_display="$2" ;;
cpu_shorthand="$2"
cpu_display="$3"
;;
--memory_display) memory_display="$2" ;; --memory_display) memory_display="$2" ;;
--battery_display) battery_display="$2" ;; --battery_display) battery_display="$2" ;;
--disk_display) disk_display="$2" ;; --disk_display) disk_display="$2" ;;
@ -3205,7 +3229,7 @@ while [ "$1" ]; do
esac esac
;; ;;
--test) --test)
info=(title underline distro kernel uptime packages shell resolution de wm wmtheme theme icons cpu gpu memory font disk battery song localip publicip users birthday term termfont) info=(title underline distro kernel uptime packages shell resolution de wm wmtheme theme icons cpu cpu_usage gpu memory font disk battery song localip publicip users birthday term termfont)
refresh_rate="on" refresh_rate="on"
shell_version="on" shell_version="on"

View file

@ -145,27 +145,25 @@ Colors to make the progress bar.
.br .br
Set in this order: elapsed, total Set in this order: elapsed, total
.TP .TP
.B \--cpu_display 'mode1' 'mode2' .B \--cpu_display 'mode'
Which shorthand to use and how CPU usage should be printed Progress bar mode.
.br .br
mode1 takes: name, speed, tiny, on, off Takes: bar, infobar, barinfo, off
.br
mode2 takes: info, bar, infobar, barinfo
.TP .TP
.B \--memory_display 'mode' .B \--memory_display 'mode'
Which way should the memory progress bar be added Progress bar mode.
.br .br
Takes: bar, infobar, barinfo Takes: bar, infobar, barinfo, off
.TP .TP
.B \--battery_display 'mode' .B \--battery_display 'mode'
Which way should the battery progress bar be added Progress bar mode.
.br .br
Takes: bar, infobar, barinfo Takes: bar, infobar, barinfo, off
.TP .TP
.B \--disk_display mode .B \--disk_display 'mode'
Which way should the disk progress bar be added Progress bar mode.
.br .br
Takes: bar, infobar, barinfo, perc Takes: bar, infobar, barinfo, off
.SH IMAGE .SH IMAGE
.TP .TP