Compare commits

...

30 Commits
hp-ux ... img2

Author SHA1 Message Date
dylan araps
bd0f396305 general: cleanup 2017-12-14 10:32:18 +11:00
dylan araps
3c03c47f50 config: Update comment 2017-12-14 10:25:47 +11:00
dylan araps
b628ec0f4d image: Simplify crop 2017-12-14 10:22:23 +11:00
dylan araps
6c238a03b2 image: Simplify image handling. 2017-12-14 10:06:16 +11:00
dylan araps
8762403de9 wm_theme: Fix sawfish theme. 2017-12-13 14:43:21 +11:00
dylan araps
a2290b7398 cpu_temp: $temp is an environment variable on Windows. 2017-12-13 11:48:49 +11:00
dylan araps
9f263fe184 general: Fixed extra trailing prompt newline 2017-12-13 11:42:10 +11:00
dylan araps
c5c4f901ba general: Add config version to verbose output 2017-12-13 11:31:12 +11:00
dylan araps
9b5d75907b general: Add neofetch version to verbose output. 2017-12-13 11:30:17 +11:00
dylan araps
ed05c6460b general: Add command used to run neofetch to verbose output. 2017-12-13 11:19:53 +11:00
dylan araps
7fc4f84217 wm_theme: Fixed sawfish detection 2017-12-13 11:08:10 +11:00
dylan araps
c43ffb028e image: Make (--size none) keep original image aspect ratio. 2017-12-13 10:29:14 +11:00
dylan araps
8540a2f1e3 cpu_temp: Detect CPU temperature file. 2017-12-13 08:56:33 +11:00
dylan araps
db21981373 de: Fix GNOME bug 2017-12-13 08:45:47 +11:00
dylan araps
ca49b178fe de: Add GNOME version 2017-12-13 08:43:05 +11:00
dylan araps
1e8f12dd4a gpu_driver: Add version to NVIDIA output 2017-12-13 08:38:11 +11:00
Muhammad Herdiansyah
39cda4f29f Misc: Remove comment 2017-12-03 19:54:50 +07:00
Muhammad Herdiansyah
ed99973989 docs: CHANGELOG 2017-12-03 19:54:02 +07:00
Muhammad Herdiansyah
fe9933f544 Image mode (MacOS): Fixed garbage letter appeared in iTerm2 2017-12-03 19:52:03 +07:00
Herdiansyah
045577653c Merge pull request #872 from StarryTony/patch-1
fix in mac can not make_thumbnail
2017-12-03 19:50:10 +07:00
Muhammad Herdiansyah
c3d47ece7d docs: CHANGELOG 2017-11-26 19:00:29 +07:00
Herdiansyah
23340e29c3 Merge pull request #864 from MitchWeaver/master
add Sabotage linux package support
2017-11-26 18:58:42 +07:00
Herdiansyah
fe057a157b Merge pull request #868 from dawidd6/lede
ascii: add LEDE
2017-11-26 18:56:05 +07:00
Herdiansyah
f8c2bc2573 Merge pull request #869 from dawidd6/trueos
distro: fix trueos detection
2017-11-26 18:55:21 +07:00
Herdiansyah
bb4bc945be Merge pull request #871 from dawidd6/busybox
disk: change Haiku's df detection
2017-11-26 18:55:11 +07:00
StarryTony
acdd75220e fix in mac can not make_thumbnail
# fix in mac high Sierra cannot replace '/' with '_', optionally can use ${image//\//_}
2017-11-23 01:55:08 +00:00
Dawid Dziurla
a1e6843884 disk: change Haiku's df detection
'blocks' keyword is also present in busybox' df.
Busybox' df also has -P and -h flags, so it can be detected as normal df.
'Tracker' keyword seems to be exclusive to Haiku's df.
2017-11-22 22:08:11 +01:00
Dawid Dziurla
63df9687db distro: fix trueos detection 2017-11-19 16:49:49 +01:00
Dawid Dziurla
744dd46330 ascii: add LEDE 2017-11-19 12:06:11 +01:00
Mitch Weaver
dd8ee366b1 add neofetch 2017-11-18 23:53:36 +01:00
5 changed files with 110 additions and 131 deletions

View File

@@ -3,14 +3,25 @@
- [**@yslgirl**](https://github.com/yslgirl)
- [**@iandrewt**](https://github.com/iandrewt)
- [**@chrisweeksnz**](https://github.com/chrisweeksnz)
- [**@dawidd6**](https://github.com/dawidd6)
- [**@MitchWeaver**](https://github.com/MitchWeaver)
- [**@StarryTony**](https://github.com/StarryTony)
## OS
- Fixed detection bug with Gentoo.
- Fixed detection bug with TrueOS. [**@dawidd6**](https://github.com/dawidd6)
- Added support for macOS High Sierra. [**@yslgirl**](https://github.com/yslgirl)
- Added support for Container Linux by CoreOS. [**@chrisweeksnz**](https://github.com/chrisweeksnz)
- Added support for 2017 iOS devices [**@iandrewt**](https://github.com/iandrewt)
- Added support for LEDE. [**@dawidd6**](https://github.com/dawidd6)
## Images
- [MacOS/iTerm2] Fixed thumbnail not appearing (replaced by placeholder) [**@StarryTony**](https://github.com/StarryTony)
## Info
@@ -22,6 +33,10 @@
- [macOS] Fixed Install Date. [**@iandrewt**](https://github.com/iandrewt)
**Package Manager**
- Added detection for Sabotage Linux's `butch` [**@MitchWeaver**](https://github.com/MitchWeaver)
**Resolution**
- [macOS] Fixed errors on non-retina screens. [**@iandrewt**](https://github.com/iandrewt)

9
ascii/distro/lede Normal file
View File

@@ -0,0 +1,9 @@
${c1} _________
/ /\
/ LE / \
/ DE / \
/________/ LE \
\ \ DE /
\ LE \ /
\ DE \ /
\________\/

View File

@@ -617,18 +617,8 @@ image_loop="off"
# Values: 'dir'
thumbnail_dir="${XDG_CACHE_HOME:-${HOME}/.cache}/thumbnails/neofetch"
# Crop mode
#
# Default: 'normal'
# Values: 'normal', 'fit', 'fill'
# Flag: --crop_mode
#
# See this wiki page to learn about the fit and fill options.
# https://github.com/dylanaraps/neofetch/wiki/What-is-Waifu-Crop%3F
crop_mode="normal"
# Crop offset
# Note: Only affects 'normal' crop mode.
# Note: Only affects 'square' image size.
#
# Default: 'center'
# Values: 'northwest', 'north', 'northeast', 'west', 'center'
@@ -637,20 +627,21 @@ crop_mode="normal"
crop_offset="center"
# Image size
# The image is half the terminal width by default.
# NOTE: 'square' is the OLD behavior.
# NOTE: 'auto' keeps image aspect ratio and size where possible.
#
# Default: 'auto'
# Values: 'auto', '00px', '00%', 'none'
# Values: 'auto', 'square'
# Flags: --image_size
# --size
image_size="auto"
# Ggap between image and text
# Gap between image and text
#
# Default: '3'
# Default: '4'
# Values: 'num', '-num'
# Flag: --gap
gap=3
gap=4
# Image offsets
# Only works with the w3m backend.

169
neofetch
View File

@@ -153,7 +153,7 @@ get_distro() {
# Workarounds for FreeBSD based distros.
[[ -f "/etc/pcbsd-lang" ]] && distro="PCBSD"
[[ -f "/etc/rc.conf.trueos" ]] && distro="TrueOS"
[[ -f "/etc/trueos-lang" ]] && distro="TrueOS"
# /etc/pacbsd-release is an empty file
[[ -f "/etc/pacbsd-release" ]] && distro="PacBSD"
@@ -552,6 +552,9 @@ get_packages() {
packages="$((packages+=$(ls -d -1 "${package_dir[@]}" | wc -l)))"
fi
type -p butch >/dev/null && \
packages="$((packages+=$(butch list | wc -l)))"
if type -p pkg >/dev/null; then
case "$kernel_name" in
"FreeBSD") packages="$((packages+=$(pkg info | wc -l)))" ;;
@@ -686,6 +689,10 @@ get_de() {
*"xfce5"*) de="Xfce5" ;;
*"xfce"*) de="Xfce" ;;
*"mate"*) de="MATE" ;;
*"GNOME"*)
de="$(gnome-shell --version)"
de="${de/Shell }"
;;
esac
# Log that the function was run.
@@ -751,7 +758,7 @@ get_wm_theme() {
;;
"Sawfish")
wm_theme="$(awk -F ")" '/\(quote default-frame-style/ {print $2}' \
wm_theme="$(awk -F '\\(quote|\\)' '/default-frame-style/ {print $(NF-4)}' \
"${HOME}/.sawfish/custom")"
;;
@@ -919,7 +926,12 @@ get_cpu() {
esac
speed_dir="/sys/devices/system/cpu/cpu0/cpufreq"
temp_dir="/sys/class/hwmon/hwmon0/temp1_input"
# Select the right temperature file.
for temp_dir in /sys/class/hwmon/*; do
[[ "$(< "${temp_dir}/name")" =~ (coretemp|fam15h_power) ]] && \
{ temp_dir="${temp_dir}/temp1_input"; break; }
done
# Get CPU speed.
if [[ -d "$speed_dir" ]]; then
@@ -937,8 +949,8 @@ get_cpu() {
# Get CPU temp.
if [[ -f "$temp_dir" ]]; then
temp="$(< "$temp_dir")"
temp="$((temp * 100 / 10000))"
deg="$(< "$temp_dir")"
deg="$((deg * 100 / 10000))"
fi
# Get CPU cores.
@@ -1001,12 +1013,12 @@ get_cpu() {
# Get CPU temp.
case "$kernel_name" in
"FreeBSD"* | "DragonFly"* | "NetBSD"*)
temp="$(sysctl -n dev.cpu.0.temperature)"
temp="${temp/C}"
deg="$(sysctl -n dev.cpu.0.temperature)"
deg="${deg/C}"
;;
"OpenBSD"* | "Bitrig"*)
temp="$(sysctl -n hw.sensors.lm0.temp0)"
temp="${temp/ degC}"
deg="$(sysctl -n hw.sensors.lm0.temp0)"
deg="${deg/ degC}"
;;
esac
;;
@@ -1123,15 +1135,15 @@ get_cpu() {
fi
# Add CPU temp to the output.
if [[ "$cpu_temp" != "off" && "$temp" ]]; then
temp="${temp//.}"
if [[ "$cpu_temp" != "off" && "$deg" ]]; then
deg="${deg//.}"
# Convert to Fahrenheit if enabled
[[ "$cpu_temp" == "F" ]] && temp="$((temp * 90 / 50 + 320))"
[[ "$cpu_temp" == "F" ]] && deg="$((deg * 90 / 50 + 320))"
# Format the output
temp="[${temp/${temp: -1}}.${temp: -1}°${cpu_temp:-C}]"
cpu="$cpu $temp"
deg="[${deg/${deg: -1}}.${deg: -1}°${cpu_temp:-C}]"
cpu="$cpu $deg"
fi
}
@@ -2032,7 +2044,7 @@ get_disk() {
# Get "df" version.
df_version="$(df --version 2>&1)"
case "$df_version" in
*"blocks"*) # Haiku
*"Tracker"*) # Haiku
err "Your version of df cannot be used due to the non-standard flags"
return
;;
@@ -2290,10 +2302,16 @@ get_gpu_driver() {
gpu_driver="$(lspci -nnk | awk -F ': ' \
'/Display|3D|VGA/{nr[NR+2]}; NR in nr {printf $2 ", "}')"
gpu_driver="${gpu_driver%, }"
if [[ "$gpu_driver" == *"nvidia"* ]]; then
gpu_driver="$(< /proc/driver/nvidia/version)"
gpu_driver="${gpu_driver/*Module }"
gpu_driver="NVIDIA ${gpu_driver/ *}"
fi
;;
"Mac OS X")
if [[ "$(kextstat | grep "GeForceWeb")" != "" ]]; then
gpu_driver="Nvidia Web Driver"
gpu_driver="NVIDIA Web Driver"
else
gpu_driver="macOS Default Graphics Driver"
fi
@@ -2649,44 +2667,32 @@ get_image_size() {
font_width="$((term_width / columns))"
font_height="$((term_height / lines))"
case "$image_size" in
"auto")
image_size="$((columns * font_width / 2))"
term_height="$((term_height - term_height / 4))"
((term_height < image_size)) && \
image_size="$term_height"
;;
*"%")
percent="${image_size/\%}"
image_size="$((percent * term_width / 100))"
(((percent * term_height / 50) < image_size)) && \
image_size="$((percent * term_height / 100))"
;;
"none")
# Get image size so that we can do a better crop.
# Get image size.
size="$(identify -format "%w %h" "$image")"
width="${size%% *}"
height="${size##* }"
crop_mode="none"
case "$image_size" in
"square")
width="$((columns * font_width / 2))"
height="$width"
;;
*) image_size="${image_size/px}" ;;
*)
while (( width >= (term_width / 2) ||
height >= (term_height / 2) )); do
width="$((width * 10 / 15))"
height="$((height * 10 / 15))"
done
;;
esac
width="${width:-$image_size}"
height="${height:-$image_size}"
text_padding="$((width / font_width + gap + xoffset/font_width))"
}
make_thumbnail() {
# Name the thumbnail using variables so we can
# use it later.
image_name="$crop_mode-$crop_offset-$width-$height-${image//'/'/_}"
# Name the thumbnail using variables so we can use it later.
image_name="$image_size-$crop_offset-$width-$height-${image##*/}"
# Handle file extensions.
case "${image##*.}" in
@@ -2698,62 +2704,17 @@ make_thumbnail() {
# Create the thumbnail dir if it doesn't exist.
mkdir -p "$thumbnail_dir"
# Check to see if the thumbnail exists before we do any cropping.
if [[ ! -f "$thumbnail_dir/$image_name" ]]; then
# Get image size so that we can do a better crop.
if [[ -z "$size" ]]; then
size="$(identify -format "%w %h" "$image")"
og_width="${size%% *}"
og_height="${size##* }"
# This checks to see if height is greater than width
# so we can do a better crop of portrait images.
size="$og_height"
((og_height > og_width)) && size="$og_width"
fi
case "$crop_mode" in
"fit")
c="$(convert "$image" \
-colorspace srgb \
-format "%[pixel:p{0,0}]" info:)"
[[ ! -f "$thumbnail_dir/$image_name" ]] && \
convert \
-background none \
"$image" \
-trim +repage \
-gravity south \
-background "$c" \
-extent "$size"x"$size" \
-scale "$width"x"$height" \
"$thumbnail_dir/$image_name"
;;
"fill")
convert \
-strip \
-quality 50 \
-gravity "$crop_offset" \
-background none \
"$image" \
-trim +repage \
-scale "$width"x"$height"^ \
-sample "$width"x"$height"^ \
-extent "$width"x"$height" \
"$thumbnail_dir/$image_name"
;;
"none") cp "$image" "$thumbnail_dir/$image_name" ;;
*)
convert \
-background none \
"$image" \
-gravity "$crop_offset" \
-crop "$size"x"$size"+0+0 \
-quality 95 \
-scale "$width"x"$height" \
"$thumbnail_dir/$image_name"
;;
esac
fi
# The final image.
image="$thumbnail_dir/$image_name"
}
@@ -2999,7 +2960,7 @@ prin() {
string="${subtitle_color}${bold}${string}"
# Print the info.
printf "%b\n" "${text_padding:+\033[${text_padding}C}${zws}${string}${reset}"
printf "%b\n" "${text_padding:+\033[${text_padding}C}${zws}${string}${reset} "
# Calculate info height.
((++info_height))
@@ -3012,7 +2973,7 @@ get_underline() {
if [[ "$underline_enabled" == "on" ]]; then
printf -v underline "%${length}s"
printf "%b%b\n" "${text_padding:+\033[${text_padding}C}${zws}${underline_color}" \
"${underline// /$underline_char}${reset}"
"${underline// /$underline_char}${reset} "
unset -v length
fi
prin=1
@@ -3397,6 +3358,11 @@ get_distro_colors() {
ascii_file="kubuntu"
;;
"LEDE"*)
set_colors 4 7 1
ascii_file="lede"
;;
"Linux")
set_colors fg 8 3
ascii_file="linux"
@@ -4069,7 +4035,7 @@ dynamic_prompt() {
fi
# Set the prompt location.
((lines > 0)) && printf "%b" "\033[${lines}B"
((lines > 1)) && printf "%b" "\033[${lines}B"
}
old_functions() {
@@ -4436,11 +4402,9 @@ ASCII:
IMAGE:
--loop Redraw the image constantly until Ctrl+C is used. This fixes issues
in some terminals emulators when using image mode.
--size 00px | --size 00% How to size the image.
--size auto | --size square How to size the image.
Possible values: auto, 00px, 00%, none
--crop_mode mode Which crop mode to use
Takes the values: normal, fit, fill
--crop_offset value Change the crop offset for normal mode.
--crop_offset value Change the crop offset for square mode.
Possible values: northwest, north, northeast,
west, center, east, southwest, south, southeast
@@ -4735,6 +4699,11 @@ main() {
# Take a screenshot.
[[ "$scrot" == "on" ]] && take_scrot
# Add neofetch info to verbose output.
err "Neofetch command: $0 $*"
err "Neofetch version: $version"
err "Neofetch config: $config_version"
# Show error messages.
[[ "$verbose" == "on" ]] && printf "%b" "$err" >&2

View File

@@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.4.
.TH NEOFETCH "1" "September 2017" "Neofetch 3.3.0" "User Commands"
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.5.
.TH NEOFETCH "1" "December 2017" "Neofetch 3.3.1-git" "User Commands"
.SH NAME
Neofetch \- A fast, highly customizable system info script
.SH SYNOPSIS
@@ -259,16 +259,11 @@ Possible values: bar, infobar, barinfo, off
Redraw the image constantly until Ctrl+C is used. This fixes issues
in some terminals emulators when using image mode.
.TP
\fB\-\-size\fR 00px | \fB\-\-size\fR 00%
How to size the image.
\fB\-\-size\fR auto | \fB\-\-size\fR square How to size the image.
Possible values: auto, 00px, 00%, none
.TP
\fB\-\-crop_mode\fR mode
Which crop mode to use
Takes the values: normal, fit, fill
.TP
\fB\-\-crop_offset\fR value
Change the crop offset for normal mode.
Change the crop offset for square mode.
Possible values: northwest, north, northeast,
west, center, east, southwest, south, southeast
.TP