1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-26 21:19:45 +01:00

gtk: add support for wayland

This commit is contained in:
gnidorah 2018-09-22 19:30:13 +03:00 committed by Robert Helgesson
parent a1a7e7cd24
commit 33a2943e8c
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89

View file

@ -8,6 +8,8 @@ let
cfg2 = config.gtk.gtk2;
cfg3 = config.gtk.gtk3;
dag = config.lib.dag;
toGtk3Ini = generators.toINI {
mkKeyValue = key: value:
let
@ -27,6 +29,16 @@ let
in
"${n} = ${v'}";
toDconfIni = generators.toINI {
mkKeyValue = key: value:
let
tweakVal = v:
if isString v then "'${v}'"
else toString v;
in
"${key}=${tweakVal value}";
};
fontType = types.submodule {
options = {
package = mkOption {
@ -141,6 +153,21 @@ in
<filename>~/.config/gtk-3.0/gtk.css</filename>.
'';
};
waylandSupport = mkOption {
type = types.bool;
default = false;
description = ''
Support GSettings provider (dconf) in addition to
GtkSettings (INI file). This is needed for Wayland.
</para><para>
Note, on NixOS the following line must be in the
system configuration:
<programlisting>
services.dbus.packages = [ pkgs.gnome3.dconf ];
</programlisting>
'';
};
};
};
};
@ -159,6 +186,16 @@ in
optionalAttrs (cfg.iconTheme != null)
{ gtk-icon-theme-name = cfg.iconTheme.name; };
dconfIni =
optionalAttrs (cfg.font != null)
{ font-name = cfg.font.name; }
//
optionalAttrs (cfg.theme != null)
{ gtk-theme = cfg.theme.name; }
//
optionalAttrs (cfg.iconTheme != null)
{ icon-theme = cfg.iconTheme.name; };
optionalPackage = opt:
optional (opt != null && opt.package != null) opt.package;
in
@ -178,6 +215,23 @@ in
toGtk3Ini { Settings = ini // cfg3.extraConfig; };
xdg.configFile."gtk-3.0/gtk.css".text = cfg3.extraCss;
home.activation = mkIf cfg3.waylandSupport {
gtk3 = dag.entryAfter ["installPackages"] (
let
iniText = toDconfIni { "/" = dconfIni; };
iniFile = pkgs.writeText "gtk3.ini" iniText;
dconfPath = "/org/gnome/desktop/interface/";
in
''
if [[ -v DRY_RUN ]]; then
echo ${pkgs.gnome3.dconf}/bin/dconf load ${dconfPath} "<" ${iniFile}
else
${pkgs.gnome3.dconf}/bin/dconf load ${dconfPath} < ${iniFile}
fi
''
);
};
}
);
}