diff --git a/gitea_get_notifications.sh b/gitea_get_notifications.sh index b017fb7..b020b3f 100755 --- a/gitea_get_notifications.sh +++ b/gitea_get_notifications.sh @@ -8,6 +8,11 @@ merge_count=0 open_notis_count=0 fcount=0 +if [ "${gettype}" == "cleanup" ]; then + gettype="merged" + markmineread=true +fi + if [ "${gettype}" == "merged" ]; then open_noti=$(tea notification ls --mine | grep -E "^\| +[0-9]+.* Pull .* open " | sed -E 's/[ \|]/@@/g;s/@@+/@@/g;s/^@@//g;s/@@$//g') @@ -37,16 +42,12 @@ if [ "${gettype}" == "merged" ]; then fi done -fi - -if [ "${gettype}" == "open_all" ]; then +elif [ "${gettype}" == "open_all" ]; then open_notis=$(tea notification ls --mine | grep -E "^\| +[0-9]+.* Pull .* open " | sed -E 's/[ \|]/@@/g;s/@@+/@@/g;s/^@@//g;s/@@$//g') if [ -n "${open_notis}" ]; then open_notis_count=$(wc -l <<<"${open_notis}") fi -fi - -if [ "${gettype}" == "open" ]; then +elif [ "${gettype}" == "open" ]; then open_notis=$(tea notification ls --mine | grep -E "^\| +[0-9]+.* Pull .* open " | sed -E 's/[ \|]/@@/g;s/@@+/@@/g;s/^@@//g;s/@@$//g') for open_noti in ${open_notis}; do noti_id="$(grep -oE "^[0-9]+" <<<"${open_noti}")" @@ -73,4 +74,8 @@ elif [ $open_notis_count -gt 0 ]; then fcount=${open_notis_count} fi -echo "{\"state\":\"${i3status_state}\", \"text\":\"${fcount}\"}" +if $markmineread ; then + echo "GT" +else + echo "{\"state\":\"${i3status_state}\", \"text\":\"${fcount}\"}" +fi