Merge master

This commit is contained in:
Dylan Araps 2016-10-22 01:39:31 +11:00
commit bb01418dca
5 changed files with 209 additions and 130 deletions

View file

@ -11,6 +11,7 @@
- Added new function called `checkoldflags` which informs users about deprecated config options. - Added new function called `checkoldflags` which informs users about deprecated config options.
- Change all `OS X` references to `macOS`. **[@iandrewt](https://github.com/iandrewt)** - Change all `OS X` references to `macOS`. **[@iandrewt](https://github.com/iandrewt)**
- Fix corrupted text when long lines are cut-off. - Fix corrupted text when long lines are cut-off.
- Don't dynamically place prompt in `image=off` mode.
## Operating System ## Operating System
@ -41,6 +42,24 @@ The final fix was as simple as adding a zero-width space before the info, here's
https://github.com/dylanaraps/neofetch/commit/3e9c3d648cb4c6f0d5fe5f0b96f9e29429af39d9 https://github.com/dylanaraps/neofetch/commit/3e9c3d648cb4c6f0d5fe5f0b96f9e29429af39d9
**Removed hard dependency on `\033[14t`**
Neofetch no longer requires a terminal emulator that supports `\033[14t` this means that neofetch now works in Konsole. Instead of using the escape sequence users now have three options for getting the terminal size in pixels.
- `xdotool`
- `xwininfo` + `xprop`
- `xwininfo` + `xdpyinfo`
Neofetch will detect whatever combination you have insalled and use these programs.
Note: `\033[14t` is still supported, if images already work for you then you don't have to install anything else.
- [w3m-img] Draw the image twice to fix rendering issues in Konsole.
- [w3m-img] Fix cursor position when using `yoffset`.
- [w3m-img] Add `-bg` support with the new option `--bg_color`.
- `neofetch --bg_color blue` will make the background behind the image blue.
- Note: The background color is only visible behind transparent parts of the image.
## Ascii ## Ascii
@ -67,8 +86,16 @@ https://github.com/dylanaraps/neofetch/commit/3e9c3d648cb4c6f0d5fe5f0b96f9e29429
**CPU**<br \> **CPU**<br \>
- Expanded `cpu_cores` option by adding two new values, `logical` and `physical`.
- `logical`: Show all virtual cores (hyperthreaded).
- `physical`: Only show physical cores.
- [macOS] Print physical cores instead of hyper-threaded cores. **[@iandrewt](https://github.com/iandrewt)** - [macOS] Print physical cores instead of hyper-threaded cores. **[@iandrewt](https://github.com/iandrewt)**
**Uptime**<br \>
- Rewrote uptime function to use seconds since boot instead of the `uptime` command.
- Every OS/Distro now has the pretty `uptime -p` output!
**Resolution**<br \> **Resolution**<br \>
- [macOS] Add @2x label for retina resolutions. **[@iandrewt](https://github.com/iandrewt)** - [macOS] Add @2x label for retina resolutions. **[@iandrewt](https://github.com/iandrewt)**
@ -91,11 +118,11 @@ https://github.com/dylanaraps/neofetch/commit/3e9c3d648cb4c6f0d5fe5f0b96f9e29429
- Fixed `block_width` not working. - Fixed `block_width` not working.
- Fixed `% s` appearing in color blocks when neofetch is run from `tty` - Fixed `% s` appearing in color blocks when neofetch is run from `tty`
- Fixed `block_width` being off by one. A value of `2` made the blocks `3` wide instead of `2` wide. - Fixed `block_width` being off by one. A value of `2` made the blocks `3` wide instead of `2` wide.
- Show 16 colors by default instead of 8.
**Terminal and Terminal Font**<br \> **Terminal and Terminal Font**<br \>
- Uppercase first letter of `term` and `termfont` outputs. - Uppercase first letter of `term` and `termfont` outputs.
- Don't print broken output of busybox's `ps`.
- Remove path from output. - Remove path from output.
**Song**<br \> **Song**<br \>

View file

@ -86,6 +86,21 @@ Have a look at the wiki, I've updated/added some new pages!<br \>
- Alpine Linux: You also need `ncurses`. - Alpine Linux: You also need `ncurses`.
##### Image mode
These dependencies are required for image mode to work.
- Displaying images: `w3m-img` \[1\] or `iTerm2` or `Terminology` \[2\]
- Thumbnail creation: `imagemagick`
- Window size: A terminal emulator that supports `\033[14t` \[3\] or `xdotool` or `xwininfo + xprop` or `xwininfo + xdpyinfo`
\[1\] `w3m-img` is sometimes bundled together with `w3m`.
\[2\] Image support is built into Terminology and iTerm2, and doesn't require w3m-img.
\[3\] See this wiki page to find out if your terminal emulator supports `\033[14t` or if you need an additonal dependency.
##### iOS ##### iOS
These dependencies can all be installed through Cydia.<br \> These dependencies can all be installed through Cydia.<br \>
@ -99,19 +114,18 @@ Note: The cydia package installs these dependencies for you.
- `Gawk` - `Gawk`
- `grep` - `grep`
### Optional dependencies: ### Optional dependencies:
- Desktop Environment and Window Manager: `xprop` \[1\]
- Displaying images: `w3m-img` \[2\] \[3\] or `iTerm2` or `Terminology` \[4\]
- Thumbnail creation: `imagemagick`
- Displaying song information from Google Play Music Desktop Player: [`gpmdp-remote`](https://github.com/iAndrewT/gpmdp-remote) - Displaying song information from Google Play Music Desktop Player: [`gpmdp-remote`](https://github.com/iAndrewT/gpmdp-remote)
- Desktop Environment and Window Manager: `xprop` \[1\]
##### Linux / BSD / Solaris ##### Linux / BSD / Solaris
- Wallpaper: `feh`, `nitrogen` or `gsettings` - Wallpaper: `feh`, `nitrogen` or `gsettings`
- Current Song: `mpc`, `cmus`, `moc`, `spotify`, `gpmdc` - Current Song: `mpc`, `cmus`, `moc`, `spotify`, `gpmdc`
- Resolution: `xorg-xrandr` or `xorg-xdpyinfo` \[5\] - Resolution: `xorg-xrandr` or `xorg-xdpyinfo` \[2\]
- Screenshot: `scrot` \[6\] - Screenshot: `scrot` \[3\]
##### OSX ##### OSX
@ -128,17 +142,10 @@ Note: The cydia package installs these dependencies for you.
\[1\] See **[#79](https://github.com/dylanaraps/neofetch/issues/79)** about why this is now a required dependency. \[1\] See **[#79](https://github.com/dylanaraps/neofetch/issues/79)** about why this is now a required dependency.
\[2\] `w3m-img` is sometimes bundled together with `w3m`. \[2\] Xrandr is prefered over xdpyinfo as Xrandr supports multi monitor and refresh rate display in the<br \>
\[3\] Image support only works in certain terminal emulators. The script will fallback to ascii mode on<br \>
terminal emulators that don't support the xterm escape sequences we're using for image sizing.
\[4\] Image support is built into Terminology and iTerm2, and doesn't require w3m-img.
\[5\] Xrandr is prefered over xdpyinfo as Xrandr supports multi monitor and refresh rate display in the<br \>
output. output.
\[6\] You can use the launch flag `--scrot_cmd` or change the config option `$scrot_cmd` to your screenshot<br \> \[3\] You can use the launch flag `--scrot_cmd` or change the config option `$scrot_cmd` to your screenshot<br \>
program's cmd and neofetch will use it instead of scrot. program's cmd and neofetch will use it instead of scrot.
@ -364,7 +371,9 @@ alias neofetch2="neofetch \
NOTE: This only support Linux with cpufreq. NOTE: This only support Linux with cpufreq.
--cpu_shorthand type Shorten the output of CPU --cpu_shorthand type Shorten the output of CPU
Possible values: name, speed, tiny, on, off Possible values: name, speed, tiny, on, off
--cpu_cores on/off Whether or not to display the number of CPU cores --cpu_cores type Whether or not to display the number of CPU cores
Takes: logical, physical, off
Note: 'physical' doesn't work on BSD.
--distro_shorthand on/off Shorten the output of distro (tiny, on, off) --distro_shorthand on/off Shorten the output of distro (tiny, on, off)
NOTE: This is only possible on Linux, macOS, and Solaris NOTE: This is only possible on Linux, macOS, and Solaris
--kernel_shorthand on/off Shorten the output of kernel --kernel_shorthand on/off Shorten the output of kernel
@ -431,6 +440,8 @@ alias neofetch2="neofetch \
window. This only works with w3m. window. This only works with w3m.
--yoffset px How close the image will be to the top edge of the --yoffset px How close the image will be to the top edge of the
window. This only works with w3m. window. This only works with w3m.
--bg_color color Background color to display behind transparent image.
This only works with w3m.
--gap num Gap between image and text. --gap num Gap between image and text.
NOTE: --gap can take a negative value which will NOTE: --gap can take a negative value which will
move the text closer to the left side. move the text closer to the left side.

View file

@ -108,8 +108,11 @@ cpu_display="off"
# CPU Cores # CPU Cores
# Display CPU cores in output # Display CPU cores in output
# --cpu_cores on/off # Logical: All virtual cores
cpu_cores="on" # Physical: All physical cores
# --cpu_cores logical, physical, off
# Note: 'physical' doesn't work on BSD.
cpu_cores="logical"
# GPU # GPU
@ -233,7 +236,7 @@ underline_char="-"
# Color block range # Color block range
# --block_range start end # --block_range start end
start=0 start=0
end=15 end=7
# Toggle color blocks # Toggle color blocks
# --color_blocks on/off # --color_blocks on/off
@ -301,11 +304,12 @@ image="wall"
thumbnail_dir="$HOME/.cache/thumbnails/neofetch" thumbnail_dir="$HOME/.cache/thumbnails/neofetch"
# W3m-img path # W3m-img path
# Only works with the w3m backend.
# Some systems have this in another location # Some systems have this in another location
w3m_img_path="/usr/lib/w3m/w3mimgdisplay" w3m_img_path="/usr/lib/w3m/w3mimgdisplay"
# Image position # Image position
# Only works with the w3m backend # Only works with the w3m backend.
# --image_position left/right # --image_position left/right
image_position="left" image_position="left"
@ -329,11 +333,18 @@ image_size="auto"
gap=2 gap=2
# Image offsets # Image offsets
# Only works with the w3m backend.
# --xoffset px # --xoffset px
# --yoffset px # --yoffset px
yoffset=0 yoffset=0
xoffset=0 xoffset=0
# Image background color
# Only works with the w3m backend.
# Unset by default.
# --bg_color 'color', blue
background_color=
# }}} # }}}

195
neofetch
View file

@ -274,80 +274,52 @@ getkernel() {
# Uptime {{{ # Uptime {{{
getuptime() { getuptime() {
# Get uptime in seconds
case "$os" in case "$os" in
"Linux" | "Windows") "Linux" | "Windows")
case "$distro" in seconds="$(< /proc/uptime)"
*"Puppy"* | "Quirky Werewolf"* | "Alpine Linux"* | "OpenWRT"* | "Windows"*) seconds="${seconds/.*}"
uptime="$(uptime | awk -F ':[0-9]{2}+ |(, ){1}+' '{printf $2}')"
;;
"openSUSE"*)
uptime="$(uptime | awk -F ':[0-9]{2}+[a-z][a-z] |(, ){1}+' '{printf $2}')"
;;
"Android"*)
uptime=$(uptime | awk -F ' up' '{print $2}')
uptime="${uptime//[0-9] user*}"
uptime="${uptime//load average*}"
uptime="${uptime%,*} ${uptime##*,}"
;;
*)
uptime="$(uptime -p)"
[ "$uptime" == "up " ] && uptime="up $(awk -F'.' '{print $1}' /proc/uptime) seconds"
;;
esac
;; ;;
"Mac OS X" | "iPhone OS" | "BSD") "Mac OS X" | "iPhone OS" | "BSD")
# Get boot time in seconds
boot="$(sysctl -n kern.boottime)" boot="$(sysctl -n kern.boottime)"
boot="${boot/'{ sec = '}" boot="${boot/'{ sec = '}"
boot="${boot/,*}" boot="${boot/,*}"
# Get current date in seconds # Get current date in seconds
now="$(date +%s)" now="$(date +%s)"
uptime="$((now - boot))" seconds="$((now - boot))"
# Convert uptime to days/hours/mins
minutes="$((uptime / 60%60))"
hours="$((uptime / 3600%24))"
days="$((uptime / 86400))"
case "$minutes" in
1) minutes="1 minute" ;;
0) unset minutes ;;
*) minutes="$minutes minutes" ;;
esac
case "$hours" in
1) hours="1 hour" ;;
0) unset hours ;;
*) hours="$hours hours" ;;
esac
case "$days" in
1) days="1 day" ;;
0) unset days ;;
*) days="$days days" ;;
esac
[ "$hours" ] && \
[ "$minutes" ] && \
hours+=","
[ "$days" ] && \
[ "$hours" ] && \
days+=","
uptime="up $days $hours $minutes"
;; ;;
"Solaris") "Solaris")
uptime="$(uptime | /usr/xpg4/bin/awk -F ':[0-9]{2}+[a-z][a-z] |(, ){1}+' '{printf $2}')" seconds="$(kstat -p unix:0:system_misc:snaptime | awk '{print $2}')"
seconds="${seconds/.*}"
;; ;;
esac esac
days="$((seconds / 60 / 60 / 24)) days"
hours="$((seconds / 60 / 60 % 24)) hours"
minutes="$((seconds / 60 % 60)) minutes"
case "$days" in
"0 days") unset days ;;
"1 days") days="${days/s}" ;;
esac
case "$hours" in
"0 hours") unset hours ;;
"1 hours") hours="${hours/s}" ;;
esac
case "$minutes" in
"0 minutes") unset minutes ;;
"1 minutes") minutes="${minutes/s}" ;;
esac
uptime="${days:+$days, }${hours:+$hours, }${minutes}"
uptime="${uptime%', '}"
uptime="up ${uptime:-${seconds} seconds}"
# Make the output of uptime smaller. # Make the output of uptime smaller.
case "$uptime_shorthand" in case "$uptime_shorthand" in
"on") "on")
@ -366,7 +338,7 @@ getuptime() {
uptime="${uptime/ minutes/m}" uptime="${uptime/ minutes/m}"
uptime="${uptime/ minute/m}" uptime="${uptime/ minute/m}"
uptime="${uptime/ seconds/s}" uptime="${uptime/ seconds/s}"
uptime="${uptime/,}" uptime="${uptime//,}"
;; ;;
esac esac
} }
@ -742,7 +714,11 @@ getcpu() {
speed="$((speed / 100))" speed="$((speed / 100))"
fi fi
cores="$(grep -c ^processor /proc/cpuinfo)" # Show/hide hyperthreaded cores
case "$cpu_cores" in
"logical" | "on") cores="$(grep -c ^processor /proc/cpuinfo)" ;;
"physical") cores="$(grep "^core id" /proc/cpuinfo | sort -u | wc -l)" ;;
esac
# Fix for speeds under 1ghz # Fix for speeds under 1ghz
if [ -z "${speed:1}" ]; then if [ -z "${speed:1}" ]; then
@ -756,7 +732,12 @@ getcpu() {
"Mac OS X") "Mac OS X")
cpu="$(sysctl -n machdep.cpu.brand_string)" cpu="$(sysctl -n machdep.cpu.brand_string)"
cores="$(sysctl -n hw.ncpu)"
# Show/hide hyperthreaded cores
case "$cpu_cores" in
"logical" | "on") cores="$(sysctl -n hw.logicalcpu_max)" ;;
"physical") cores="$(sysctl -n hw.physicalcpu_max)" ;;
esac
;; ;;
"iPhone OS") "iPhone OS")
@ -902,8 +883,11 @@ getcpu() {
speed="$(psrinfo -v | awk '/operates at/ {print $6}')" speed="$(psrinfo -v | awk '/operates at/ {print $6}')"
speed="$((speed / 100))" speed="$((speed / 100))"
# Get cpu cores # Show/hide hyperthreaded cores
cores="$(kstat -m cpu_info | grep -c "chip_id")" case "$cpu_cores" in
"logical" | "on") cores="$(kstat -m cpu_info | grep -c "chip_id")" ;;
"physical") cores="$(psrinfo -p)" ;;
esac
# Fix for speeds under 1ghz # Fix for speeds under 1ghz
if [ -z "${speed:1}" ]; then if [ -z "${speed:1}" ]; then
@ -931,7 +915,7 @@ getcpu() {
cpu="${cpu//with Radeon HD Graphics}" cpu="${cpu//with Radeon HD Graphics}"
# Add cpu cores to output # Add cpu cores to output
[ "$cpu_cores" == "on" ] && [ "$cores" ] && \ [ "$cpu_cores" != "off" ] && [ "$cores" ] && \
cpu="${cpu/@/(${cores}) @}" cpu="${cpu/@/(${cores}) @}"
# Make the output of cpu shorter # Make the output of cpu shorter
@ -2033,7 +2017,7 @@ getwallpaper() {
[ "${img/*\./}" == "xml" ] && img="" [ "${img/*\./}" == "xml" ] && img=""
# Error msg # Error msg
[ -z "$img" ] && err "Wallpaper detection failed, falling back to ascii mode." [ -z "$img" ] && err "Image: Wallpaper detection failed, falling back to ascii mode."
} }
# }}} # }}}
@ -2044,7 +2028,7 @@ getascii() {
if [ ! -f "$ascii" ] || [ "$ascii" == "distro" ]; then if [ ! -f "$ascii" ] || [ "$ascii" == "distro" ]; then
# Error message # Error message
[ "$ascii" != "distro" ] && \ [ "$ascii" != "distro" ] && \
[ ! -f "$ascii" ] && err "Ascii file not found, using distro ascii" [ ! -f "$ascii" ] && err "Ascii: Ascii file not found, using distro ascii"
# Lowercase the distro name # Lowercase the distro name
if [ "$version" -le 3 ]; then if [ "$version" -le 3 ]; then
@ -2071,7 +2055,7 @@ getascii() {
if [ ! -f "$script_dir/ascii/distro/${ascii/ *}" ]; then if [ ! -f "$script_dir/ascii/distro/${ascii/ *}" ]; then
padding="\033[0C" padding="\033[0C"
image="off" image="off"
err "Ascii file not found, falling back to text mode." err "Ascii: Ascii file not found, falling back to text mode."
return return
fi fi
@ -2128,6 +2112,30 @@ getimage() {
esac esac
# Get terminal width and height # Get terminal width and height
if type -p xdotool >/dev/null 2>&1 && \
[ "$image_backend" != "iterm2" ]; then
current_window="$(xdotool getactivewindow)"
eval "$(xdotool getwindowgeometry --shell "$current_window")"
term_height="$HEIGHT"
term_width="$WIDTH"
elif type -p xwininfo >/dev/null 2>&1 && \
type -p xdpyinfo >/dev/null 2>&1 || \
type -p xprop >/dev/null 2>&1 && \
[ "$image_backend" != "iterm2" ]; then
if type -p xdpyinfo >/dev/null 2>&1; then
current_window="$(xdpyinfo | grep focus | grep -E -o 0x[0-9a-f]+)"
elif type -p xprop >/dev/null 2>&1; then
current_window="$(xprop -root | awk '/_NET_ACTIVE_WINDOW\(WINDOW\)/{print $NF}')"
fi
term_size="$(xwininfo -id "$current_window" | awk -F ': ' '/Width|Height/ {printf $2 " "}')"
term_width="${term_size/ *}"
term_height="${term_size/${term_width}}"
else
if [ -n "$TMUX" ]; then if [ -n "$TMUX" ]; then
printf "%b%s" "\033Ptmux;\033\033[14t\033\033[c\033\\" printf "%b%s" "\033Ptmux;\033\033[14t\033\033[c\033\\"
read_flags="-d c" read_flags="-d c"
@ -2158,15 +2166,18 @@ getimage() {
term_width="${term_size/*';'}" term_width="${term_size/*';'}"
fi fi
[ "${#term_size}" -le 5 ] && no_esc="1"
fi
# If $img isn't a file or the terminal doesn't support xterm escape sequences, # If $img isn't a file or the terminal doesn't support xterm escape sequences,
# fallback to ascii mode. # fallback to ascii mode.
if [ ! -f "$img" ] || ([ "${#term_size}" -le 5 ] && [ "$image_backend" != "tycat" ]); then if [ ! -f "$img" ] || ([ "$no_esc" == 1 ] && [ "$image_backend" != "tycat" ]); then
image="ascii" image="ascii"
getascii getascii
# Error messages # Error messages
[ ! -f "$img" ] && err "\$img, isn't a file, falling back to ascii mode." [ ! -f "$img" ] && err "Image: \$img, isn't a file, falling back to ascii mode."
[ "${#term_size}" -le 5 ] && err "Your terminal doesn't support \\\033[14t, falling back to ascii mode." [ "${#term_size}" -le 5 ] && err "Image: Your terminal doesn't support \\\033[14t, falling back to ascii mode."
return return
else else
@ -2308,7 +2319,7 @@ getw3m_img_path() {
else else
image="ascii" image="ascii"
err "w3m-img wasn't found on your system, falling back to ascii mode." err "Image: w3m-img wasn't found on your system, falling back to ascii mode."
fi fi
} }
@ -2324,7 +2335,7 @@ displayimage() {
# appearing in specific terminal emulators. # appearing in specific terminal emulators.
sleep 0.05 sleep 0.05
printf "%b%s\n" "0;1;$xoffset;$yoffset;$width;$height;;;;;$img\n4;\n3;" |\ printf "%b%s\n" "0;1;$xoffset;$yoffset;$width;$height;;;;;$img\n4;\n3;" |\
$w3m_img_path 2>/dev/null || padding="\033[0C" $w3m_img_path -bg "$background_color" 2>/dev/null || padding="\033[0C"
;; ;;
"iterm2") "iterm2")
@ -2778,8 +2789,10 @@ err() {
# Check for old flags {{{ # Check for old flags {{{
checkoldflags() { checkoldflags() {
[ -n "$osx_buildversion" ] && err "\$osx_buildversion is deprecated, use \$distro_shorthand instead." [ -n "$osx_buildversion" ] && err "Config: \$osx_buildversion is deprecated, use \$distro_shorthand instead."
[ -n "$osx_codename" ] && err "\$osx_codename is deprecated, use \$distro_shorthand instead." [ -n "$osx_codename" ] && err "Config: \$osx_codename is deprecated, use \$distro_shorthand instead."
[ -n "$progress_char" ] && err "Config: \$progress_char is deprecated, use \$progress_char_elapsed and \$progress_char_total instead."
[ "$cpu_cores" == "on" ] && err "Config: \$cpu_cores='on' is deprecated, use \$cpu_cores='logical|physical|off' instead."
} }
# }}} # }}}
@ -2821,9 +2834,9 @@ getdefaultconfig() {
fi fi
if source "$default_config"; then if source "$default_config"; then
err "Sourced default config ($default_config)" err "Config: Sourced default config ($default_config)"
else else
err "Default config not found, continuing..." err "Config: Default config not found, continuing..."
fi fi
} }
@ -2835,7 +2848,7 @@ getuserconfig() {
# Check $config_file # Check $config_file
if [ -f "$config_file" ]; then if [ -f "$config_file" ]; then
source "$config_file" source "$config_file"
err "Sourced user config ($config_file)" err "Config: Sourced user config ($config_file)"
return return
fi fi
mkdir -p "$XDG_CONFIG_HOME/neofetch/" mkdir -p "$XDG_CONFIG_HOME/neofetch/"
@ -2861,7 +2874,7 @@ getuserconfig() {
fi fi
source "$config_file" source "$config_file"
err "Sourced user config ($config_file)" err "Config: Sourced user config ($config_file)"
} }
# }}} # }}}
@ -2923,25 +2936,27 @@ kdeconfigdir() {
dynamicprompt() { dynamicprompt() {
# Calculate image height in terminal cells. # Calculate image height in terminal cells.
# The '+ 4' adds a gap between the prompt and the content. # The '+ 1' adds a gap between the prompt and the content.
[ "$image" != "ascii" ] && \ if [ "$image" != "ascii" ]; then
lines="$((${height:-1} / ${font_height:-1} + 4))" lines="$((${height:-1} / ${font_height:-1} + 2))"
cursor_yoffset="$((${yoffset:-1} / ${font_height:-1}))"
fi
# If the info is higher than the ascii/image place the prompt # If the info is higher than the ascii/image place the prompt
# based on the info height instead of the ascii/image height. # based on the info height instead of the ascii/image height.
if [ "${lines:-0}" -lt "${info_height:-0}" ]; then if [ "${lines:-0}" -lt "${info_height:-0}" ]; then
lines="0" lines="0"
else else
lines="$((lines - info_height - 4))" lines="$((lines - info_height + cursor_yoffset))"
fi fi
# Set the prompt location # Set the prompt location
[ "$image" != "off" ] && printf "\033[${lines/-*/0}B" [ "$image" != "off" ] && printf "\033[${lines/-*/0}B"
# Add some padding if the lines are above 0 # Add some padding
if [ "$lines" -gt 0 ]; then [ "$image_backend" != "w3m" ] && \
[ "$lines" -gt 0 ] && \
printf "\n\n" printf "\n\n"
fi
} }
# }}} # }}}
@ -2983,7 +2998,9 @@ usage() { cat << EOF
NOTE: This only support Linux with cpufreq. NOTE: This only support Linux with cpufreq.
--cpu_shorthand type Shorten the output of CPU --cpu_shorthand type Shorten the output of CPU
Possible values: name, speed, tiny, on, off Possible values: name, speed, tiny, on, off
--cpu_cores on/off Whether or not to display the number of CPU cores --cpu_cores type Whether or not to display the number of CPU cores
Takes: logical, physical, off
Note: 'physical' doesn't work on BSD.
--distro_shorthand on/off Shorten the output of distro (tiny, on, off) --distro_shorthand on/off Shorten the output of distro (tiny, on, off)
NOTE: This is only possible on Linux, macOS, and Solaris NOTE: This is only possible on Linux, macOS, and Solaris
--kernel_shorthand on/off Shorten the output of kernel --kernel_shorthand on/off Shorten the output of kernel
@ -3050,6 +3067,8 @@ usage() { cat << EOF
window. This only works with w3m. window. This only works with w3m.
--yoffset px How close the image will be to the top edge of the --yoffset px How close the image will be to the top edge of the
window. This only works with w3m. window. This only works with w3m.
--bg_color color Background color to display behind transparent image.
This only works with w3m.
--gap num Gap between image and text. --gap num Gap between image and text.
NOTE: --gap can take a negative value which will NOTE: --gap can take a negative value which will
move the text closer to the left side. move the text closer to the left side.
@ -3189,6 +3208,7 @@ getargs() {
--crop_offset) crop_offset="$2" ;; --crop_offset) crop_offset="$2" ;;
--xoffset) xoffset="$2" ;; --xoffset) xoffset="$2" ;;
--yoffset) yoffset="$2" ;; --yoffset) yoffset="$2" ;;
--background_color | --bg_color) background_color="$2" ;;
--gap) gap="$2" ;; --gap) gap="$2" ;;
--clean) --clean)
rm -rf "$thumbnail_dir" rm -rf "$thumbnail_dir"
@ -3330,9 +3350,12 @@ main() {
# Print the info # Print the info
printinfo printinfo
[ "$image" != "off" ] && dynamicprompt [ "$image" != "off" ] && dynamicprompt
# w3m-img: Draw the image a second time to fix
# rendering issues in specific terminal emulators.
[ "$image_backend" == "w3m" ] && displayimage
# Re-enable line wrap # Re-enable line wrap
printf "%b%s" "\033[?7h" printf "%b%s" "\033[?7h"

View file

@ -35,8 +35,10 @@ Shorten the output of CPU
.br .br
Possible values: name, speed, tiny, on, off Possible values: name, speed, tiny, on, off
.TP .TP
.B \--cpu_cores 'on/off' .B \--cpu_cores 'logical/physical/off'
Whether or not to display the number of CPU cores Whether or not to display the number of CPU cores
.br
Note: 'physical' doesn't work on BSD.
.TP .TP
.B \--distro_shorthand 'on/off' .B \--distro_shorthand 'on/off'
Shorten the output of distro (tiny, on, off) Shorten the output of distro (tiny, on, off)
@ -51,7 +53,8 @@ Shorten the output of uptime (tiny, on, off)
.TP .TP
.B \--refresh_rate 'on/off' .B \--refresh_rate 'on/off'
Whether to display the refresh rate of each monitor Whether to display the refresh rate of each monitor
Unsupported on Windows .br
Note: Unsupported on Windows
.TP .TP
.B \--gpu_shorthand 'on/off' .B \--gpu_shorthand 'on/off'
Shorten the output of GPU (tiny, on, off) Shorten the output of GPU (tiny, on, off)
@ -195,6 +198,10 @@ window in pixel. This only works with w3m.
How close the image will be to the top edge How close the image will be to the top edge
of the window. This only works with w3m. of the window. This only works with w3m.
.TP .TP
.B \--bg_color 'color'
Background color to display behind transparent image.
This only works with w3m.
.TP
.B \--gap 'num' .B \--gap 'num'
Gap between image and text. Gap between image and text.
.br .br