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
e2827fef
Commit
e2827fef
authored
Dec 05, 2016
by
Dylan Araps
Committed by
GitHub
Dec 05, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #502 from dylanaraps/scrot_auto
Scrot: Automatically detect tools
parents
b93acd15
cf57ebe7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
9 deletions
+54
-9
config
config/config
+12
-8
neofetch
neofetch
+42
-1
No files found.
config/config
View file @
e2827fef
...
...
@@ -629,16 +629,20 @@ ascii_bold="on"
# -s
scrot
=
"off"
# Screenshot
program to launch
#
If you're not using 'scrot' change this to your screenshot
#
progra
m.
# Screenshot
Program
#
Neofetch will automatically use whatever screenshot tool
#
is installed on your syste
m.
#
# Default: 'scrot -c -d 3'
# Values: 'cmd -flags'
# If 'neofetch -v' says that it couldn't find a screenshot
# tool or you're using a custom tool then you can change
# the option below to a custom command.
#
# Default: 'auto'
# Values: 'auto' 'cmd -flags'
# Flag: --scrot_cmd
scrot_cmd
=
"
scrot -c -d 3
"
scrot_cmd
=
"
auto
"
# Scr
ot dir
# Scr
eenshot Directory
# Where to save the screenshots
#
# Default: '~/Pictures/'
...
...
@@ -648,7 +652,7 @@ scrot_cmd="scrot -c -d 3"
# Note: Neofetch won't create the directory if it doesn't exist.
scrot_dir
=
"
$HOME
/Pictures/"
# Scr
ot f
ilename
# Scr
eenshot F
ilename
# What to name the screenshots
#
# Default: 'neofetch-$(date +%F-%I-%M-%S-${RANDOM}).png'
...
...
neofetch
View file @
e2827fef
...
...
@@ -2328,7 +2328,7 @@ to_off() {
take_scrot
()
{
if
[[
-d
"
$scrot_dir
"
]]
;
then
$scrot_cmd
"
${
scrot_dir
}${
scrot_name
}
"
scrot_program
"
${
scrot_dir
}${
scrot_name
}
"
2>/dev/null
else
printf
"%s
\n
"
"Screenshot:
$scrot_dir
doesn't exist. Edit the config file or create the directory to take screenshots."
fi
...
...
@@ -2372,6 +2372,47 @@ scrot_args() {
esac
}
scrot_program() {
# Detect screenshot program.
#
# We first check to see if an X server is running before
# falling back to OS specific screenshot tools.
if [[ -n "
$DISPLAY
" ]]; then
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 import >/dev/null; then
scrot_program="
import
-window root
"
elif type -p imlib2_grab >/dev/null; then
scrot_program="
imlib2_grab
"
elif type -p gnome-screenshot >/dev/null; then
scrot_program="
gnome
-screenshot -f
"
else
err "
Scrot
:
No screen capture tool found.
"
return
fi
else
case "
$os
" in
"
Mac
OS X
") scrot_program="
screencapture
-S
" ;;
"
Haiku
") scrot_program="
screenshot
-s
" ;;
esac
fi
# Take the scrot.
$scrot_program
"
$1
"
err "
Scrot
:
Screen captured using
$scrot_program
"
}
# TEXT FORMATTING
info() {
...
...
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