mirror of
https://github.com/nix-community/home-manager
synced 2024-11-23 05:03:09 +00:00
gtk: add support for wayland
This commit is contained in:
parent
a1a7e7cd24
commit
33a2943e8c
1 changed files with 54 additions and 0 deletions
|
@ -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
|
||||
''
|
||||
);
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue