Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
neofetch
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ximper Linux
neofetch
Commits
e262e30d
Commit
e262e30d
authored
Nov 13, 2016
by
Dylan Araps
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Image: Rename $img to $image
parent
a1b79bd3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
46 deletions
+47
-46
neofetch
neofetch
+47
-46
No files found.
neofetch
View file @
e262e30d
...
...
@@ -1815,18 +1815,18 @@ get_image_backend() {
*)
if [[ -d "
$image_source
" ]]; then
files=("
${
image_source
%/
}
"/*.{png,jpg,jpeg})
im
g
="
$(
printf
"%s"
"
${
files
[RANDOM % (
${#
files
[@]
}
- 1)]
}
"
)
"
im
age
="
$(
printf
"%s"
"
${
files
[RANDOM % (
${#
files
[@]
}
- 1)]
}
"
)
"
else
im
g
="
$image_source
"
im
age
="
$image_source
"
fi
;;
esac
# Fallback to ascii mode if image isn't a file.
if [[ ! -f "
$im
g
" ]]; then
if [[ ! -f "
$im
age
" ]]; then
image_backend="
ascii
"
get_ascii 2>/dev/null
err "
Image
:
'$im
g
'
, doesn
't exist, falling back to ascii mode."
err "
Image
:
'$im
age
'
, doesn
't exist, falling back to ascii mode."
return
fi
...
...
@@ -1885,14 +1885,15 @@ get_ascii() {
get_script_dir 2>/dev/null
# If the ascii file doesn'
t
exist fallback to text mode.
if [[ ! -f
"
$script_dir
/ascii/distro/
${
ascii
/ *
}
"
]]; then
if [[ -f
"
$script_dir
/ascii/distro/
${
ascii
/ *
}
"
]]; then
ascii=
"
$script_dir
/ascii/distro/
${
ascii
/ *
}
"
else
text_padding=
"0"
image=
"off"
image
_backend
=
"off"
err
"Ascii: Ascii file not found, falling back to text mode."
return
fi
ascii=
"
$script_dir
/ascii/distro/
${
ascii
/ *
}
"
fi
fi
...
...
@@ -1952,52 +1953,52 @@ get_wallpaper() {
case "$os" in
"Linux" | "BSD")
if type -p feh >/dev/null && [[ -f "$HOME/.fehbg" ]]; then
im
g
="$(awk -F\'
'/feh/ {printf $2}'
"
$HOME
/.fehbg"
)
"
im
age
="$(awk -F\'
'/feh/ {printf $2}'
"
$HOME
/.fehbg"
)
"
elif type -p nitrogen >/dev/null; then
im
g
="
$(
awk
-F
'='
'/file/ {printf $2;exit;}'
"
$XDG_CONFIG_HOME
/nitrogen/bg-saved.cfg"
)
"
im
age
="
$(
awk
-F
'='
'/file/ {printf $2;exit;}'
"
$XDG_CONFIG_HOME
/nitrogen/bg-saved.cfg"
)
"
elif type -p gsettings >/dev/null; then
# Get DE if user has disabled the function.
[[ -z "
$de
" ]] && get_de
case "
$de
" in
"
MATE
"*) im
g
="
$(
gsettings get org.mate.background picture-filename
)
" ;;
*) im
g
="
$(
gsettings get org.gnome.desktop.background picture-uri
)
" ;;
"
MATE
"*) im
age
="
$(
gsettings get org.mate.background picture-filename
)
" ;;
*) im
age
="
$(
gsettings get org.gnome.desktop.background picture-uri
)
" ;;
esac
# Strip quotes etc from the path.
im
g="
${
img
/
'file://'
}
"
im
g="
${
img
//\
'}"
im
g="${img
//\%20/ }"
im
age="
${
image
/
'file://'
}
"
im
age="
${
image
//\
'}"
im
age="${image
//\%20/ }"
fi
;;
"Mac OS X")
im
g
="$(osascript -e '
tell
application
"System Events"
to picture of current desktop
')"
im
age
="$(osascript -e '
tell
application
"System Events"
to picture of current desktop
')"
;;
"Windows")
case "$distro" in
"Windows XP")
im
g
="/cygdrive/c/Documents and Settings/${USER}"
im
g
+="/Local Settings/Application Data/Microsoft"
im
g
+="/Wallpaper1.bmp"
im
age
="/cygdrive/c/Documents and Settings/${USER}"
im
age
+="/Local Settings/Application Data/Microsoft"
im
age
+="/Wallpaper1.bmp"
;;
"Windows"*)
im
g
="$APPDATA/Microsoft/Windows/Themes"
im
g
+="/TranscodedWallpaper.jpg"
im
age
="$APPDATA/Microsoft/Windows/Themes"
im
age
+="/TranscodedWallpaper.jpg"
;;
esac
;;
esac
# If im
g
is an xml file don'
t
use it.
[[
"
${
im
g
/*\./
}
"
==
"xml"
]] && img
=
""
# If im
age
is an xml file don'
t
use it.
[[
"
${
im
age
/*\./
}
"
==
"xml"
]] && image
=
""
# Error msg
[[
-z
"
$img
"
]] && err
"Image: Wallpaper detection failed, falling back to ascii mode."
[[
! -f
"
$image
"
]] && err
"Image: Wallpaper detection failed, falling back to ascii mode."
}
get_term_size
()
{
...
...
@@ -2073,7 +2074,7 @@ get_term_size() {
fi
fi
# If $im
g
isn't a file fallback to ascii mode.
# If $im
age
isn't a file fallback to ascii mode.
if
[[
"
$term_width
"
]]
&&
((
term_width
>
0
))
;
then
clear
zws
=
" "
...
...
@@ -2117,7 +2118,7 @@ get_image_size() {
"none"
)
# Get image size so that we can do a better crop
size
=
"
$(
identify
-format
"%w %h"
"
$im
g
"
)
"
size
=
"
$(
identify
-format
"%w %h"
"
$im
age
"
)
"
width
=
"
${
size
%% *
}
"
height
=
"
${
size
##*
}
"
crop_mode
=
"none"
...
...
@@ -2135,23 +2136,23 @@ get_image_size() {
make_thumbnail
()
{
# Name the thumbnail using variables so we can
# use it later.
im
g
name
=
"
$crop_mode
-
$crop_offset
-
$width
-
$height
"
im
age_
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
"
${
im
g
##*/
}
"
in
*
"."
*
)
im
gname
=
"
${
imgname
}
-
${
img
##*/
}
"
;;
*
)
im
gname
=
"
${
imgname
}
-
${
img
##*/
}
.jpg"
;;
case
"
${
im
age
##*/
}
"
in
*
"."
*
)
im
age_name
=
"
${
image_name
}
-
${
image
##*/
}
"
;;
*
)
im
age_name
=
"
${
image_name
}
-
${
image
##*/
}
.jpg"
;;
esac
# Check to see if the thumbnail exists before we do any cropping.
if
[[
!
-f
"
$thumbnail_dir
/
$im
g
name
"
]]
;
then
if
[[
!
-f
"
$thumbnail_dir
/
$im
age_
name
"
]]
;
then
# Create the thumbnail dir if it doesn't exist.
mkdir
-p
"
$thumbnail_dir
"
# Get image size so that we can do a better crop
if
[[
-z
"
$size
"
]]
;
then
size
=
"
$(
identify
-format
"%w %h"
"
$im
g
"
)
"
size
=
"
$(
identify
-format
"%w %h"
"
$im
age
"
)
"
og_width
=
"
${
size
%% *
}
"
og_height
=
"
${
size
##*
}
"
...
...
@@ -2163,44 +2164,44 @@ make_thumbnail() {
case
"
$crop_mode
"
in
"fit"
)
c
=
"
$(
convert
"
$im
g
"
\
c
=
"
$(
convert
"
$im
age
"
\
-colorspace
srgb
\
-format
"%[pixel:p{0,0}]"
info:
)
"
convert
\
"
$im
g
"
\
"
$im
age
"
\
-trim
+repage
\
-gravity
south
\
-background
"
$c
"
\
-extent
"
$size
"
x
"
$size
"
\
-scale
"
$width
"
x
"
$height
"
\
"
$thumbnail_dir
/
$im
g
name
"
"
$thumbnail_dir
/
$im
age_
name
"
;;
"fill"
)
convert
\
"
$im
g
"
\
"
$im
age
"
\
-trim
+repage
\
-scale
"
$width
"
x
"
$height
"
^
\
-extent
"
$width
"
x
"
$height
"
\
"
$thumbnail_dir
/
$im
g
name
"
"
$thumbnail_dir
/
$im
age_
name
"
;;
"none"
)
cp
"
$im
g
"
"
$thumbnail_dir
/
$img
name
"
;;
"none"
)
cp
"
$im
age
"
"
$thumbnail_dir
/
$image_
name
"
;;
*
)
convert
\
"
$im
g
"
\
"
$im
age
"
\
-gravity
"
$crop_offset
"
\
-crop
"
$size
"
x
"
$size
"
+0+0
\
-quality
95
\
-scale
"
$width
"
x
"
$height
"
\
"
$thumbnail_dir
/
$im
g
name
"
"
$thumbnail_dir
/
$im
age_
name
"
;;
esac
fi
# The final image
im
g
=
"
$thumbnail_dir
/
$img
name
"
im
age
=
"
$thumbnail_dir
/
$image_
name
"
}
display_image
()
{
...
...
@@ -2209,16 +2210,16 @@ display_image() {
# Add a tiny delay to fix issues with images not
# appearing in specific terminal emulators.
sleep
0.05
printf
"%b
\n
"
"0;1;
$xoffset
;
$yoffset
;
$width
;
$height
;;;;;
$im
g
\n
4;
\n
3;"
|
\
printf
"%b
\n
"
"0;1;
$xoffset
;
$yoffset
;
$width
;
$height
;;;;;
$im
age
\n
4;
\n
3;"
|
\
"
$w3m_img_path
"
-bg
"
$background_color
"
>
/dev/null & 2>&1
||
text_padding
=
"0"
;;
"iterm2"
)
printf
"%b
\a\n
"
"
\0
33]1337;File=width=
${
width
}
px;height=
${
height
}
px;inline=1:
$(
base64
<
"
$im
g
"
)
"
printf
"%b
\a\n
"
"
\0
33]1337;File=width=
${
width
}
px;height=
${
height
}
px;inline=1:
$(
base64
<
"
$im
age
"
)
"
;;
"tycat"
)
tycat
"
$im
g
"
tycat
"
$im
age
"
;;
esac
}
...
...
@@ -3086,7 +3087,7 @@ get_args() {
;;
--ascii_distro
)
image
=
"ascii"
image
_backend
=
"ascii"
ascii_distro
=
"
$2
"
case
"
$2
"
in
"-"
*
|
""
)
ascii_distro
=
"
$distro
"
;;
esac
;;
...
...
@@ -3094,7 +3095,7 @@ get_args() {
--ascii_logo_size
)
ascii_logo_size
=
"
$2
"
;;
--ascii_bold
)
ascii_bold
=
"
$2
"
;;
--logo
|
-L
)
image
=
"ascii"
image
_backend
=
"ascii"
print_info
()
{
info line_break
;
}
;;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment