nixos-config/modules/workspace/gtk.nix

83 lines
2.5 KiB
Nix
Raw Normal View History

2020-04-27 05:39:00 +04:00
{ pkgs, config, lib, inputs, ... }:
2020-02-17 17:00:59 +04:00
let
thm = config.themes.colors;
thm' = builtins.mapAttrs (name: value: builtins.substring 1 7 value) thm;
materia_colors = pkgs.writeTextFile {
name = "gtk-generated-colors";
text = ''
BG=${thm'.bg}
FG=${thm'.fg}
BTN_BG=${thm'.bg}
BTN_FG=${thm'.fg}
MENU_BG=${thm'.bg}
MENU_FG=${thm'.fg}
2020-06-13 00:12:36 +04:00
ACCENT_BG=${thm'.alt}
2020-02-17 17:00:59 +04:00
SEL_BG=${thm'.blue}
SEL_FG=${thm'.bg}
TXT_BG=${thm'.bg}
TXT_FG=${thm'.fg}
HDR_BTN_BG=${thm'.bg}
HDR_BTN_FG=${thm'.fg}
2020-06-13 00:12:36 +04:00
WM_BORDER_FOCUS=${thm'.alt}
WM_BORDER_UNFOCUS=${thm'.dark}
2020-02-17 17:00:59 +04:00
MATERIA_STYLE_COMPACT=True
MATERIA_COLOR_VARIANT=dark
UNITY_DEFAULT_LAUNCHER_STYLE=False
NAME=generated
'';
};
in {
2020-12-27 11:16:20 +04:00
nixpkgs.overlays = [
(self: super: {
2021-06-06 11:24:23 +04:00
rendersvg = self.runCommandNoCC "rendersvg" {} ''
mkdir -p $out/bin
ln -s ${self.resvg}/bin/resvg $out/bin/rendersvg
'';
2020-12-27 11:16:20 +04:00
generated-gtk-theme = self.stdenv.mkDerivation rec {
name = "generated-gtk-theme";
src = inputs.materia-theme;
2021-06-06 11:24:23 +04:00
buildInputs = with self; [ sassc bc which rendersvg meson ninja nodePackages.sass gtk4.dev optipng ];
MATERIA_COLORS = materia_colors;
phases = [ "unpackPhase" "installPhase" ];
2020-12-27 11:16:20 +04:00
installPhase = ''
HOME=/build
chmod 777 -R .
patchShebangs .
mkdir -p $out/share/themes
2021-06-06 11:24:23 +04:00
mkdir bin
sed -e 's/handle-horz-.*//' -e 's/handle-vert-.*//' -i ./src/gtk-2.0/assets.txt
2020-12-27 11:16:20 +04:00
echo "Changing colours:"
2021-06-06 11:24:23 +04:00
./change_color.sh -o Generated "$MATERIA_COLORS" -i False -t "$out/share/themes"
2020-12-27 11:16:20 +04:00
chmod 555 -R .
'';
};
})
];
2021-01-21 22:13:53 +04:00
programs.dconf.enable = true;
2020-05-13 00:35:29 +04:00
services.dbus.packages = with pkgs; [ gnome3.dconf ];
2020-02-17 17:00:59 +04:00
home-manager.users.balsoft = {
gtk = {
enable = true;
iconTheme = {
2020-06-21 13:17:20 +04:00
name = "Papirus-Dark";
package = pkgs.papirus-icon-theme;
2020-02-17 17:00:59 +04:00
};
theme = {
name = "Generated";
package = pkgs.generated-gtk-theme;
};
2020-12-27 11:16:20 +04:00
font = { name = "IBM Plex 12"; };
gtk3 = {
bookmarks = [
"file:///home/balsoft/projects Projects"
"davs://nextcloud.balsoft.ru/remote.php/dav/files/balsoft nextcloud.balsoft.ru"
"sftp://balsoft.ru/home/balsoft balsoft.ru"
] ++ map (machine: "sftp://${machine}/home/balsoft ${machine}")
2021-01-21 22:13:53 +04:00
(builtins.attrNames inputs.self.nixosConfigurations);
2020-02-17 17:00:59 +04:00
};
2020-12-27 11:16:20 +04:00
2020-02-17 17:00:59 +04:00
};
2020-05-14 01:14:11 +04:00
home.sessionVariables.GTK_THEME = "Generated";
2020-02-17 17:00:59 +04:00
};
}