Hi!
I was able to solve this. I noticed that anbox apps are displayed immediately after installation, as soon as the desktop file is placed in /home/phablet/.local/share/applications . So I tried to work with two desktop files which are moved back and forth between /home/phablet/.local/share/applications and /home/phablet/Downloads . The anboxtoggle.sh shovels those back and forth with each disable/enable run instead of the icons - they stay in place.
anboxtoogle.sh looks like this:
#!/bin/bash
anboxtool=($(anbox-tool status))
atenabled=${anboxtool[5]}
if [ "$atenabled" == "YES" ]; then
anbox-tool disable
mv /home/phablet/Downloads/anboxtoggleRED.desktop /home/phablet/.local/share/applications/anboxtoggleRED.desktop
mv /home/phablet/.local/share/applications/anboxtoggleGREEN.desktop /home/phablet/Downloads/anboxtoggleGREEN.desktop
else
anbox-tool enable
mv /home/phablet/Downloads/anboxtoggleGREEN.desktop /home/phablet/.local/share/applications/anboxtoggleGREEN.desktop
mv /home/phablet/.local/share/applications/anboxtoggleRED.desktop /home/phablet/Downloads/anboxtoggleRED.desktop
fi
The desktop file anboxtoggleGREEN.desktop:
[Desktop Entry]
Name=Anboxtoggle
Type=Application
Terminal=false
Icon=/home/phablet/.local/share/applications/anbox-green.png
Categories=Utility
Comment=Switch between anbox enabled and disabled
X-Ubuntu-Touch=true
Exec=/home/phablet/.local/share/applications/anboxtoggle.sh
For anboxtoggleRED.desktop you just need to change the icon name in the Icon line to anbox-red.png. You need two different icon pictures, called anbox-red.png and anbox-green.png, as well (just grab some from the net, and change the colours with gimp or a similar program, if neccessary).
Make the other files executable, and put the two icon files and one of the desktop files in /home/phablet/.local/share/applications/, the other desktop file in /home/phablet/Downloads/. (If Anbox currently is runnig, put anboxRed.desktop in .../applications, if not anboxtoggleGREEN.desktop.)
Now there should be just one icon in the app drawer, indicating if anbox is enabled or not, changing is colour with every call.
Have fun!