spheras / desktopfolder

Bring your Desktop Back to Life
GNU General Public License v3.0
202 stars 41 forks source link

Respect the real Desktop folder name if the environment supports this… #216

Closed fossfreedom closed 5 years ago

fossfreedom commented 5 years ago

…. Resolves #210

Note. I went for a generic solution rather than try to do a "if pantheon do this ... else do that"

This is because it is likely (but not certain) that in 19.04, GNOME will lose the xdg-user-dir DESKTOP functionality in the same way as Elementary has ... i.e. GNOME-Shell no longer supports a desktop folder.

Thus the translated name of the Desktop folder should come from DesktopFolder translations rather than trying to figure out a textdomain for Pantheon ... and a textdomain for every DE that DesktopFolder may run on.

spheras commented 5 years ago

Ok, I understand. I think this change is needed. I had the suspect that elementary was creating a "Desktop" folder by default, in English, but I did a fresh install and that folder is only created in the live image (I don't know why that folder is created)... after the installation, there is no "Desktop" folder.

The only change I would request is the check of an existent "Desktop" folder to avoid problems with existing Desktops created by DesktopFolder... I mean, if the old "Desktop" folder already exists, then use that, because it is reasonable to think that desktopfolder was installed previously and that folder has been used by default... What do you think?

fossfreedom commented 5 years ago

I will have a look.

On Tue, 4 Dec 2018, 02:54 José Amuedo Salmerón notifications@github.com<mailto:notifications@github.com wrote:

Ok, I understand. I think this change is needed. I had the suspect that elementary created a "Desktop" folder, in English, but I did a fresh install and that folder is only created in the live image (I don't know why that folder is created)... after the installation, there is no "Desktop" folder.

The only change I would request is the check of an existent "Desktop" folder to avoid problems with existing Desktops created by DesktopFolder... I mean, if the old "Desktop" folder already exists, then use that, because it is reasonable to think that desktopfolder was installed previously and that folder has been used by default... What do you think?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/spheras/desktopfolder/pull/216#issuecomment-443951635, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AA8zkFwhYVtw8R6or7uGI2J2PZH1vWrSks5u1ePtgaJpZM4Y_faX.

aljelly commented 5 years ago

I was going to suggest about adding a translation to Desktop Folder for the desktop folder's name for distros that don't have a Desktop folder specified, but the problem is that if the translation changes at all (e.g. there's a typo in one locale and someone fixes the typo), a new desktop folder will be created and used instead of the previous one when Desktop Folder is next updated.

The only way to prevent that is to either maintain a list of folder names that are accepted as the Desktop folder, or maintain a list of folder names for each locale to rename to the new translation. Either way it would mean someone would have to keep track of each change to that word in any new translation to Desktop Folder. Unless we get some automatic committing script/bot on GitHub or otherwise to do it or something.

That's partially why I ultimately suggested to use the DE's translation instead (or some component included with it), so we wouldn't have to worry about that. Translation updates to them are probably less frequent and they likely have more complete translations. If other DEs are like Pantheon they may have a translation for "Desktop" for a settings section for doing things like changing the background.

fossfreedom commented 5 years ago

@aljelly

Under elementary ...

If you run xdg-user-dirs-update --set DESKTOP full-path-to-your-desktop directory

Does it create a DESKTOP entry in ~/.config/user-dirs.dirs ?

After that does xdg-user-dir DESKTOP return the new set path ?

On Tue, 4 Dec 2018 at 14:03, aljelly notifications@github.com<mailto:notifications@github.com> wrote:

I was going to suggest about adding a translation to Desktop Folder for the desktop folder's name for distros that don't have a Desktop folder, but the problem is that if the translation changes at all (e.g. there's a typo in one locale and someone fixes the typo), a new desktop folder will be created and used instead of the previous one when Desktop Folder is next updated.

The only way to prevent that is to either maintain a list of folder names that are accepted as the Desktop folder, or maintain a list of folder names for each locale to rename to the new translation. Either way it would mean someone would have to keep track of each change to that word in any new translation to Desktop Folder. Unless we get some automatic committing script/bot on GitHub or otherwise to do it or something.

That's partially why I ultimately suggested to use the DE's translation instead (or some component included with it), so we wouldn't have to worry about that. Translation updates to them are probably less frequent, they likely have more complete translations, and they may already have a way of handling a change to the Desktop folder's name if you're able to upgrade the distro without doing a clean installation.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/spheras/desktopfolder/pull/216#issuecomment-444110295, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AA8zkNZCr6rUcKmg6e39biUQB7Qo_G2_ks5u1oC5gaJpZM4Y_faX.

aljelly commented 5 years ago

Yes, that works:

# This file is written by xdg-user-dirs-update
# If you want to change or add directories, just edit the line you're
# interested in. All local changes will be retained on the next run.
# Format is XDG_xxx_DIR="$HOME/yyy", where yyy is a shell-escaped
# homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an
# absolute path. No other format is supported.
# 
XDG_DOWNLOAD_DIR="$HOME/Downloads"
XDG_TEMPLATES_DIR="$HOME/Templates"
XDG_PUBLICSHARE_DIR="$HOME/Public"
XDG_DOCUMENTS_DIR="$HOME/Documents"
XDG_MUSIC_DIR="$HOME/Music"
XDG_PICTURES_DIR="$HOME/Pictures"
XDG_VIDEOS_DIR="$HOME/Videos"
XDG_DESKTOP_DIR="$HOME/Desktop"

That might be a good solution. If there's no entry we add it using xdg-user-dirs-update (or some Vala equivalent if there is one) and then use that for then on. That would solve the problem of maintaining some large previous translations list.

fossfreedom commented 5 years ago

Ok. I have reworked this with various scenarios.

There is one more that I haven't figured out ...

When the Desktop folder name itself is changed whilst DesktopFolder is running ... I.e. if the user changes it via the command line.

Any ideas how to detect that? If it changes what should happen? Somehow force a restart of DesktopFolder ?

spheras commented 5 years ago

Sorry, I'm not sure about the status of this PR. My last idea was that this had pending changes, are those made? I've been a bit disconnected the last 2 weeks :roll_eyes:

fossfreedom commented 5 years ago

There is one bit I am unsure of. How to detect when a person manually changes the desktop folder name e.g. through the terminal or via a file manager.

Thoughts on where in the code that detects when the home folder name is changed?

On Sun, 30 Dec 2018, 18:20 José Amuedo Salmerón notifications@github.com<mailto:notifications@github.com wrote:

Sorry, I'm not sure about the status of this PR. My last idea was that this had pending changes, are those made? I've been a bit disconnected the last 2 weeks 🙄

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/spheras/desktopfolder/pull/216#issuecomment-450577933, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AA8zkPUmIIPmTq1nHnNhDUnFVBarqiw9ks5u-QPcgaJpZM4Y_faX.

spheras commented 5 years ago

I've confirmed that the event is captured when the ~/Desktop folder is moved. Maybe there is the point to capture that change.