Screenshot: Add support for macOS and Haiku
This commit is contained in:
parent
3f3326ca29
commit
cf57ebe7f7
23
neofetch
23
neofetch
|
@ -2328,7 +2328,7 @@ to_off() {
|
|||
|
||||
take_scrot() {
|
||||
if [[ -d "$scrot_dir" ]]; then
|
||||
scrot_program "${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
|
||||
|
@ -2373,9 +2373,13 @@ scrot_args() {
|
|||
}
|
||||
|
||||
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"
|
||||
scrot_program="$scrot_cmd"
|
||||
|
||||
elif type -p scrot >/dev/null; then
|
||||
scrot_program="scrot"
|
||||
|
@ -2396,12 +2400,17 @@ scrot_program() {
|
|||
err "Scrot: No screen capture tool found."
|
||||
return
|
||||
fi
|
||||
|
||||
# Take the scrot.
|
||||
$scrot_program "$1"
|
||||
|
||||
err "Scrot: Screen captured using $scrot_program"
|
||||
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
|
||||
|
|
Reference in New Issue