-
-
Notifications
You must be signed in to change notification settings - Fork 602
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
XDG base directory spec #1003
XDG base directory spec #1003
Conversation
@giox069 @nastasi @Vladimir-csp @larchunix @weberhofer (and whoever in the Remmina cloud) I'd like your opinion if you have time. |
OK, tested. |
Thank you.
Probably the best is to provide scripts to migrate and merge profiles and configuration files? This should fix also the second issue.
If Remmina will try to write inside /etc or /usr/ it's normal because your user doesn't have the right to write there.
What are those "GNOME CDS's"? |
By XDG hierarchy logic, remmina should show all connections that exist in ${XDG_DATA_HOME}:${XDG_DATA_DIRS}. When file names collide, use the highest priority file. Write only to ${XDG_DATA_HOME} (obviously). I.e. when editing connection that came from ${XDG_DATA_DIRS}, create new file in ${XDG_DATA_HOME} overriding it. CSD's - client side decorations, when application tries to do window manager's job. Looks out of place outside GNOME. |
Ok, I'll read more carefully later.
This must be reported as a new request. Provide also some examples. I use i3wm so I don't see any difference usually. I'll do my best. Thanks |
No, sorry but this by me it's wrong, or I get it wrong. Now, and here I'm fighting with myself to find a good logic, if I open and modify a file that is inside XDG_DATA_DIRS (I don't even have a ${XDG_DATA_HOME} ), should I save it back to the XDG_DATA_DIRS or the ${XDG_DATA_HOME} one? Showing/merging both files it's not something any other applications do as far as I know. |
${XDG_DATA_DIRS} (usually Writing of user data and configuration should be performed to ${XDG_DATA_HOME} (usually When reading data or configuration, any particular file in higher priority dir wins, not the whole dir wins. I.e. If you have If you have connection files:
client should produce a list:
where connection1 was read from |
For the preferences files we cannot do anything at the moment because remmina write the whole file in one shot. We should write to the file for each setting, using your workflow. Nobody has the time now to rewrite this part as there are other more important. Regarding the data file I'll see how much I can improve it. Even if some months ago I've removed a lot of spaghetti here and there, there is still a lot of work to do. I'll improve this PR a little bit and than we will see. |
No, described workflow does not require merging/overriding configuration per setting (although it would be cool :)). Write in one shot. Merging/overriding is done per file, file is atomic.
By empty here I meant dir, not file. Just an example. |
@Vladimir-csp May I ask you one more validation please? |
Config: it still does not save user config, but reads system-level config successfully. |
Thanks for the test.
Weird, it shouldn't, I'll check
Remmina file names are composed by a random generated number like 123456789 and the extension .remmina. If you have the same file (so, the same file name) in the XDG_DATA_DIRS and XDG_USER_DATA_DIR, the one in the XDG_USER_DATA_DIR will be used. If, on the other way around, that files does not exists, remmina will copy it on the XDG_USER_DATA_DIR. I think your issue is that you have files that have a different naming convention and this, at the moment, cannot be changed easily. If it's not this the issue please provide me some real example. Another thing I cannot do easily is the scenario where the user already have a profile named 12345.remmina and the admin wants to update it on a system-level. It'd complicate too much things I think. @joakim-tjernlund can you give also your feedback please? |
If user has an override, there is nothing to be done. The problem is that remmina creates this override by itself on launch. It should be created only when it is required (when user edits connection or config).
Naming convention does not matter, as long as file name is the same. |
I don't see how can I do it without rewriting a quite big part of Remmina and I've an hard time understanding your scenario (my bad) |
Read what exists, write when necessary, repeat. If user does not edit anything, nothing gets written. If user edits something, affected files are written to user-level dir and get priority. From what I am able to see from the outside without knowledge of remmina's internals, it can already find topmost priority data and config files in the hierarchy. So it is a matter of repeating this step when something gets edited. And write only on edit. |
It works on my side. |
Rebuilt current xdg branch, now user-level config is copied from system level on launch. |
I've created a new user and I had a remmina.pref file under /usr/local/etc/xdg/remmina and a profile under /usr/local/share/remmina. Starting Remmina with this user have created the directories .config/remmina and .local/share/remmina and copied the profile and the remmina.pref file with the default settings. Then I've created a new profile and modified the existing one (the one that was under /usr/local/share/remmina) and everything is fine... Are you sure you setup everything correctly as described by the spec? |
Fairly typical XDG setup:
A bit more extensive testing... system-level connections: |
Ok, I think I got it, I've a break in the loop that I should remove, sorry. |
ok... Hope it's the good one |
Looks good! Correct files are being chosen. (at least for data, I haven't tested multiple $XDG_CONFIG_DIRS. If it uses the same algorithm, then it should be fine). So the only thing left to do is to make copying on-demand, rather than on start. This would probably require defaulting option "remember last view for each connection" to false and making "save settings when starting connection" to only write when something was actually changed in connection. ...some other minor thing: Deleting connection from the list. If connection file exists in system-level dirs, user can not actually remove it. There are two ways of dealing with this:
|
Ok, so I'm going to merge this and close your initial request. Open a new one when this code will be released please. Thanks a lot again for your support. |
Added full support for XDG_DATA_DIRS and XDG_CONFIG_DIRS as requested by #818
To test you can move away your ~/.remmina, or ~/.config/remmina and ~/.local/share/remmina directories.
You can (manually at the moment), populate your $XDG_CONFIG_DIRS/remmina (it should be /etc/xdg/remmina) with your ~/.config/remmina/remmina.pref (and move away the ~/.config/remmina directory). Same for the .remmina files you have under ~/.local/share/remmina, that you can copy into $XDG_DATA_DIRS (normally /usr/share/remmina or /usr/local/share/remmina), again, removing the ~/.local/share/remmina directory.
As a last improvements I was thinking to add by default some template profiles to show up some different Remmina configurations in the XDG system directories.
I think there is still a big issue, but I don't get how should be the good behaviour.
If there are files in the system directories and the user data and config directories don't exists yet, remmina will try to save new profiles under the system directories.
This is quite normally as per my logic and comprehension of the spec.
I can write a script to migrate profiles if you like.