From 9701687ba64e4d87ed370a58afc66514e5837400 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 23 Aug 2016 17:59:54 +0100 Subject: [PATCH] More intuitive use of desktop icons for mesh client --- src/freedombone-image-customise | 43 ++++++++++++++++++++++++++++++++- src/freedombone-image-mesh | 8 ------ 2 files changed, 42 insertions(+), 9 deletions(-) diff --git a/src/freedombone-image-customise b/src/freedombone-image-customise index f5acec42..17f49aae 100755 --- a/src/freedombone-image-customise +++ b/src/freedombone-image-customise @@ -714,7 +714,48 @@ function configure_user_interface { # Produce a text file on the desktop listing users on the mesh cat < $rootdir/usr/bin/list-tox-users #!/bin/bash -lstox | awk -F ' ' '{\$1=""; print \$0}' | sed -e 's/^[[:space:]]*//' | sort -d > /home/$MY_USERNAME/Desktop/Users.txt +users_list=\$(lstox | awk -F ' ' '{\$1=""; print \$0}' | sed -e 's/^[[:space:]]*//' | sort -d) +if [ \${#users_list[@]} -gt 0 ]; then + echo "\$users_list" > /home/$MY_USERNAME/Users.txt + chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/Users.txt + echo '[Desktop Entry]' > /home/$MY_USERNAME/Desktop/Users.desktop + if [ \${#users_list[@]} -lt 2 ]; then + echo "Name=\${#users_list[@]} User" >> /home/$MY_USERNAME/Desktop/Users.desktop + else + echo "Name=\${#users_list[@]} Users" >> /home/$MY_USERNAME/Desktop/Users.desktop + fi + echo 'Type=Application' >> /home/$MY_USERNAME/Desktop/Users.desktop + echo 'Comment=List of users' >> /home/$MY_USERNAME/Desktop/Users.desktop + echo 'Exec=pluma /home/$MY_USERNAME/Users.txt' >> /home/$MY_USERNAME/Desktop/Users.desktop + echo 'icon=pluma' >> /home/$MY_USERNAME/Desktop/Users.desktop + echo 'StartupNotify=false' >> /home/$MY_USERNAME/Desktop/Users.desktop + chmod +x /home/$MY_USERNAME/Desktop/Users.desktop + chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/Desktop/Users.desktop + + if [ ! -f /home/$MY_USERNAME/Desktop/tox.desktop ]; then + echo '[Desktop Entry]' > /home/$MY_USERNAME/Desktop/tox.desktop + echo 'Name=Tox Chat' >> /home/$MY_USERNAME/Desktop/tox.desktop + echo 'Type=Application' >> /home/$MY_USERNAME/Desktop/tox.desktop + echo 'Comment=Chat, VoIP and Video' >> /home/$MY_USERNAME/Desktop/tox.desktop + echo "Exec=bash -c 'qtox -p data'" >> /home/$MY_USERNAME/Desktop/tox.desktop + echo 'icon=qtox' >> /home/$MY_USERNAME/Desktop/tox.desktop + echo 'StartupNotify=true' >> /home/$MY_USERNAME/Desktop/tox.desktop + chmod +x /home/$MY_USERNAME/Desktop/tox.desktop + chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/Desktop/tox.desktop + fi +else + if [ -f /home/$MY_USERNAME/Users.txt ]; then + rm /home/$MY_USERNAME/Users.txt + rm /home/$MY_USERNAME/Desktop/Users.desktop + if [ -f /home/$MY_USERNAME/Desktop/Users.desktop ]; then + rm /home/$MY_USERNAME/Desktop/Users.desktop + fi + if [ -f /home/$MY_USERNAME/Desktop/tox.desktop ]; then + rm /home/$MY_USERNAME/Desktop/tox.desktop + fi + pkill qtox + fi +fi EOF chroot "$rootdir" chown $MY_USERNAME:$MY_USERNAME /usr/bin/list-tox-users chroot "$rootdir" chmod +x /usr/bin/list-tox-users diff --git a/src/freedombone-image-mesh b/src/freedombone-image-mesh index 7ea5b05e..d3575702 100755 --- a/src/freedombone-image-mesh +++ b/src/freedombone-image-mesh @@ -477,14 +477,6 @@ function create_tox_user { return fi - echo '[Desktop Entry]' > /home/$MY_USERNAME/Desktop/tox.desktop - echo 'Name=Tox Chat' >> /home/$MY_USERNAME/Desktop/tox.desktop - echo 'Type=Application' >> /home/$MY_USERNAME/Desktop/tox.desktop - echo 'Comment=Chat, VoIP, Video' >> /home/$MY_USERNAME/Desktop/tox.desktop - echo "Exec=bash -c 'qtox -p data'" >> /home/$MY_USERNAME/Desktop/tox.desktop - echo 'Icon=qtox' >> /home/$MY_USERNAME/Desktop/tox.desktop - echo 'StartupNotify=true' >> /home/$MY_USERNAME/Desktop/tox.desktop - chmod +x /home/$MY_USERNAME/Desktop/*.desktop chown ${MY_USERNAME}:${MY_USERNAME} /home/$MY_USERNAME/Desktop/* }