finish switch to stylix

This commit is contained in:
Chris Kruining 2024-08-20 20:19:52 +02:00
parent 4dd4497139
commit f4774a6cae
10 changed files with 229 additions and 548 deletions

View file

@ -142,229 +142,6 @@ in {
};
config = mkIf (cfg.active != null) (mkMerge [
{
# Allow HM to control GTK Theme:
programs.dconf.enable = true;
hm.gtk = let
inherit (cfg.font) sans;
inherit (cfg) gtk iconTheme;
in {
enable = true;
font = {
name = sans.family;
size = sans.size;
};
theme = {
name = gtk.name;
package = gtk.package;
};
iconTheme = {
name = iconTheme.name;
package = iconTheme.package;
};
gtk3.bookmarks = map (dir: "file://${config.user.home}/" + dir) [
"data/Github/.files"
];
gtk4.extraConfig = {
gtk-cursor-blink = false;
gtk-recent-files-limit = 20;
};
};
home.pointerCursor = let
inherit (cfg.pointer) name package size;
in {
name = name;
package = package;
size = size;
gtk.enable = true;
};
fonts = let
inherit (cfg.fontConfig) packages emoji mono sans;
in {
packages = packages;
fontconfig.defaultFonts = {
monospace = mono;
sansSerif = sans;
emoji = emoji;
};
};
hm.programs.vscode.extensions = let
inherit (cfg.vscode.extension) name publisher version hash;
in
pkgs.vscode-utils.extensionsFromVscodeMarketplace [
{
name = "${name}";
publisher = "${publisher}";
version = "${version}";
hash = "${hash}";
}
];
}
(mkIf (desktop.type == "wayland") (mkMerge [
{
programs.regreet.settings.GTK = let
inherit (cfg) pointer font iconTheme gtk;
in {
cursor_theme_name = "${pointer.name}";
font_name = "${font.mono.family}";
icon_theme_name = "${iconTheme.name}";
theme_name = "${gtk.name}";
};
}
(mkIf (cfg.wallpaper != null) {
user.packages = attrValues {inherit (pkgs) swww;};
hm.systemd.user.services = {
swww = {
Unit = {
Description = "Wallpaper daemon for wayland";
After = ["graphical-session.target"];
PartOf = ["graphical-session.target"];
};
Install.WantedBy = ["graphical-session.target"];
Service = {
Type = "simple";
ExecStart = "${pkgs.swww}/bin/swww-daemon";
ExecStop = "${getExe pkgs.swww} kill";
Restart = "on-failure";
};
};
swww-wallpaper = {
Unit = {
Description = "Default swww wallpaper";
After = ["swww.service"];
PartOf = ["swww.service"];
};
Service = {
Type = "oneshot";
ExecStart = ''
if [ -e "$XDG_DATA_HOME/wallpaper" ]; then
${getExe pkgs.swww} \
img $XDG_DATA_HOME/wallpaper \
--transition-type random \
--transition-fps 60
fi
'';
Restart = "on-failure";
};
Install.WantedBy = ["swww.service"];
};
};
create.dataFile =
mkIf (cfg.wallpaper != null) {"wallpaper".source = cfg.wallpaper;};
})
]))
(mkIf (desktop.type == "x11") (mkMerge [
{
hm.xresources = {
path = "${config.user.home}/.Xresources";
properties = let
inherit (cfg.colors.main) bright normal types;
in {
"*.foreground" = "${types.fg}";
"*.background" = "${types.bg}";
"*.color0" = "${normal.black}";
"*.color8" = "${bright.black}";
"*.color1" = "${normal.red}";
"*.color9" = "${bright.red}";
"*.color2" = "${normal.green}";
"*.color10" = "${bright.green}";
"*.color3" = "${normal.yellow}";
"*.color11" = "${bright.yellow}";
"*.color4" = "${normal.blue}";
"*.color12" = "${bright.blue}";
"*.color5" = "${normal.magenta}";
"*.color13" = "${bright.magenta}";
"*.color6" = "${normal.cyan}";
"*.color14" = "${bright.cyan}";
"*.color7" = "${normal.white}";
"*.color15" = "${bright.white}";
};
};
home.pointerCursor.x11 = {
enable = true;
defaultCursor = "left_ptr";
};
}
# Apply theme options -> lightdm-mini-greeter
(mkIf (cfg.loginWallpaper != null) {
services.xserver.displayManager.lightdm = {
greeters.mini.extraConfig = let
inherit (cfg.colors.main) normal types;
in ''
background-image = "${cfg.loginWallpaper}"
background-image-size = "100% 100%"
text-color = "${types.bg}"
password-background-color = "${normal.black}"
window-color = "${types.border}"
border-color = "${types.border}"
'';
};
})
# Auto-set wallpaper to prevent $HOME pollution!
(mkIf (cfg.wallpaper != null) (let
wCfg = config.services.xserver.desktopManager.wallpaper;
command = ''
if [ -e "$XDG_DATA_HOME/wallpaper" ]; then
${getExe pkgs.feh} --bg-${wCfg.mode} \
${optionalString wCfg.combineScreens "--no-xinerama"} \
--no-fehbg \
$XDG_DATA_HOME/wallpaper
fi
'';
in {
modules.themes.onReload.wallpaper = command;
services.xserver.displayManager.sessionCommands = command;
create.dataFile =
mkIf (cfg.wallpaper != null) {"wallpaper".source = cfg.wallpaper;};
}))
(mkIf (cfg.loginWallpaper != null) {
programs.regreet.settings.background = {
path = cfg.loginWallpaper;
fit = "Fill";
};
})
(mkIf (cfg.onReload != {}) (let
reloadTheme = let
inherit (pkgs) stdenv writeScriptBin;
in (writeScriptBin "reloadTheme" ''
#!${stdenv.shell}
echo "Reloading current theme: ${cfg.active}"
${concatStringsSep "\n" (mapAttrsToList (name: script: ''
echo "[${name}]"
${script}
'')
cfg.onReload)}
'');
in {
user.packages = [reloadTheme];
system.userActivationScripts.reloadTheme = ''
[ -z "$NORELOAD" ] && ${reloadTheme}/bin/reloadTheme
'';
}))
]))
(mkIf (desktop.type == "wayland") (mkMerge []))
]);
}

View file

@ -10,98 +10,101 @@ in
{
config = mkIf (cfg.active == "everforest")
{
modules.themes = {
wallpaper = mkDefault ./assets/wallpaper.jpg;
stylix.base16Scheme = "${pkgs.base16-schemes}/share/themes/everforest.yaml";
stylix.image = ./assets/wallpaper.jpg;
gtk = {
name = "Everforest-Dark-BL";
package = pkgs.my.everforest-gtk;
};
iconTheme = {
name = "everforest-dark";
package = pkgs.fluent-icon-theme.override {
colorVariants = [];
};
};
pointer = {
name = "Bibata-Modern-Classic";
package = pkgs.bibata-cursors;
size = 24;
};
fontConfig = {
packages = attrValues {
inherit (pkgs) noto-fonts-emoji sarasa-gothic;
google-fonts = pkgs.google-fonts.override {fonts = ["Cardo"];};
nerdfonts =
pkgs.nerdfonts.override {fonts = ["CascadiaCode" "VictorMono"];};
};
mono = ["VictorMono Nerd Font" "Sarasa Mono SC"];
sans = ["Caskaydia Cove Nerd Font" "Sarasa Gothic SC"];
emoji = ["Noto Color Emoji"];
};
font = {
mono.family = "VictorMono Nerd Font";
sans.family = "CaskaydiaCove Nerd Font";
};
colors = {
main = {
normal = {
black = "#15161e";
red = "#f7768e";
green = "#9ece6a";
yellow = "#e0af68";
blue = "#7aa2f7";
magenta = "#bb9af7";
cyan = "#7dcfff";
white = "#a9b1d6";
};
bright = {
black = "#414868";
red = "#f7768e";
green = "#9ece6a";
yellow = "#e0af68";
blue = "#7aa2f7";
magenta = "#bb9af7";
cyan = "#7dcfff";
white = "#c0caf5";
};
types = {
fg = "#c0caf5";
bg = "#1a1b26";
panelbg = "#ff9e64";
border = "#1abc9c";
highlight = "#3d59a1";
};
};
rofi = {
bg = {
main = "hsla(235, 18%, 12%, 1)";
alt = "hsla(235, 18%, 12%, 0)";
bar = "hsla(229, 24%, 18%, 1)";
};
fg = "hsla(228, 72%, 85%, 1)";
ribbon = {
outer = "hsla(188, 68%, 27%, 1)";
inner = "hsla(202, 76%, 24%, 1)";
};
selected = "hsla(220, 88%, 72%, 1)";
urgent = "hsl(349, 89%, 72%, 1)";
transparent = "hsla(0, 0%, 0%, 0)";
};
};
editor = {
neovim = {
dark = "everforest";
light = "everforest";
};
};
};
# modules.themes = {
# wallpaper = mkDefault ./assets/wallpaper.jpg;
#
# gtk = {
# name = "Everforest-Dark-BL";
# package = pkgs.my.everforest-gtk;
# };
#
# iconTheme = {
# name = "everforest-dark";
# package = pkgs.fluent-icon-theme.override {
# colorVariants = [];
# };
# };
#
# pointer = {
# name = "Bibata-Modern-Classic";
# package = pkgs.bibata-cursors;
# size = 24;
# };
#
# fontConfig = {
# packages = attrValues {
# inherit (pkgs) noto-fonts-emoji sarasa-gothic;
# google-fonts = pkgs.google-fonts.override {fonts = ["Cardo"];};
# nerdfonts =
# pkgs.nerdfonts.override {fonts = ["CascadiaCode" "VictorMono"];};
# };
# mono = ["VictorMono Nerd Font" "Sarasa Mono SC"];
# sans = ["Caskaydia Cove Nerd Font" "Sarasa Gothic SC"];
# emoji = ["Noto Color Emoji"];
# };
#
# font = {
# mono.family = "VictorMono Nerd Font";
# sans.family = "CaskaydiaCove Nerd Font";
# };
#
# colors = {
# main = {
# normal = {
# black = "#15161e";
# red = "#f7768e";
# green = "#9ece6a";
# yellow = "#e0af68";
# blue = "#7aa2f7";
# magenta = "#bb9af7";
# cyan = "#7dcfff";
# white = "#a9b1d6";
# };
# bright = {
# black = "#414868";
# red = "#f7768e";
# green = "#9ece6a";
# yellow = "#e0af68";
# blue = "#7aa2f7";
# magenta = "#bb9af7";
# cyan = "#7dcfff";
# white = "#c0caf5";
# };
# types = {
# fg = "#c0caf5";
# bg = "#1a1b26";
# panelbg = "#ff9e64";
# border = "#1abc9c";
# highlight = "#3d59a1";
# };
# };
#
# rofi = {
# bg = {
# main = "hsla(235, 18%, 12%, 1)";
# alt = "hsla(235, 18%, 12%, 0)";
# bar = "hsla(229, 24%, 18%, 1)";
# };
# fg = "hsla(228, 72%, 85%, 1)";
# ribbon = {
# outer = "hsla(188, 68%, 27%, 1)";
# inner = "hsla(202, 76%, 24%, 1)";
# };
# selected = "hsla(220, 88%, 72%, 1)";
# urgent = "hsl(349, 89%, 72%, 1)";
# transparent = "hsla(0, 0%, 0%, 0)";
# };
# };
#
# editor = {
# neovim = {
# dark = "everforest";
# light = "everforest";
# };
# };
# };
};
}

View file

@ -1,5 +0,0 @@
{ pkgs, ... }:
{
# stylix.base16Scheme = "${pkgs.base16-schemes}/share/themes/everforest.yaml";
# stylix.image = ./wallpaper.jpg;
}