1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-27 05:29:46 +01:00

gtk2: allow configuration of gtkrc file

Closes #519
This commit is contained in:
Sumner Evans 2021-04-30 00:56:01 -06:00 committed by Robert Helgesson
parent d57c59e7cb
commit 5e6f09795c
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
6 changed files with 60 additions and 2 deletions

View file

@ -92,6 +92,18 @@ in {
<filename>~/.gtkrc-2.0</filename>.
'';
};
configLocation = mkOption {
type = types.path;
default = "${config.home.homeDirectory}/.gtkrc-2.0";
defaultText =
literalExample ''"''${config.home.homeDirectory}/.gtkrc-2.0"'';
example =
literalExample ''"''${config.xdg.configHome}/gtk-2.0/gtkrc"'';
description = ''
The location to put the GTK configuration file.
'';
};
};
gtk3 = {
@ -154,10 +166,12 @@ in {
home.packages = optionalPackage cfg.font ++ optionalPackage cfg.theme
++ optionalPackage cfg.iconTheme;
home.file.".gtkrc-2.0".text =
home.file.${cfg2.configLocation}.text =
concatStringsSep "\n" (mapAttrsToList formatGtk2Option ini) + "\n"
+ cfg2.extraConfig;
home.sessionVariables.GTK2_RC_FILES = cfg2.configLocation;
xdg.configFile."gtk-3.0/settings.ini".text =
toGtk3Ini { Settings = ini // cfg3.extraConfig; };

View file

@ -86,6 +86,7 @@ import nmt {
] ++ lib.optionals pkgs.stdenv.hostPlatform.isLinux [
./modules/config/i18n
./modules/misc/debug
./modules/misc/gtk
./modules/misc/numlock
./modules/misc/pam
./modules/misc/qt
@ -106,10 +107,10 @@ import nmt {
./modules/services/fluidsynth
./modules/services/kanshi
./modules/services/lieer
./modules/services/redshift-gammastep
./modules/services/pbgopy
./modules/services/playerctld
./modules/services/polybar
./modules/services/redshift-gammastep
./modules/services/sxhkd
./modules/services/window-managers/i3
./modules/services/window-managers/sway

View file

@ -0,0 +1,5 @@
{
gtk2-basic-config = ./gtk2-basic-config.nix;
gtk2-config-file-location = ./gtk2-config-file-location.nix;
}

View file

@ -0,0 +1 @@
gtk-can-change-accels = 1

View file

@ -0,0 +1,21 @@
{ config, lib, pkgs, ... }:
with lib;
{
config = {
gtk = {
enable = true;
gtk2.extraConfig = "gtk-can-change-accels = 1";
};
nmt.script = ''
assertFileExists home-files/.gtkrc-2.0
assertFileContents home-files/.gtkrc-2.0 ${
./gtk-basic-config-expected.conf
}
assertFileRegex home-path/etc/profile.d/hm-session-vars.sh \
'GTK2_RC_FILES=.*/.gtkrc-2.0'
'';
};
}

View file

@ -0,0 +1,16 @@
{ config, lib, pkgs, ... }:
with lib;
{
config = {
gtk.enable = true;
gtk.gtk2.configLocation = "${config.xdg.configHome}/gtk-2.0/gtkrc";
nmt.script = ''
assertFileExists home-files/.config/gtk-2.0/gtkrc
assertFileRegex home-path/etc/profile.d/hm-session-vars.sh \
'GTK2_RC_FILES=.*/\.config/gtk-2.0/gtkrc'
'';
};
}