diff options
author | gnidorah <gnidorah@users.noreply.github.com> | 2018-09-22 19:30:13 +0300 |
---|---|---|
committer | Robert Helgesson <robert@rycee.net> | 2018-09-26 21:32:43 +0200 |
commit | 33a2943e8cbbe876e15cc4e6dbb4b5c5ce484bc5 (patch) | |
tree | 361363f74c95ab33e1f1489b2f962056a1556179 /modules/misc/gtk.nix | |
parent | a1a7e7cd249da03844601b9163d58dd496fb7d95 (diff) |
gtk: add support for wayland
Diffstat (limited to 'modules/misc/gtk.nix')
-rw-r--r-- | modules/misc/gtk.nix | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/modules/misc/gtk.nix b/modules/misc/gtk.nix index 7f4f537ed97..930823ff48f 100644 --- a/modules/misc/gtk.nix +++ b/modules/misc/gtk.nix @@ -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 + '' + ); + }; } ); } |