use maim instead of scrot
Signed-off-by: fbt <fbt@fleshless.org>
This commit is contained in:
parent
b5331d8c93
commit
e2c6143c8c
26
ufw
26
ufw
|
@ -42,7 +42,7 @@ usage() {
|
|||
|
||||
Config options (~/.config/ufw):
|
||||
secret # Your personal token. Get it at https://zfh.so/settings_form
|
||||
cfg_screenshot_ext # Screenshot file type, used by scrot.
|
||||
cfg_screenshot_ext # Screenshot file type, used by maim.
|
||||
cfg_max_filesize # Maximum filesize (takes K, M and G suffixes).
|
||||
# Others are self-explanatory:
|
||||
cfg_url_regex
|
||||
|
@ -91,7 +91,7 @@ get_album_id() {
|
|||
upload() {
|
||||
declare api_response api_status api_status_message
|
||||
|
||||
if (( flag_scrot )); then
|
||||
if (( flag_scn )); then
|
||||
flag_rm=1
|
||||
file=$(take_screenshot) || { return 1; }
|
||||
else
|
||||
|
@ -197,18 +197,18 @@ get_shortlink() {
|
|||
take_screenshot() {
|
||||
declare tmp_file
|
||||
|
||||
[[ "$scrot_exec" ]] || { scrot_exec=$(type -P scrot); }
|
||||
[[ "$scrot_exec" ]] || {
|
||||
err "Please install scrot to use this function"
|
||||
[[ "$scn_exec" ]] || { scn_exec=$(type -P maim); }
|
||||
[[ "$scn_exec" ]] || {
|
||||
err "Please install maim to use this function"
|
||||
return 1
|
||||
}
|
||||
|
||||
(( "$flag_scrot_fullscreen" )) || { scrot_args+=( '-s' ); }
|
||||
[[ "$cfg_scrot_delay" ]] && { scrot_args+=( "-d $cfg_scrot_delay" ); }
|
||||
(( "$flag_scn_fullscreen" )) || { scn_args+=( '-s' ); }
|
||||
[[ "$cfg_scn_delay" ]] && { scn_args+=( "-d $cfg_scn_delay" ); }
|
||||
|
||||
tmp_file="$(_mktemp "${cfg_tmp_dir}" ".${cfg_screenshot_ext}")"
|
||||
|
||||
scrot "${scrot_args[@]}" "$tmp_file" || {
|
||||
maim "${scn_args[@]}" "$tmp_file" || {
|
||||
err "Failed to take a screenshot."
|
||||
return 1
|
||||
}
|
||||
|
@ -304,7 +304,7 @@ set_argv() {
|
|||
}
|
||||
|
||||
main() {
|
||||
declare args file target flag_private flag_rm flag_scrot flag_scrot_fullscreen cfg_scrot_delay
|
||||
declare args file target flag_private flag_rm flag_scn flag_scn_fullscreen cfg_scn_delay
|
||||
declare flag_shortlink=0
|
||||
|
||||
# Defaults for XDG
|
||||
|
@ -341,7 +341,7 @@ main() {
|
|||
while [[ "$1" ]]; do
|
||||
case "$1" in
|
||||
-h|--help|--usage) usage; return;;
|
||||
-D|--screenshot-delay) cfg_scrot_delay="$2"; shift;;
|
||||
-D|--screenshot-delay) cfg_scn_delay="$2"; shift;;
|
||||
-m|--max-filesize) cfg_max_filesize=$2; shift;;
|
||||
-A|--album-name) album_name=$2; shift;;
|
||||
|
||||
|
@ -350,14 +350,14 @@ main() {
|
|||
|
||||
-p|--public) flag_private='false';;
|
||||
-R|--remove-file) flag_rm='1';;
|
||||
-s|--screenshot) flag_scrot='1';;
|
||||
-s|--screenshot) flag_scn='1';;
|
||||
-S|--short-url) flag_shortlink=1;;
|
||||
-P|--page-url) flag_directlink=0;;
|
||||
-q|--quiet) flag_quiet=1;;
|
||||
|
||||
-F|--fullscreen)
|
||||
flag_scrot='1'
|
||||
flag_scrot_fullscreen='1'
|
||||
flag_scn='1'
|
||||
flag_scn_fullscreen='1'
|
||||
;;
|
||||
|
||||
-a|--album-id)
|
||||
|
|
Loading…
Reference in New Issue
Block a user