Hoping someone smarter than me can help me...
Launchers on my desktop (.desktop) files lose permission to be executable every time I make major changes to my OS, such as my upgrade to 18.04 (Bionic Beaver) or changing windowing manager (Gnome). After these changes,double clicking each icon provided by a launcher file, for example, audacity.desktop results in a message pop up requesting that I "Trust and Launch" the application. Very inconvenient for me because I have loads of launchers well organized in various folders on the desktop based on what I may be developing (Website design versus printed desktop publishing or multimedia editing and DVD creation, etc.) I should not have to open each application from the launchers, click "Trust and Launch", then close it just to make sure it works later when I really need it. Therefore, I have written a simple BASh script to process all the launchers in a given folder, starting with the ~Desktop/ folder itself, but for some weird reason, it just won't work! Here is my production script which doesn't work:
#!/bin/sh for myDesktop in $HOME/Desktop/*.desktop do /usr/bin/gio set \"$myDesktop\" \"metadata::trusted\" "yes" done
I end up getting these errors instead of the desired result:
gio: Too many arguments Usage: gio set [OPTION…] LOCATION ATTRIBUTE VALUE... Set a file attribute of LOCATION. Options: -t, --type=TYPE Type of the attribute -n, --nofollow-symlinks Don’t follow symbolic links + Done for myDesktop in $HOME/Desktop/*.desktop; do /usr/bin/gio set \"$myDesktop\" \"metadata::trusted\" "yes"; done
Here is my simulation script which produces the desired output with echo, that is, the desired commands per launcher is simply printed, NOT EXECUTED:
#!/bin/sh for myDesktop in $HOME/Desktop/*.desktop do echo /usr/bin/gio set \"$myDesktop\" \"metadata::trusted\" "yes" done
The commands created by my simulation prints all the commands for each launcher as needed correctly, for example:
/usr/bin/gio set "/home/bruce/Desktop/audacity.desktop" "metadata::trusted" yes
Copying the command above and running it by itself has the desired effect, in this case, audacity launches as "Trust and Launch", but having to run each command at at the cli every single launcher is even less convenient than just double clicking on each launcher icon and then clicking "Trust and Launch" ... back to square one! Note: Filenames must be quoted because some applications, such as gedit have launchers like "Text Editor.desktop" with spaces in them.
I don't understand why I can get the script to print the correct command for "Trust and Launch" on each *.desktop launcher but BASh refuses to actually run them (after removing the echo command). I have never seen anything like that before, simulation works, but the actual script consistently fails.
Thanks in advance