More intuitive use of desktop icons for mesh client

This commit is contained in:
Bob Mottram 2016-08-23 17:59:54 +01:00
parent 8b5493c04e
commit 9701687ba6
No known key found for this signature in database
GPG Key ID: 0452CC7CEA982E38
2 changed files with 42 additions and 9 deletions

View File

@ -714,7 +714,48 @@ function configure_user_interface {
# Produce a text file on the desktop listing users on the mesh # Produce a text file on the desktop listing users on the mesh
cat <<EOF > $rootdir/usr/bin/list-tox-users cat <<EOF > $rootdir/usr/bin/list-tox-users
#!/bin/bash #!/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 EOF
chroot "$rootdir" chown $MY_USERNAME:$MY_USERNAME /usr/bin/list-tox-users chroot "$rootdir" chown $MY_USERNAME:$MY_USERNAME /usr/bin/list-tox-users
chroot "$rootdir" chmod +x /usr/bin/list-tox-users chroot "$rootdir" chmod +x /usr/bin/list-tox-users

View File

@ -477,14 +477,6 @@ function create_tox_user {
return return
fi 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 chmod +x /home/$MY_USERNAME/Desktop/*.desktop
chown ${MY_USERNAME}:${MY_USERNAME} /home/$MY_USERNAME/Desktop/* chown ${MY_USERNAME}:${MY_USERNAME} /home/$MY_USERNAME/Desktop/*
} }