From dc5a01f27d462fe446618ada4b2e9d840b363a2c Mon Sep 17 00:00:00 2001 From: Erin Kinsley Date: Fri, 28 Jul 2017 03:08:10 +0100 Subject: [PATCH 1/4] Prioritise maim(1) over scrot(1). If a user has maim(1) installed as well as scrot(1), they likely wish to use the former instead of the latter, as it is less commonly installed (and is even described as "supposed to be an improved scrot"). --- neofetch | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/neofetch b/neofetch index a455c0b5..de136738 100755 --- a/neofetch +++ b/neofetch @@ -2702,12 +2702,12 @@ scrot_program() { if [[ "$scrot_cmd" != "auto" ]] && type -p "$scrot_cmd" >/dev/null; then scrot_program=("$scrot_cmd") - elif type -p scrot >/dev/null; then - scrot_program=(scrot) - elif type -p maim >/dev/null; then scrot_program=(maim) + elif type -p scrot >/dev/null; then + scrot_program=(scrot) + elif type -p import >/dev/null && [[ "$os" != "Mac OS X" ]]; then scrot_program=(import -window root) From 6cc08b5477ae4acf15968d01b998ce251a11459e Mon Sep 17 00:00:00 2001 From: dylan araps Date: Fri, 28 Jul 2017 21:54:58 +1000 Subject: [PATCH 2/4] image: Add support for all image formats that imagemagick supports. --- neofetch | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/neofetch b/neofetch index de136738..feaa0997 100755 --- a/neofetch +++ b/neofetch @@ -2277,7 +2277,7 @@ get_image_source() { if [[ -d "$image_source" ]]; then shopt -s nullglob - files=("${image_source%/}"/*.{png,jpg,jpeg,jpe,gif}) + files=("${image_source%/}"/*.{png,jpg,jpeg,jpe,gif,svg}) shopt -u nullglob image="${files[RANDOM % ${#files[@]}]}" @@ -2497,14 +2497,7 @@ get_image_size() { make_thumbnail() { # Name the thumbnail using variables so we can # use it later. - image_name="$crop_mode-$crop_offset-$width-$height" - - # Check to see if the image has a file extension, - # if it doesn't then add one. - case "${image##*/}" in - *"."*) image_name="${image_name}-${image##*/}" ;; - *) image_name="${image_name}-${image##*/}.jpg" ;; - esac + image_name="$crop_mode-$crop_offset-$width-$height-${image//\//_}.jpg" # Create the thumbnail dir if it doesn't exist. mkdir -p "$thumbnail_dir" From 41e48196582eccaa56c094f3b880d6f89ff64d5d Mon Sep 17 00:00:00 2001 From: dylan araps Date: Fri, 28 Jul 2017 22:14:26 +1000 Subject: [PATCH 3/4] image: Add support for transparency when using pdf or svg as input --- CHANGELOG.md | 2 ++ neofetch | 12 +++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dabe1636..bbeb487a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,8 @@ ## Images - [w3m] Fixed w3m-img not found on NixOS. +- Added support for using all image types as input. + - Neofetch now supports `svg`, `tiff` etc. ## ASCII diff --git a/neofetch b/neofetch index feaa0997..d0a4f5aa 100755 --- a/neofetch +++ b/neofetch @@ -2497,7 +2497,14 @@ get_image_size() { make_thumbnail() { # Name the thumbnail using variables so we can # use it later. - image_name="$crop_mode-$crop_offset-$width-$height-${image//\//_}.jpg" + image_name="$crop_mode-$crop_offset-$width-$height-${image//'/'/_}" + + # Handle file extensions. + case "${image##*.}" in + "eps"|"pdf"|"svg"|"gif"|"png") + image_name+=".png" ;; + *) image_name+=".jpg" ;; + esac # Create the thumbnail dir if it doesn't exist. mkdir -p "$thumbnail_dir" @@ -2523,6 +2530,7 @@ make_thumbnail() { -format "%[pixel:p{0,0}]" info:)" convert \ + -background none \ "$image" \ -trim +repage \ -gravity south \ @@ -2534,6 +2542,7 @@ make_thumbnail() { "fill") convert \ + -background none \ "$image" \ -trim +repage \ -scale "$width"x"$height"^ \ @@ -2544,6 +2553,7 @@ make_thumbnail() { "none") cp "$image" "$thumbnail_dir/$image_name" ;; *) convert \ + -background none \ "$image" \ -gravity "$crop_offset" \ -crop "$size"x"$size"+0+0 \ From 110e46bc6b0e4d43ac2f2cc946802b1659f92880 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Fri, 28 Jul 2017 15:54:14 +0200 Subject: [PATCH 4/4] Term: get_term(): ignore kdeinit, #791 --- neofetch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neofetch b/neofetch index de136738..765ac308 100755 --- a/neofetch +++ b/neofetch @@ -1701,7 +1701,7 @@ get_term() { case "${name// }" in "${SHELL/*\/}" | *"sh" | "tmux"* | "screen" | "su"*) ;; "login"* | *"Login"* | "init" | "(init)") term="$(tty)" ;; - "ruby" | "1" | "systemd" | "sshd"* | "python"* | "USER"*"PID"*) break ;; + "ruby" | "1" | "systemd" | "sshd"* | "python"* | "USER"*"PID"* | "kdeinit"*) break ;; "gnome-terminal-") term="gnome-terminal" ;; *"nvim") term="Neovim Terminal" ;; *"NeoVimServer"*) term="VimR Terminal" ;;