Skip to content

Commit

Permalink
remove the notification for elive-screenshot (show it only less than …
Browse files Browse the repository at this point in the history
…1 second) after 10 times having read it, forever
  • Loading branch information
Thanatermesis committed Aug 15, 2021
1 parent d21d581 commit 110198d
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions usr/bin/elive-screenshot
Expand Up @@ -115,14 +115,23 @@ take_screenshot(){
cd "$tmpdir"
rm -f *png *jpg

unset is_interactive
el_config_get
[[ -z "$conf_notifications_amount" ]] && conf_notifications_amount=0
notify_timeout=3400
if [[ "$conf_notifications_amount" -ge 10 ]] ; then
notify_timeout=400
fi

# some info for the user
if ((is_mode_range)) ; then
if ((is_interactive)) ; then
el_info "$message_drag_range"
else
notify-send -t 3800 -i document-page-setup "$( eval_gettext "Elive Screenshot" )" "${message_drag_range}\n\n${message_hotkeys}"
notify-send -t ${notify_timeout} -i document-page-setup "$( eval_gettext "Elive Screenshot" )" "${message_drag_range}\n\n${message_hotkeys}"
conf_notifications_amount="$(( $conf_notifications_amount + 1 ))"
el_config_save "conf_notifications_amount"
sync
LC_ALL=C sleep 0.6
fi

fi
Expand All @@ -131,15 +140,16 @@ take_screenshot(){
if ((is_interactive)) ; then
el_info "$message_window_delayed"
else
notify-send -t 3000 -i document-page-setup "$( eval_gettext "Elive Screenshot" )" "${message_window_delayed}"
notify-send -t ${notify_timeout} -i document-page-setup "$( eval_gettext "Elive Screenshot" )" "${message_window_delayed}"
conf_notifications_amount="$(( $conf_notifications_amount + 1 ))"
el_config_save "conf_notifications_amount"
sync
LC_ALL=C sleep 0.6
fi
fi


# we need to wait a bit so the user is not pressing the keyboard
LC_ALL=C sleep 0.4
LC_ALL=C sleep 0.5

# take screenshot in png first
scrot $options 'Elive_Screenshot_%Y-%m-%d_%H:%M:%S__$wx$h.png' || true
Expand Down Expand Up @@ -192,7 +202,7 @@ take_screenshot(){
if ((is_interactive)) ; then
el_info "$message_result"
else
notify-send -t 9000 -i geeqie "$( eval_gettext "Elive Screenshot" )" "$message_result"
notify-send -t 7000 -i geeqie "$( eval_gettext "Elive Screenshot" )" "$message_result"
fi
}

Expand Down

0 comments on commit 110198d

Please sign in to comment.