Refresh icon view in App Drawer in real time
-
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!
-
Hi,
Everything works fine, thanks! -
Hmmmm.... Don't know why, but the icons vanished from /home/phablet/.local/share/applications/ after a restart of Unity8. I put them back in, but renamed them to match the desktop files, so they now are called anboxtoggleGREEN.png and anboxtoggleRED.png; changed that in the desktop files, too. Hope this will work permanently,
-
You're right, I just restarted Unity8 and they vanished.
Tell me if your solution works before I transfer them again.
Otherwise, I will transfer them to Downloads and copy them to ../applications everytime I restart Unity8 (not often)... -
Well, the icons survived a couple of unity8 restarts, and two device restarts, so it looks like the name was important... For all anbox apps the names for the desktop files and their icons are identical except for the ending, so I thought that could do the trick.
-
Two Unity8 restarts and it still works! Thanks!
-
@chrisse Two Lomiri restarts
-
Hi,
I tried to use the script, but it couldn't get it to work. I can see the red icon in the drawer but nothing happens when I push the button. Do I have to activate something so that the script can run properly?
Do I need to make script executable with root rights? -
@TobsEnd
Yes, you need to make the script executable. It will run without r/w rights later on. -
@hankschwie I do i have to use
chmod +x
or ```
sudo chmod +x -
@TobsEnd
Sorry, I didn't use chmod, but used a nautilus function to set it executablels -la
in the directory tells me:rwxr-xr-x 1 heinrich heinrich 631 Mär 15 19:30 anboxtoggle.sh
for the skript, so I guess you would have to use the sudo version.