Compare commits

..

15 Commits
img2 ... hp-ux

Author SHA1 Message Date
Muhammad Herdiansyah
56545944d3 Merge branch 'master' into hp-ux 2017-11-09 18:53:29 +07:00
Muhammad Herdiansyah
5d63097994 Memory [HP-UX]: Complete support 2017-07-05 16:50:05 +07:00
Muhammad Herdiansyah
b8c902e65f Uptime [HP-UX]: Remove leading zeroes
Variables with a leading 0 are treated as base-8, so it halts HP-UX
detection because of the error.
2017-07-05 02:19:52 +07:00
Muhammad Herdiansyah
01bbad7c79 Install Date [HP-UX]: Add initial support 2017-07-04 20:13:25 +07:00
Muhammad Herdiansyah
7dac8843f1 Disk [HP-UX]: Add initial support 2017-07-04 19:51:28 +07:00
Muhammad Herdiansyah
9b51f9f528 Memory [HP-UX]: Add partial support 2017-07-04 19:36:29 +07:00
Muhammad Herdiansyah
d233e5bb2e CPU [HP-UX]: Add partial support 2017-07-04 19:29:51 +07:00
Muhammad Herdiansyah
5cb04eccce Distro: Fix typo 2017-07-04 19:14:20 +07:00
Muhammad Herdiansyah
7141db1046 Misc: Shellcheck fix 2017-07-04 19:08:57 +07:00
Muhammad Herdiansyah
af6358fe47 Distro [HP-UX/IRIX]: Make use of the kernel_shorthand feature 2017-07-04 19:06:55 +07:00
Muhammad Herdiansyah
53148c1ffe Merge master branch into hp-ux 2017-07-04 18:54:17 +07:00
Dylan Araps
c3901fbc2a Packages: Add support for HP-UX 2017-01-19 14:12:07 +11:00
Dylan Araps
68630a125e Uptime: Add support for HP-UX 2017-01-19 14:08:57 +11:00
Dylan Araps
e8bd2975e0 Model: Add support for HP-UX 2017-01-19 14:04:59 +11:00
Dylan Araps
9a7b4c3871 OS: Add initial support for HP-UX 2017-01-19 13:59:20 +11:00
5 changed files with 178 additions and 121 deletions

View File

@@ -3,25 +3,14 @@
- [**@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
@@ -33,10 +22,6 @@
- [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)

View File

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

View File

@@ -617,8 +617,18 @@ 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 'square' image size.
# Note: Only affects 'normal' crop mode.
#
# Default: 'center'
# Values: 'northwest', 'north', 'northeast', 'west', 'center'
@@ -627,21 +637,20 @@ thumbnail_dir="${XDG_CACHE_HOME:-${HOME}/.cache}/thumbnails/neofetch"
crop_offset="center"
# Image size
# NOTE: 'square' is the OLD behavior.
# NOTE: 'auto' keeps image aspect ratio and size where possible.
# The image is half the terminal width by default.
#
# Default: 'auto'
# Values: 'auto', 'square'
# Values: 'auto', '00px', '00%', 'none'
# Flags: --image_size
# --size
image_size="auto"
# Gap between image and text
# Ggap between image and text
#
# Default: '4'
# Default: '3'
# Values: 'num', '-num'
# Flag: --gap
gap=4
gap=3
# Image offsets
# Only works with the w3m backend.

239
neofetch
View File

@@ -44,6 +44,7 @@ get_os() {
"MINIX") os="MINIX" ;;
"AIX") os="AIX" ;;
"IRIX64") os="IRIX" ;;
"HP-UX") os="HP-UX" ;;
*)
printf "%s\n" "Unknown OS detected: '$kernel_name', aborting..." >&2
printf "%s\n" "Open an issue on GitHub to add support for your OS." >&2
@@ -153,7 +154,7 @@ get_distro() {
# Workarounds for FreeBSD based distros.
[[ -f "/etc/pcbsd-lang" ]] && distro="PCBSD"
[[ -f "/etc/trueos-lang" ]] && distro="TrueOS"
[[ -f "/etc/rc.conf.trueos" ]] && distro="TrueOS"
# /etc/pacbsd-release is an empty file
[[ -f "/etc/pacbsd-release" ]] && distro="PacBSD"
@@ -226,8 +227,11 @@ get_distro() {
distro="AIX $(oslevel)"
;;
"IRIX")
distro="IRIX ${kernel_version}"
"IRIX" | "HP-UX")
distro="$os ${kernel_version}"
case "$distro_shorthand" in
"on" | "tiny") distro="${distro/ ${kernel_version}}" ;;
esac
;;
esac
@@ -339,6 +343,10 @@ get_model() {
"AIX")
model="$(/usr/bin/uname -M)"
;;
"HP-UX")
model="$(model)"
;;
esac
# Remove dummy OEM info.
@@ -368,8 +376,8 @@ get_title() {
}
get_kernel() {
# Since these OS are integrated systems, it's better to skip this function altogether
[[ "$os" =~ (AIX|IRIX) ]] && return
# Since AIX has no useful output in uname, it's better to skip this function altogether
[[ "$os" == "AIX" ]] && return
case "$kernel_shorthand" in
"on") kernel="$kernel_version" ;;
@@ -377,7 +385,7 @@ get_kernel() {
esac
# Hide kernel info if it's identical to the distro info.
if [[ "$os" =~ (BSD|MINIX) && "$distro" == *"$kernel_name"* ]]; then
if [[ "$os" =~ (BSD|MINIX|IRIX|HP-UX) && "$distro" == *"$kernel_name"* ]]; then
case "$distro_shorthand" in
"on" | "tiny") kernel="$kernel_version" ;;
*) unset kernel ;;
@@ -417,8 +425,8 @@ get_uptime() {
seconds="${seconds/.*}"
;;
"AIX" | "IRIX")
t="$(LC_ALL=POSIX ps -o etime= -p 1)"
"AIX" | "IRIX" | "HP-UX")
t="$(LC_ALL=POSIX UNIX95=1 ps -o etime= -p 1)"
d="0" h="0"
case "$t" in *"-"*) d="${t%%-*}"; t="${t#*-}";; esac
case "$t" in *":"*":"*) h="${t%%:*}"; t="${t#*:}";; esac
@@ -552,9 +560,6 @@ 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)))" ;;
@@ -602,6 +607,10 @@ get_packages() {
"IRIX")
packages="$(($(versions -b | wc -l)-3))"
;;
"HP-UX")
packages="$(($(swlist -l product | wc -l)-6))"
;;
esac
((packages == 0)) && unset packages
@@ -689,10 +698,6 @@ 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.
@@ -758,7 +763,7 @@ get_wm_theme() {
;;
"Sawfish")
wm_theme="$(awk -F '\\(quote|\\)' '/default-frame-style/ {print $(NF-4)}' \
wm_theme="$(awk -F ")" '/\(quote default-frame-style/ {print $2}' \
"${HOME}/.sawfish/custom")"
;;
@@ -926,12 +931,7 @@ get_cpu() {
esac
speed_dir="/sys/devices/system/cpu/cpu0/cpufreq"
# 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
temp_dir="/sys/class/hwmon/hwmon0/temp1_input"
# Get CPU speed.
if [[ -d "$speed_dir" ]]; then
@@ -949,8 +949,8 @@ get_cpu() {
# Get CPU temp.
if [[ -f "$temp_dir" ]]; then
deg="$(< "$temp_dir")"
deg="$((deg * 100 / 10000))"
temp="$(< "$temp_dir")"
temp="$((temp * 100 / 10000))"
fi
# Get CPU cores.
@@ -1013,12 +1013,12 @@ get_cpu() {
# Get CPU temp.
case "$kernel_name" in
"FreeBSD"* | "DragonFly"* | "NetBSD"*)
deg="$(sysctl -n dev.cpu.0.temperature)"
deg="${deg/C}"
temp="$(sysctl -n dev.cpu.0.temperature)"
temp="${temp/C}"
;;
"OpenBSD"* | "Bitrig"*)
deg="$(sysctl -n hw.sensors.lm0.temp0)"
deg="${deg/ degC}"
temp="$(sysctl -n hw.sensors.lm0.temp0)"
temp="${temp/ degC}"
;;
esac
;;
@@ -1082,6 +1082,18 @@ get_cpu() {
# Get CPU cores.
cores="$(sysconf NPROC_ONLN)"
;;
"HP-UX")
# Get CPU name.
# This will be partial for now, because apparently hppa and
# IA64 has different approaches of how it should be handled.
# Get CPU speed.
# Same reasons as above.
# Get CPU cores.
cores="$(ioscan -k | grep -c "processor")"
;;
esac
# Remove un-needed patterns from cpu output.
@@ -1135,15 +1147,15 @@ get_cpu() {
fi
# Add CPU temp to the output.
if [[ "$cpu_temp" != "off" && "$deg" ]]; then
deg="${deg//.}"
if [[ "$cpu_temp" != "off" && "$temp" ]]; then
temp="${temp//.}"
# Convert to Fahrenheit if enabled
[[ "$cpu_temp" == "F" ]] && deg="$((deg * 90 / 50 + 320))"
[[ "$cpu_temp" == "F" ]] && temp="$((temp * 90 / 50 + 320))"
# Format the output
deg="[${deg/${deg: -1}}.${deg: -1}°${cpu_temp:-C}]"
cpu="$cpu $deg"
temp="[${temp/${temp: -1}}.${temp: -1}°${cpu_temp:-C}]"
cpu="$cpu $temp"
fi
}
@@ -1417,6 +1429,13 @@ get_memory() {
mem_free="$((mem_stat[5] / 1024))"
mem_used="$((mem_total - mem_free))"
;;
"HP-UX")
mem_total="$(machinfo | awk -F':' '/Memory/ {print $2}')"
mem_total="${mem_total/MB*}"
mem_free="$(($(vmstat | awk 'NR==3{printf $5}') / 1024))"
mem_used="$((mem_total - mem_free))"
;;
esac
memory="${mem_used}${mem_label:-MiB} / ${mem_total}${mem_label:-MiB}"
@@ -2044,7 +2063,7 @@ get_disk() {
# Get "df" version.
df_version="$(df --version 2>&1)"
case "$df_version" in
*"Tracker"*) # Haiku
*"blocks"*) # Haiku
err "Your version of df cannot be used due to the non-standard flags"
return
;;
@@ -2056,7 +2075,10 @@ get_disk() {
# Create an array called 'disks' where each element is a separate line from
# df's output. We then unset the first element which removes the column titles.
IFS=$'\n'
disks=($(df "${df_flags[@]}" "${disk_show[@]:-/}"))
case "$os" in
"HP-UX") disks=($(bdf "${disk_show[@]:-/}" 2>/dev/null)); df_version="bdf" ;;
*) disks=($(df "${df_flags[@]}" "${disk_show[@]:-/}" 2>/dev/null)) ;;
esac
unset 'disks[0]'
IFS="$old_ifs"
@@ -2072,9 +2094,10 @@ get_disk() {
disk_perc="${disk_info[4]/'%'}"
case "$df_version" in
*"befhikm"*)
disk="$((disk_info[2]/1024/1024))G / $((disk_info[1]/1024/1024))G (${disk_perc}%)"
*"befhikm"*|"bdf")
disk="$((disk_info[2]/1024/1024))G / $((disk_info[1]/1024/1024)) (${disk_perc}%)"
;;
*) disk="${disk_info[2]/i} / ${disk_info[1]/i} (${disk_perc}%)" ;;
esac
@@ -2252,6 +2275,7 @@ get_install_date() {
esac
;;
"AIX") install_file="/var/adm/ras/bosinstlog" ;;
"HP-UX") install_file="/dev/config" ;;
esac
ls_prog="$(ls --version 2>&1)"
@@ -2272,7 +2296,7 @@ get_install_date() {
install_date="$(ls -tcd --full-time "$install_file" | awk '{printf $6 " " $7}')"
;;
*"ACFHLNRS"* | *"RadC1xmnlog"*) # AIX ls / IRIX ls
*"ACFHLNRS"* | *"RadC1xmnlog"* | *"1ARadeCx"*) # AIX ls / IRIX ls / HP-UX ls
err "Install Date doesn't work because your 'ls' doesn't support full date/time."
return
;;
@@ -2302,16 +2326,10 @@ 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
@@ -2667,32 +2685,44 @@ get_image_size() {
font_width="$((term_width / columns))"
font_height="$((term_height / lines))"
# Get image size.
size="$(identify -format "%w %h" "$image")"
width="${size%% *}"
height="${size##* }"
case "$image_size" in
"square")
width="$((columns * font_width / 2))"
height="$width"
"auto")
image_size="$((columns * font_width / 2))"
term_height="$((term_height - term_height / 4))"
((term_height < image_size)) && \
image_size="$term_height"
;;
*)
while (( width >= (term_width / 2) ||
height >= (term_height / 2) )); do
width="$((width * 10 / 15))"
height="$((height * 10 / 15))"
done
*"%")
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.
size="$(identify -format "%w %h" "$image")"
width="${size%% *}"
height="${size##* }"
crop_mode="none"
;;
*) image_size="${image_size/px}" ;;
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="$image_size-$crop_offset-$width-$height-${image##*/}"
# Name the thumbnail using variables so we can
# use it later.
image_name="$crop_mode-$crop_offset-$width-$height-${image//'/'/_}"
# Handle file extensions.
case "${image##*.}" in
@@ -2704,17 +2734,62 @@ make_thumbnail() {
# Create the thumbnail dir if it doesn't exist.
mkdir -p "$thumbnail_dir"
[[ ! -f "$thumbnail_dir/$image_name" ]] && \
convert \
"$image" \
-strip \
-quality 50 \
-gravity "$crop_offset" \
-background none \
-sample "$width"x"$height"^ \
-extent "$width"x"$height" \
"$thumbnail_dir/$image_name"
# 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:)"
convert \
-background none \
"$image" \
-trim +repage \
-gravity south \
-background "$c" \
-extent "$size"x"$size" \
-scale "$width"x"$height" \
"$thumbnail_dir/$image_name"
;;
"fill")
convert \
-background none \
"$image" \
-trim +repage \
-scale "$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"
}
@@ -2960,7 +3035,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))
@@ -2973,7 +3048,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
@@ -3358,11 +3433,6 @@ get_distro_colors() {
ascii_file="kubuntu"
;;
"LEDE"*)
set_colors 4 7 1
ascii_file="lede"
;;
"Linux")
set_colors fg 8 3
ascii_file="linux"
@@ -4035,7 +4105,7 @@ dynamic_prompt() {
fi
# Set the prompt location.
((lines > 1)) && printf "%b" "\033[${lines}B"
((lines > 0)) && printf "%b" "\033[${lines}B"
}
old_functions() {
@@ -4402,9 +4472,11 @@ ASCII:
IMAGE:
--loop Redraw the image constantly until Ctrl+C is used. This fixes issues
in some terminals emulators when using image mode.
--size auto | --size square How to size the image.
--size 00px | --size 00% How to size the image.
Possible values: auto, 00px, 00%, none
--crop_offset value Change the crop offset for square mode.
--crop_mode mode Which crop mode to use
Takes the values: normal, fit, fill
--crop_offset value Change the crop offset for normal mode.
Possible values: northwest, north, northeast,
west, center, east, southwest, south, southeast
@@ -4699,11 +4771,6 @@ 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.5.
.TH NEOFETCH "1" "December 2017" "Neofetch 3.3.1-git" "User Commands"
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.4.
.TH NEOFETCH "1" "September 2017" "Neofetch 3.3.0" "User Commands"
.SH NAME
Neofetch \- A fast, highly customizable system info script
.SH SYNOPSIS
@@ -259,11 +259,16 @@ 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 auto | \fB\-\-size\fR square How to size the image.
\fB\-\-size\fR 00px | \fB\-\-size\fR 00%
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 square mode.
Change the crop offset for normal mode.
Possible values: northwest, north, northeast,
west, center, east, southwest, south, southeast
.TP