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
nixos/gtk: init #80865
nixos/gtk: init #80865
Conversation
gtk = { | ||
enable = mkEnableOption "Gtk theming configuration"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about the namespace here when there's gtk.iconCache
.
I feel like this module is all about https://developer.gnome.org/gtk3/stable/GtkSettings.html.
So I think we should do:
nixos/modules/config/gtk/settings.nix
gtk.settings.enable
gtk.settings.theme = {...
cc @jtojnar
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't know about gtk.iconCache
: I agree it conflicts with this modules but calling it gtk.settings
make it looks like a NixOS/rfcs#42 type of option, which is not
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@worldofpeace @rnhmjoj So how should we call it?
themeType = types.submodule { | ||
options = { | ||
package = mkOption { | ||
internal = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this internal? Shouldn't it have an example and a description, instead of the literalExample below?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@worldofpeace Package is used in a bunch of options, and is different dependening on the option. I don't see how we get rid of literalExamples.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't need to be internal because of this though. Also why is nullOr
necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@infinisil the package for option may be already provided in other place, for e.g. in qt
module or it maybe a common font. There is no reason to force user set package for every option here.
theme = mkOption { | ||
type = types.nullOr themeType; | ||
default = null; | ||
example = literalExample '' | ||
{ | ||
name = "Adwaita"; | ||
package = pkgs.gnome-themes-extra; | ||
}; | ||
''; | ||
description = "The GTK+ theme to use."; | ||
}; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see the most popular properties were added here for gtk settings, which is good.
But I believe this module should allow us to set any of the other properties in GtkSettings, rfc 42 style NixOS/rfcs#42.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll have to get back to you in a bit on an implementation suggestion.
(mkIf gtk2 { | ||
environment.etc."xdg/gtk-2.0/gtkrc".text = | ||
concatStringsSep "\n" ( | ||
mapAttrsToList toGtk2File settings | ||
); | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uhhn, this might be problematic if we allow to set any other properties. Because any other gtk.settings.*
will likely be for gtk3, and they don't have all the same properties.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@worldofpeace What should we do?
One thing this is lacking is a test suite. Ideally a Matrix of |
I think having a simple script verifying that the setting apply in different environments (i3, Sway, Plasma, GNOME Shell) should be good. Something like nixpkgs/nixos/tests/fontconfig-default-fonts.nix Lines 28 to 31 in ef34994
Looking at https://lazka.github.io/pgi-docs/#Gtk-3.0/classes/Settings.html#Gtk.Settings.props.gtk_theme_name, I would expect something like this to work but it does not seem to:
|
I might try to pick this up and make a new pr could be useful. If anyone has any concerns to raise about a new pr lmk. |
If we want this, we will probably want to not treat all GTK versions as monoliths and go more in the direction of RFC 42. |
Motivation for this change
See #71079
Qt part #80866
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)