lxappearance 0.6.3 is no longer able to save gtk2 settings. This is a regression from 0.6.2.
nix-env -iA nixos.lxappearance) and lauch lxappearance.~/.gtkrc-2.0 file doesn't change or doesn't get created if it didn't already exist.Relevant upstream commit
Prior to that commit that's included starting with 0.6.3 release lxappearance.would always save gtk2 settings in ~/.gtkrc-2.0 file. This new commit implements different logic that decides where to save the settings based on result of gtk_rc_get_default_files function. To my understanding the logic goes as follows:
$HOME~/.gtkrc-2.0As for gtk_rc_get_default_files itself it will return the following paths:
$GTK2_RC_FILES env variable is set return paths in that variableGTK_DATA_PREFIX/share/gtk-2.0/gtkrc$XDG_CONFIG_DIRS $path/gtk-2.0/gtkrc$HOME/.gtkrc-2.0Due to the order in which those are considered the first matching item will be the one residing under $HOME/.nix-profile coming from $XDG_CONFIG_DIRS, and since it is on a filesystem that's mounted read-only updating settings will fail:
$ echo $XDG_CONFIG_DIRS
/home/pbogdan/.nix-profile/etc/xdg:/nix/var/nix/profiles/default/etc/xdg:/run/current-system/sw/etc/xdg
The question now is - could this be considered an upstream bug? Should lxappearance perhaps collect _all_ of the paths under $HOME and try writing to those until one succeeds? Since $HOME/.gtkrc-2.0 is already included in the set returned from gtk_rc_get_default_files that would likely work, and wouldn't necessitate a need for the fallback behavior.
Or could this be considered a nix specific bug that would require us to create a patch that filters out ~/.nix-profile when considering where to save the settings?
Based on git history ping @zimbatm and @romildo in case they have any thoughts on this issue.
It looks like an upstream bug to me. Assuming that any of the paths in $XDG_CONFIG_DIRS is writeable is not correct (the default is /etc/xdg which is not user-writeable). The XDG spec reserves another environment variable for writes called $XDG_CONFIG_HOME.
What it should do is read the config from both $XDG_CONFIG_DIRS and $XDG_CONFIG_HOME and write to $XDG_CONFIG_HOME.
It doesn't seem like gtk2 itself cares about $XDG_CONFIG_HOME as far as loading its settings is concerned so saving them there wouldn't be an option.
At the same time the assumption made by lxappearance about a path prefixed with $HOME being writable also may not hold in presence of a folder like our $HOME/.nix-profile
Anyway, I will go ahead and open an upstream issue as the current behaviour seems questionable.
Reported upstream at https://sourceforge.net/p/lxde/bugs/874/ Please chime in if anything I wrote is incorrect, or comment here and I can rely details to upstream if you don't wish to create a sourceforge account.
Nice, the writeup is clear and easy to read. The only thing I would add at the end would be a recommendation to split the reading and writing of configuration. Extend the existing heuristic for reading by adding $XDG_CONFIG_HOME in the mix and introduce a new writing heuristic that would use $GTK2_RC_FILES, $XDG_CONFIG_HOME/gtkrc-2.0 in order of preference. Deprecate $HOME/.gtkrc-2.0.
+1 this bug affects me too (GTK2 settings not getting saved).
Except for me it also doesn't even see GTK themes.
@Nobabs27 only workaround I'm aware of at the moment is reverting back to 0.6.2 :/
As for themes not appearing - how did you install those? System-wide via configuration.nix or into your user's profile? Also what does:
$ echo $GTK_DATA_PREFIX
say for you when ran in terminal.
@pbogdan
How do I revert?
Installed using configuration.nix.
Returns/says nothing.
@Nobabs27 you can try the following in your configuration.nix for reverting the package to 0.6.2:
nixpkgs.config.packageOverrides = pkgs:
{ lxappearance = pkgs.lxappearance.overrideAttrs(old: rec {
name = "lxappearance-0.6.2";
src = pkgs.fetchurl {
url = "mirror://sourceforge/project/lxde/LXAppearance/${name}.tar.xz";
sha256 = "07r0xbi6504zjnbpan7zrn7gi4j0kbsqqfpj8v2x94gr05p16qj4";
};
});
};
And if the themes are installed via configuration.nix as well can you try launching lxappearance with the following command and see if they are found:
$ GTK_DATA_PREFIX=/run/current-system/sw lxappearance
It works when doing the special command, even with lxappearance 0.6.3.
So I guess lxappearance isn't the issue.
How do I get that set everytime though?
To answer my question:
environment.sessionVariables = {
GTK_DATA_PREFIX = "/run/current-system/sw";
};
Nvm after further testing it was actually lxappearance as well as that var not being set...
I found that the lxappearance-gtk3 introduced by @romildo in https://github.com/NixOS/nixpkgs/pull/26496 actually solves this! It applies its settings to both gtk2 (~/.gtkrc-2.0) and gtk3 (~/.config/gtk-3.0/settings.ini) config files successfully.
(triage) If switching to lxappearance-gtk3 solves the problem, can this issue be closed?
I think we should make lxappearance be the gtk3 version
Thank you for your contributions.
This has been automatically marked as stale because it has had no activity for 180 days.
If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.
Here are suggestions that might help resolve this more quickly:
Most helpful comment
It looks like an upstream bug to me. Assuming that any of the paths in
$XDG_CONFIG_DIRSis writeable is not correct (the default is/etc/xdgwhich is not user-writeable). The XDG spec reserves another environment variable for writes called$XDG_CONFIG_HOME.What it should do is read the config from both
$XDG_CONFIG_DIRSand$XDG_CONFIG_HOMEand write to$XDG_CONFIG_HOME.