Created
May 14, 2021 10:50
-
-
Save fwsmit/cc3b3c5efb5f1f5c6647aaf7eb33ff5d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ICON_ROOT=/usr/share/icons/Adwaita | |
# pause in milliseconds per test notification | |
# about icons 5907 in total | |
PAUSE=1 | |
LOG="wg-dunst-test-icons.log" | |
# $ find $ICON_ROOT -type f | grep -v -e "\(.png\|.svg\)" | |
# shows that the only other files are below, which are not icons | |
# /usr/share/icons/Adwaita/cursors/... | |
# /usr/share/icons/Adwaita/index.theme | |
# /usr/share/icons/Adwaita/icon-theme.cache | |
function find_icons() { | |
find $ICON_ROOT -type f | grep -e "\(.png\|.svg\)" | |
} | |
# prefer not to use xargs | |
function read_icon_list() { | |
completed="no" | |
count_icon=0 | |
count_error=0 | |
count_bad_icon=0 | |
while read icon; do | |
count_icon=$(( count_icon + 1 )) | |
echo "-------------" | |
echo "count_icon=$count_icon" | |
echo "read icon=$icon" | |
if [[ ! ( -e $icon ) ]]; then | |
echo "TEST_ERROR: file not found: icon=$icon" | |
count_error=$(( count_error + 1 )) | |
continue | |
fi | |
dunstctl close-all | |
res=$? | |
if [[ $res -ne 0 ]]; then | |
echo "TEST_ERROR: dunstctl close-all failed" | |
count_error=$(( count_error + 1 )) | |
exit 1 | |
fi | |
icon_name=`basename "$icon"` # icon should not be the full path for this test | |
icon_name=${icon_name%.*} # strip the suffix | |
echo "icon name=$icon_name" | |
notify-send -i "$icon_name" -t $PAUSE "TEST count_icon=$count_icon" | |
res=$? | |
if [[ $res -ne 0 ]]; then | |
echo "TEST_ERROR: BAD_ICON: notify-send failed" | |
count_bad_icon=$(( count_bad_icon + 1 )) | |
continue | |
fi | |
done | |
completed="yes" | |
echo "completed=$completed" | |
echo "-------------" | |
echo "TOTALS" | |
echo "count_icon = $count_icon" | |
echo "count_bad_icon = $count_bad_icon" | |
echo "count_error = $count_error" | |
echo "completed = $completed" | |
echo "output to LOG = $LOG" | |
} | |
find_icons | read_icon_list | tee $LOG | |
# eee eof |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Script made by @garberw. Only instead of using the full icon path it only uses the icon name