Migrate to snowfall lib
This commit is contained in:
56
modules/home/gui/theme/default.nix
Executable file
56
modules/home/gui/theme/default.nix
Executable file
@ -0,0 +1,56 @@
|
||||
{ lib, config, pkgs, ... }:
|
||||
let
|
||||
colorVariant = " black";
|
||||
gtkThemeFromScheme = import ./gtk-theme-gen.nix { inherit pkgs config; };
|
||||
wallpaperGen = import ./wallpaper-gen.nix { inherit pkgs config; };
|
||||
in {
|
||||
|
||||
config = lib.mkIf (config.homecfg.make.gui) {
|
||||
home.pointerCursor = {
|
||||
package = pkgs.bibata-cursors;
|
||||
name = "Bibata-Modern-Classic";
|
||||
size = 24;
|
||||
gtk.enable = true;
|
||||
x11.enable = true;
|
||||
};
|
||||
|
||||
gtk = {
|
||||
enable = true;
|
||||
theme = {
|
||||
name = "${config.colorscheme.slug}";
|
||||
package = gtkThemeFromScheme;
|
||||
};
|
||||
iconTheme = {
|
||||
name = "tela-circle-icon-theme";
|
||||
package = pkgs.tela-circle-icon-theme;
|
||||
};
|
||||
};
|
||||
|
||||
qt = {
|
||||
enable = true;
|
||||
platformTheme = "gtk";
|
||||
};
|
||||
|
||||
home.packages = [ wallpaperGen pkgs.swww ];
|
||||
|
||||
xdg.configFile."script/wallpaper.sh".text = ''
|
||||
#!/bin/sh
|
||||
|
||||
NIXDIR=${wallpaperGen}
|
||||
WPDIR=$NIXDIR/share/wallpaper/
|
||||
|
||||
IMGS=$(find $WPDIR -type f -print)
|
||||
|
||||
|
||||
RES=$(echo "$IMGS" | awk -v dir="$WPDIR" '{
|
||||
image_file = $0;
|
||||
gsub("^" dir, "", image_file);
|
||||
print "img:" $0 ":text:" image_file;
|
||||
}')
|
||||
|
||||
IMG=$WPDIR/$(echo "$RES" | wofi --dmenu --allow-images show-icons true -theme-str '#window { width: 50%; }' -p "Choose wallpaper:")
|
||||
IMG=$(echo "$IMG" | awk -F ':' '{print $2}')
|
||||
swww img $IMG
|
||||
'';
|
||||
};
|
||||
}
|
68
modules/home/gui/theme/gtk-theme-gen.nix
Executable file
68
modules/home/gui/theme/gtk-theme-gen.nix
Executable file
@ -0,0 +1,68 @@
|
||||
{ pkgs, config }:
|
||||
|
||||
let
|
||||
rendersvg = pkgs.runCommand "rendersvg" { } ''
|
||||
mkdir -p $out/bin
|
||||
ln -s ${pkgs.resvg}/bin/resvg $out/bin/rendersvg
|
||||
'';
|
||||
scheme = config.colorScheme;
|
||||
in pkgs.stdenv.mkDerivation rec {
|
||||
name = "generated-gtk-theme-${scheme.slug}";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "nana-4";
|
||||
repo = "materia-theme";
|
||||
rev = "6e5850388a25f424b8193fe4523504d1dc364175";
|
||||
sha256 = "sha256-I6hpH0VTmftU4+/pRbztuTQcBKcOFBFbNZXJL/2bcgU=";
|
||||
};
|
||||
buildInputs = with pkgs; [
|
||||
sassc
|
||||
bc
|
||||
which
|
||||
rendersvg
|
||||
meson
|
||||
ninja
|
||||
nodePackages.sass
|
||||
gtk4.dev
|
||||
optipng
|
||||
];
|
||||
phases = [ "unpackPhase" "installPhase" ];
|
||||
installPhase = ''
|
||||
HOME=/build
|
||||
chmod 777 -R .
|
||||
patchShebangs .
|
||||
mkdir -p $out/share/themes
|
||||
mkdir bin
|
||||
sed -e 's/handle-horz-.*//' -e 's/handle-vert-.*//' -i ./src/gtk-2.0/assets.txt
|
||||
|
||||
cat > /build/gtk-colors << EOF
|
||||
BG=${scheme.colors.base00}
|
||||
FG=${scheme.colors.base07}
|
||||
HDR_BG=${scheme.colors.base00}
|
||||
HDR_FG=${scheme.colors.base07}
|
||||
SEL_BG=${scheme.colors.base03}
|
||||
SEL_FG=${scheme.colors.base07}
|
||||
TXT_BG=${scheme.colors.base01}
|
||||
TXT_FG=${scheme.colors.base07}
|
||||
BTN_BG=${scheme.colors.base01}
|
||||
BTN_FG=${scheme.colors.base07}
|
||||
HDR_BTN_BG=${scheme.colors.base01}
|
||||
HDR_BTN_FG=${scheme.colors.base07}
|
||||
MENU_BG=${scheme.colors.base00}
|
||||
MENU_FG=${scheme.colors.base07}
|
||||
ACCENT_BG=${scheme.colors.base0C}
|
||||
ACCENT_FG=${scheme.colors.base00}
|
||||
MATERIA_SURFACE=${scheme.colors.base01}
|
||||
MATERIA_VIEW=${scheme.colors.base00}
|
||||
WM_BORDER_FOCUS=${scheme.colors.base02}
|
||||
WM_BORDER_UNFOCUS=${scheme.colors.base02}
|
||||
UNITY_DEFAULT_LAUNCHER_STYLE=False
|
||||
ROUNDNESS=7
|
||||
NAME=${scheme.slug}
|
||||
MATERIA_STYLE_COMPACT=True
|
||||
EOF
|
||||
|
||||
echo "Changing colours:"
|
||||
./change_color.sh -o ${scheme.slug} /build/gtk-colors -i False -t "$out/share/themes"
|
||||
chmod 555 -R .
|
||||
'';
|
||||
}
|
40
modules/home/gui/theme/wallpaper-gen.nix
Normal file
40
modules/home/gui/theme/wallpaper-gen.nix
Normal file
@ -0,0 +1,40 @@
|
||||
{ pkgs, config }:
|
||||
|
||||
let
|
||||
scheme = config.colorScheme;
|
||||
colors = scheme.colors;
|
||||
dither =
|
||||
"atkinson"; # none | floyd-steinberg | atkinson | jjn | burkes | sierra | sierra-lite
|
||||
in pkgs.stdenv.mkDerivation rec {
|
||||
pname = "generated-wallpaper";
|
||||
version = "a1676fc2a0e3dfb7bf95d8a89e592830";
|
||||
src = pkgs.fetchFromGitea {
|
||||
domain = "git.helcel.net";
|
||||
owner = "sora";
|
||||
repo = "nixconfig-wallpaper";
|
||||
rev = version;
|
||||
sha256 = "sha256-ZhBjTaKzoiEq1ptMmNWWRPCjLJsvy9My/HuzRaDjX1c=";
|
||||
};
|
||||
|
||||
buildInputs = with pkgs; [ custom.repalette nodejs imagemagick gifsicle ];
|
||||
|
||||
configurePhase = ''
|
||||
echo "${colors.base00},${colors.base01},\
|
||||
${colors.base02},${colors.base03},\
|
||||
${colors.base04},${colors.base05},\
|
||||
${colors.base06},${colors.base07},\
|
||||
${colors.base08},${colors.base09},\
|
||||
${colors.base0A},${colors.base0B},\
|
||||
${colors.base0C},${colors.base0D},\
|
||||
${colors.base0E},${colors.base0F}" > palette.in
|
||||
'';
|
||||
|
||||
buildPhase = ''
|
||||
make DITHER=${dither} PALETTE_SIZE=0 all
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/share/wallpaper
|
||||
cp -r build/* $out/share/wallpaper/
|
||||
'';
|
||||
}
|
Reference in New Issue
Block a user