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
52d3c10b
Commit
52d3c10b
authored
Oct 04, 2016
by
Dylan Araps
Committed by
GitHub
Oct 04, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #345 from dylanaraps/scrot-upload
Add support for uploading images to filesharing sites.
parents
81c34653
06281dae
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
86 additions
and
11 deletions
+86
-11
README.md
README.md
+2
-0
config
config/config
+11
-1
neofetch
neofetch
+67
-10
neofetch.1
neofetch.1
+6
-0
No files found.
README.md
View file @
52d3c10b
...
@@ -459,6 +459,8 @@ alias neofetch2="neofetch \
...
@@ -459,6 +459,8 @@ alias neofetch2="neofetch \
Screenshot:
Screenshot:
--scrot /path/to/img Take a screenshot, if path is left empty the screen-
--scrot /path/to/img Take a screenshot, if path is left empty the screen-
shot function will use \$scrot_dir and \$scrot_name.
shot function will use \$scrot_dir and \$scrot_name.
--upload | -su /pth/t/img Same as --scrot but uploads the scrot to a website.
--image_host Website to upload scrots to. Takes: imgur, teknik
--scrot_cmd cmd Screenshot program to launch
--scrot_cmd cmd Screenshot program to launch
Other:
Other:
...
...
config/config
View file @
52d3c10b
...
@@ -401,7 +401,17 @@ scrot_dir="$HOME/Pictures/"
...
@@ -401,7 +401,17 @@ scrot_dir="$HOME/Pictures/"
# Scrot filename
# Scrot filename
# What to name the screenshots
# What to name the screenshots
# --scrot_name str
# --scrot_name str
scrot_name
=
"neofetch-
$(
date
+%F-%T
)
.png"
scrot_name
=
"neofetch-
$(
date
+%F-%I-%M-%S-
${
RANDOM
})
.png"
# Image upload host
# Where to upload the image.
# Possible values: imgur, teknik
image_host
=
"imgur"
# Imgur api key
# This is an api key for neofetch, you can sign up for your own
# here: http://api.imgur.com/oauth2/addclient
imgur_client_id
=
"0e8b44d15e9fc95"
# }}}
# }}}
...
...
neofetch
View file @
52d3c10b
...
@@ -2222,10 +2222,6 @@ getimage() {
...
@@ -2222,10 +2222,6 @@ getimage() {
img
=
"
$thumbnail_dir
/
$imgname
"
img
=
"
$thumbnail_dir
/
$imgname
"
}
}
takescrot
()
{
$scrot_cmd
"
${
scrot_dir
}${
scrot_name
}
"
}
# }}}
# }}}
# Find w3m-img {{{
# Find w3m-img {{{
...
@@ -2297,6 +2293,48 @@ getimagebackend() {
...
@@ -2297,6 +2293,48 @@ getimagebackend() {
# }}}
# }}}
# Screenshot {{{
takescrot
()
{
$scrot_cmd
"
${
scrot_dir
}${
scrot_name
}
"
[
"
$scrot_upload
"
==
"on"
]
&&
scrot_upload
}
# }}}
# Screenshot Upload {{{
scrot_upload
()
{
if
!
type
-p
curl
>
/dev/null 2>&1
;
then
printf
"%s
\n
"
"[!] Install curl to upload images"
return
fi
image_file
=
"
${
scrot_dir
}${
scrot_name
}
"
printf
"%s
\n
"
"Uploading image..."
case
"
$image_host
"
in
"teknik"
)
image_url
=
"
$(
curl
-sf
-F
file
=
"@
${
image_file
}
"
"https://api.teknik.io/v1/Upload"
)
"
image_url
=
"
$(
awk
-F
'url:|,'
'{printf $2}'
<<<
"
${
image_url
//\
"}"
)
"
;;
"
imgur
")
image_url="
$(
curl
-sH
"Authorization: Client-ID
$imgur_client_id
"
-F
image
=
"@
${
image_file
}
"
"https://api.imgur.com/3/upload"
)
"
image_url="
$(
awk
-F
'id:|,'
'{printf $2}'
<<<
"
${
image_url
//\
"}"
)
"
[ "
$image_url
" ] && image_url="
https
://i.imgur.com/
${
image_url
}
.png
"
;;
esac
if [ "
$image_url
" ]; then
printf "
%s\n
" "
$image_url
"
else
printf "
%s\n
" "
[!] Image failed to upload
"
fi
}
# }}}
# }}}
# }}}
# Text Formatting {{{
# Text Formatting {{{
...
@@ -2826,6 +2864,21 @@ dynamicprompt() {
...
@@ -2826,6 +2864,21 @@ dynamicprompt() {
# }}}
# }}}
# Scrot args {{{
scrot_args
()
{
scrot
=
"on"
case
"
$2
"
in
"--"
*
|
""
)
;;
*
)
scrot_name
=
"
${
2
##*/
}
"
scrot_dir
=
"
${
2
/
$scrot_name
}
"
;;
esac
}
# }}}
# }}}
# }}}
# Usage {{{
# Usage {{{
...
@@ -2933,8 +2986,10 @@ usage() { cat << EOF
...
@@ -2933,8 +2986,10 @@ usage() { cat << EOF
--logo | -L Hide the info text and only show the ascii logo.
--logo | -L Hide the info text and only show the ascii logo.
Screenshot:
Screenshot:
--scrot
/path/to/img
Take a screenshot, if path is left empty the screen-
--scrot
| -s /path/to/img
Take a screenshot, if path is left empty the screen-
shot function will use \
$scrot_dir
and \
$scrot_name
.
shot function will use \
$scrot_dir
and \
$scrot_name
.
--upload | -su /pth/t/img Same as --scrot but uploads the scrot to a website.
--image_host Website to upload scrots to. Takes: imgur, teknik
--scrot_cmd cmd Screenshot program to launch
--scrot_cmd cmd Screenshot program to launch
Other:
Other:
...
@@ -3096,12 +3151,14 @@ getargs() {
...
@@ -3096,12 +3151,14 @@ getargs() {
# Screenshot
# Screenshot
--scrot
|
-s
)
--scrot
|
-s
)
scrot
=
"on"
scrot_args
"
$@
"
if
[
"
$2
"
]
;
then
scrot_name
=
"
${
2
##*/
}
"
scrot_dir
=
"
${
2
/
$scrot_name
}
"
fi
;;
;;
--upload
|
-su
)
scrot_upload
=
"on"
scrot_args
"
$@
"
;;
--image_host
)
image_host
=
"
$2
"
;;
--scrot_cmd
)
scrot_cmd
=
"
$2
"
;;
--scrot_cmd
)
scrot_cmd
=
"
$2
"
;;
# Other
# Other
...
...
neofetch.1
View file @
52d3c10b
...
@@ -240,6 +240,12 @@ Hide the info text and only show the ascii logo.
...
@@ -240,6 +240,12 @@ Hide the info text and only show the ascii logo.
Take a screenshot, if path is left empty the screenshot
Take a screenshot, if path is left empty the screenshot
function will use $scrot_dir and $scrot_name.
function will use $scrot_dir and $scrot_name.
.TP
.TP
.B \--upload | -su 'path'
Same as --scrot but uploads the scrot to a website.
.TP
.B \--image_host 'host'
Website to upload scrots to. Takes: imgur, teknik
.TP
.B \--scrot_cmd 'cmd'
.B \--scrot_cmd 'cmd'
Screenshot program to launch
Screenshot program to launch
...
...
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