project-trident / trident-core

Core Packages and system overlay files
http://project-trident.org
BSD 2-Clause "Simplified" License
33 stars 10 forks source link

Proposal for /usr/local/share/trident/scripts/generate-desktop-entry #91

Closed gc-user closed 4 years ago

gc-user commented 5 years ago

Is your feature request related to a problem? Please describe. As ask for by @beanpole135 I want to share my edits to the generate-desktop-entry file. As I like to have links to removable drives in /media which was the initial state of the trueos-mount file. But as that was removed shortly after that, I always edited that file. So, I'm not sure if Ken really wants to reintroduce that feature. Also, I never likes the volume label "no volume". So, I changed that, too, back in the day. Now, that I learned that generate-desktop-entry is the new trueos-mount and automount also works again on my system, I was able to test my edit to the script on my Trident system, stable-U1 in this case. It still seems to work.

I didn't really came up with the edits myself but just reintroduced the code from the early versions from trueos-mount back by trial and error and most probably the help of Ken on discourse until the behaviour of the automount process was back to how I was used to and how like it.

The "|" is just to make github to display "+" and "-" as is and not interpret it. The "-" just indicates the out-commented parts of the script, I didn't really delete them. The last 3 lines of code that are added and were previously removed might have to be placed at the end of the script. At least that's why I think I edited the script back then like this.

Describe the solution you'd like So, here are my edits:

  1. The minor edit |- volume="NO_NAME" |+ volume="usb_drive"

    in fact, I use another name. And as it should be able to have a different term for the respective locale the selection of terms might have to be added to the file that hold the terms for each locale.

  2. The functional edit:

|- #Now add additional fsck action for any non-optical device, based on FS |- if [ "${type}" != "udf" ] && [ "${type}" != "cd9660" ]; then |- xdg_actions_list="${xdg_actions_list}fsck;" |- xdg_actions="${xdg_actions} |- [Desktop Action fsck] |- Name="Check Filesystem" |- Icon=document-edit-decrypt-verify |- Exec="qsudo fsck -t ${type} ${dev}" |- " |- fi

|- #Generate the XDG desktop file corresponding to this device |- echo "[Desktop Entry] |- Version=1.1 |- Type=${xdg_type} |- Name=${volume} |- GenericName=${xdg_comment} |- Comment=${xdg_comment} |- Icon=${xdg_icon} |- Actions=${xdg_actions_list} |- ${xdg_actions} |- " > /media/${dev}.desktop

|- if [ -d /media/autofs ] ; then |- rm /media/autofs |- fi

|+ #Record the device->label connection for later |+ echo ${volume} > /tmp/.${dev} |+ #make the symlink |+ ln -s "${auto_dir}" /media/"${volume}"

|+ if [ -d /media/autofs ] ; then |+ rm /media/autofs |+ fi

Describe alternatives you've considered

Additional context

beanpole135 commented 5 years ago

ok, so what these edit do is completely de-activate the XDG shortcut and replace it with a blind symlink to the autofs mountpoint. This will work for mount-able filesystems, but completely breaks all the optical media support and many extra filesystem support features (such as fsck for UFS filesystems so they can become usable again and such).

Because of this, I don't think we want to bring your patch/changes in directly, but we might able to integrate a dual-link system where it generates both the XDG shortcut file AND a symlink. Will need to look into this a bit more...

gc-user commented 5 years ago

I told you so... :-) (...that it probably isn't suitable for anyone but me...) Yeah, I was wondering what I was commenting out - and why - with this larger portion of script. And as I haven't yet used any optical drives and devices other than plain FAT32 or NTFS thumb drives I never ran into any problems. I could try re-introducing the big chunk of code back into my system and see if something stops working with my setup. Otherwise I just leave it "switched on" from then on. Thanks for reviewing my edit and your insights into what I did!