-
Notifications
You must be signed in to change notification settings - Fork 427
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Suggestion] Integrate .desktop files in a more standard manner, similar to snaps, flatpak, nix etc #386
Comments
I really like this idea! It would make life a lot easier thanks 😄 I'll think on how to organize it, but ideas are welcome! |
What I was thinking is just that managing XDG_DATA_DIRS could be tricky for the installer: if we're doing a rootful install (package or sudo ./install), we can just put a script in EDIT: This will also be super-handy for the new |
I'm glad you like it Luca! I don't know what generate-entry is yet, (I'm intrigued) but I'm glad it helps there, it also shows that it's a solution which would help everything fall into place! The command I gave doesn't require root privileges or is the issue the lack of permanence of that command? That the command needs to be triggered on login? Yes, I did over look something in the initial post and the command I gave wasn't sufficient to make the change persistent, I came across something that is too hacky for my liking: echo export 'XDG_DATA_DIRS=$HOME/.distrobox/share:$HOME/.share:"${XDG_DATA_DIRS:-/usr/local/share/:/usr/share/}" ' >> ~/.xsessionrc Though it definitely works, is persistent and does not requite root privileges. However, it could lead us in the right direction, what is needed is a destination that more appropriate. I wonder how flatpak/snap and the rest go about this? A look at their source code may be in order there however they may well use root user permissions. |
Yea I know, we could also use the ~/.profile file, but I'm keen to not touch other people's files if possible 😄
They just drop the line in a file in |
For rootless install, a file could be added to https://www.man7.org/linux/man-pages/man5/environment.d.5.html |
This seems to be systemd specific, and to work with systemd-units |
There are a few suggestions here. A cron job to run the command might be best? Since it's part of Linux-utils and thus supported by sys-v as well as more niche init systems. Cron jobs execute commands as non-root users and I'm guessing it can be set up rootlessly also? |
Instead of touching We could either use I don't use
Now I have this neat puppy here: |
@luc14n0
Exported files and generated entries aught be displayed in app menu's currently, if they don't in your case for whatever reason then this should be raised as a separate issue and an error. This isn't the purpose behind my suggestion, which is a better means of managing exported files from a developers perspective, making cleaning up exports easier, thereby not cluttering up default locations. |
I was thinking @codexMechanicus I'll export stuff into (for example) On removal of the container, simply remove the |
I was just giving a silly bad example. My main point was that for a standard location to place |
that's what it is already done, they are exported in The idea was to have somewhat a dedicated directory in order to not litter the $XDG_DATA_HOME/applications, and have an easier way to cleanup when we remove a distrobox for example |
That works and has all the benefits while avoiding the issues faced by other solutions, I can't see any downsides myself! 😄 |
Well, for what is worth in my Tumbleweed system I have:
The |
I don't know if RMP lint would necessarily be checking whether XDG's Desktop Entry Specification is being adhered to. I think it's best practice not to clutter it whether it's technically permissible or not. Those who work closest to XDG avoid cluttering it, as with Gnomes Flatpak, XDG was pretty much instigated by Gnome devs. |
I'm sorry you got me wrong here. In the
So, from that, we can infer that My point about RPM Lint was more of whether or not we get a warning/error when using a subfolder under class MenuXDGCheck(AbstractFilesCheck):
"""
Check whether MenuXDG files installed by a package are valid.
"""
def __init__(self, config, output):
# desktop file need to be in $XDG_DATA_DIRS
# $ echo $XDG_DATA_DIRS/applications
# /var/lib/menu-xdg:/usr/share
super().__init__(config, output, r'/usr/share/applications/.*\.desktop$')
Where I gave some insights (I hope?) about using The Flatpak way was mentioned earlier, but there was the concern about touching user configuration files, and with good reason as I've experienced Miniconda wiping my entire Between user configs and symlinks, my personal preference is user configs. But if choosing so we could either alert users to add the snippet to their configs (and make use of good documentation too) or implement the right logic to automatically add it to the most used shells (good testing is our friend here). And I could give a hand on this if needed. |
What do you have against symlinks? It seems to be the option that needs less work, less tailoring to specific systems etc. Does it really makes a difference where files are stored from the perspective of uninstallation? Surely if we include our applications folder in an installation package it will be removed by the package management system, and we can reference the directory in the uninstallion script. |
Technically RPMlint allows stuff like Also, while I agree we could just document and warn the user about it, I'm not so keen to leave to the user this |
Nothing in particular really, if implemented right and it's working who am I to complain, right? 😄 I just feel they are less systematic to work with, but this is more of a personal opinion/bias than anything else since I never had to implement shell code to manage symlinks before.
No, I don't see a difference. Yes, package managers should do the right thing if we don't do anything obscure, and so does the uninstallation script. |
Luca, you previously said:
I didn't pay due attention to some of those words before. Now I see some of your concerns clearer and why the temptation of using symlinks: The Unless this flag is e.g. removed and more standard prefixes are enforced - like
Not exactly.
Using
So one way or another someone/something must call
I have to agree on this. Most of users don't read documentation, I see this all the time. A suggestion I'd like to make then:
|
This is similar to a request I made before but is much better thought out and inline with standard XDG practice.
Getting to the point, distrobox app exports could better conform to standard practices by storing exported .desktop files in a directory specifically for distrobox exports, while still showing up in users menu's.
for example $HOME/.distrobox/share
or any where deemed a better location.
To ensure exports show up in the users desktop menus the paths would be added to the users XDG_DATA_DIRS
via a command such as:
`echo export 'XDG_DATA_DIRS=$HOME/.distrobox/share:$HOME/.share:"${XDG_DATA_DIRS:-/usr/local/share/:/usr/share/}" ' >> ~/.xsessionrc
(This command sets up default XDG_DATA_DIRS if they are not already set up)
The .desktop files could also be stored in container specific files .distrobox/ubuntu/share and symlinked to .distrobox/share or whatever the chosen path is. Which would help with issue #301 and allow these files to be deleted simply by deleting the folder.
There are reasons other applications that export .desktop files create their own directory and add the directory to XDG_DATA_DIRS, and making it easier to clean up and manage exports I expect is a key aspect of it. This is practised by GNOME devs and others who are involved in discussing XDG/freedesktop.org standards.
I think if this is not standard behaviour it should at least be an available option via config files, or app exports should accept a custom location so this can be implemented simply by users.
Stack Exchange answer where I got the idea: https://unix.stackexchange.com/questions/310666/nix-desktop-files
*PS: If this suggestion is approved of, I can implement it and submit a pull request.
The text was updated successfully, but these errors were encountered: