Refactor modules/themes/fluorescence
Extract functionality, remove redundant wallpaper logic, and simplify wallpaper options.
This commit is contained in:
parent
93b1a4bfed
commit
b7c00a985c
|
@ -9,13 +9,9 @@ let m = config.modules;
|
||||||
in {
|
in {
|
||||||
options.modules.themes.fluorescence = with types; {
|
options.modules.themes.fluorescence = with types; {
|
||||||
enable = mkBoolOpt false;
|
enable = mkBoolOpt false;
|
||||||
wallpaper = {
|
wallpaper = mkOpt (either path null) ./config/wallpaper.png;
|
||||||
path = mkOpt path ./config/wallpaper.png;
|
loginWallpaper = mkOpt (either path null)
|
||||||
filter = {
|
(toFilteredImage cfg.wallpaper "-gaussian-blur 0x2 -modulate 70 -level 5%");
|
||||||
enable = mkBoolOpt true;
|
|
||||||
options = mkOpt str "-gaussian-blur 0x2 -modulate 70 -level 5%";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable (mkMerge [
|
config = mkIf cfg.enable (mkMerge [
|
||||||
|
@ -27,30 +23,12 @@ in {
|
||||||
modules.shell.zsh.rcFiles = [ ./config/zsh/prompt.zsh ];
|
modules.shell.zsh.rcFiles = [ ./config/zsh/prompt.zsh ];
|
||||||
}
|
}
|
||||||
|
|
||||||
# Use a blurred+dimmed version of my wallpaper for the login screen
|
|
||||||
(mkIf (pathExists cfg.wallpaper.path) {
|
|
||||||
services.xserver.displayManager.lightdm.background =
|
|
||||||
if cfg.wallpaper.filter.enable
|
|
||||||
then cfg.wallpaper.path
|
|
||||||
else (let options = cfg.wallpaper.filter.options;
|
|
||||||
wallpaperPath = cfg.wallpaper.path;
|
|
||||||
filteredPath = "wallpaper.filtered.png";
|
|
||||||
filteredWallpaper =
|
|
||||||
pkgs.runCommand "filterWallpaper"
|
|
||||||
{ buildInputs = [ pkgs.imagemagick ]; } ''
|
|
||||||
mkdir "$out"
|
|
||||||
convert ${options} ${wallpaperPath} $out/${filteredPath}
|
|
||||||
'';
|
|
||||||
in "${filteredWallpaper}/${filteredPath}");
|
|
||||||
})
|
|
||||||
|
|
||||||
# Desktop (X11) theming
|
# Desktop (X11) theming
|
||||||
(mkIf config.services.xserver.enable {
|
(mkIf config.services.xserver.enable {
|
||||||
user.packages = with pkgs; [
|
user.packages = with pkgs; [
|
||||||
unstable.ant-dracula-theme
|
unstable.ant-dracula-theme
|
||||||
paper-icon-theme # for rofi
|
paper-icon-theme # for rofi
|
||||||
];
|
];
|
||||||
|
|
||||||
fonts.fonts = [ pkgs.jetbrains-mono ];
|
fonts.fonts = [ pkgs.jetbrains-mono ];
|
||||||
|
|
||||||
# Compositor
|
# Compositor
|
||||||
|
@ -84,94 +62,69 @@ in {
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
||||||
# Use a blurred+dimmed version of my wallpaper for the login screen
|
(mkIf (cfg.loginWallpaper != null) {
|
||||||
(mkIf (pathExists cfg.wallpaper.path) {
|
background = cfg.loginWallpaper;
|
||||||
background =
|
|
||||||
if cfg.wallpaper.filter.enable
|
|
||||||
then cfg.wallpaper.path
|
|
||||||
else (let options = cfg.wallpaper.filter.options;
|
|
||||||
wallpaperPath = cfg.wallpaper.path;
|
|
||||||
filteredPath = "wallpaper.filtered.png";
|
|
||||||
filteredWallpaper =
|
|
||||||
pkgs.runCommand "filterWallpaper"
|
|
||||||
{ buildInputs = [ pkgs.imagemagick ]; } ''
|
|
||||||
mkdir "$out"
|
|
||||||
convert ${options} ${wallpaperPath} $out/${filteredPath}
|
|
||||||
'';
|
|
||||||
in "${filteredWallpaper}/${filteredPath}");
|
|
||||||
|
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
home.dataFile = mkIf (cfg.wallpaper != null) {
|
||||||
|
"wallpaper".source = cfg.wallpaper;
|
||||||
|
};
|
||||||
|
|
||||||
modules.desktop.browsers = {
|
modules.desktop.browsers = {
|
||||||
firefox.userChrome =
|
firefox.userChrome = concatMapStringsSep "\n" readFile [
|
||||||
readFile ./config/firefox/userChrome.css;
|
./config/firefox/userChrome.css
|
||||||
qutebrowser.userStyles =
|
];
|
||||||
with pkgs;
|
qutebrowser.userStyles = concatMapStringsSep "\n" toCSSFile [
|
||||||
let compiledStyles =
|
./config/qutebrowser/github.scss
|
||||||
runCommand "compileUserStyles"
|
./config/qutebrowser/monospace-textareas.scss
|
||||||
{ buildInputs = [ sass ]; } ''
|
./config/qutebrowser/quora.scss
|
||||||
mkdir "$out"
|
./config/qutebrowser/stackoverflow.scss
|
||||||
for file in "${./config/userstyles/qutebrowser}"/*.scss; do
|
./config/qutebrowser/xkcd.scss
|
||||||
scss --sourcemap=none \
|
./config/qutebrowser/youtube.scss
|
||||||
--no-cache \
|
|
||||||
--style compressed \
|
|
||||||
--default-encoding utf-8 \
|
|
||||||
"$file" \
|
|
||||||
>>"$out/userstyles.css"
|
|
||||||
done
|
|
||||||
'';
|
|
||||||
in readFile "${compiledStyles}/userstyles.css";
|
|
||||||
};
|
|
||||||
|
|
||||||
home = {
|
|
||||||
configFile = mkMerge [
|
|
||||||
{
|
|
||||||
"xtheme/90-theme".source = ./config/Xresources;
|
|
||||||
# GTK
|
|
||||||
"gtk-3.0/settings.ini".text = ''
|
|
||||||
[Settings]
|
|
||||||
gtk-theme-name=Ant-Dracula
|
|
||||||
gtk-icon-theme-name=Paper
|
|
||||||
gtk-fallback-icon-theme=gnome
|
|
||||||
gtk-application-prefer-dark-theme=true
|
|
||||||
gtk-cursor-theme-name=Paper
|
|
||||||
gtk-xft-hinting=1
|
|
||||||
gtk-xft-hintstyle=hintfull
|
|
||||||
gtk-xft-rgba=none
|
|
||||||
'';
|
|
||||||
# GTK2 global theme (widget and icon theme)
|
|
||||||
"gtk-2.0/gtkrc".text = ''
|
|
||||||
gtk-theme-name="Ant-Dracula"
|
|
||||||
gtk-icon-theme-name="Paper-Mono-Dark"
|
|
||||||
gtk-font-name="Sans 10"
|
|
||||||
'';
|
|
||||||
# QT4/5 global theme
|
|
||||||
"Trolltech.conf".text = ''
|
|
||||||
[Qt]
|
|
||||||
style=Ant-Dracula
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
(mkIf m.desktop.bspwm.enable {
|
|
||||||
"bspwm/rc.d/polybar".source = ./config/polybar/run.sh;
|
|
||||||
"bspwm/rc.d/theme".source = ./config/bspwmrc;
|
|
||||||
})
|
|
||||||
(mkIf m.desktop.apps.rofi.enable {
|
|
||||||
"rofi/theme" = { source = ./config/rofi; recursive = true; };
|
|
||||||
})
|
|
||||||
(mkIf (m.desktop.bspwm.enable || m.desktop.stumpwm.enable) {
|
|
||||||
"polybar" = { source = ./config/polybar; recursive = true; };
|
|
||||||
"dunst/dunstrc".source = ./config/dunstrc;
|
|
||||||
})
|
|
||||||
(mkIf m.desktop.media.graphics.vector.enable {
|
|
||||||
"inkscape/templates/default.svg".source = ./config/inkscape/default-template.svg;
|
|
||||||
})
|
|
||||||
];
|
];
|
||||||
|
|
||||||
dataFile = mkIf (pathExists cfg.wallpaper.path) {
|
|
||||||
"wallpaper".source = cfg.wallpaper.path;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
home.configFile = mkMerge [
|
||||||
|
{
|
||||||
|
# This is sourced in the displayManager (see
|
||||||
|
# modules/desktop/default.nix) to modularize my Xresources config.
|
||||||
|
"xtheme/90-theme".source = ./config/Xresources;
|
||||||
|
# GTK
|
||||||
|
"gtk-3.0/settings.ini".text = ''
|
||||||
|
[Settings]
|
||||||
|
gtk-theme-name=Ant-Dracula
|
||||||
|
gtk-icon-theme-name=Paper
|
||||||
|
gtk-fallback-icon-theme=gnome
|
||||||
|
gtk-application-prefer-dark-theme=true
|
||||||
|
gtk-cursor-theme-name=Paper
|
||||||
|
gtk-xft-hinting=1
|
||||||
|
gtk-xft-hintstyle=hintfull
|
||||||
|
gtk-xft-rgba=none
|
||||||
|
'';
|
||||||
|
# GTK2 global theme (widget and icon theme)
|
||||||
|
"gtk-2.0/gtkrc".text = ''
|
||||||
|
gtk-theme-name="Ant-Dracula"
|
||||||
|
gtk-icon-theme-name="Paper-Mono-Dark"
|
||||||
|
gtk-font-name="Sans 10"
|
||||||
|
'';
|
||||||
|
# QT4/5 global theme
|
||||||
|
"Trolltech.conf".text = "[Qt]\nstyle=Ant-Dracula";
|
||||||
|
}
|
||||||
|
(mkIf m.desktop.bspwm.enable {
|
||||||
|
"bspwm/rc.d/polybar".source = ./config/polybar/run.sh;
|
||||||
|
"bspwm/rc.d/theme".source = ./config/bspwmrc;
|
||||||
|
})
|
||||||
|
(mkIf m.desktop.apps.rofi.enable {
|
||||||
|
"rofi/theme" = { source = ./config/rofi; recursive = true; };
|
||||||
|
})
|
||||||
|
(mkIf (m.desktop.bspwm.enable || m.desktop.stumpwm.enable) {
|
||||||
|
"polybar" = { source = ./config/polybar; recursive = true; };
|
||||||
|
"dunst/dunstrc".source = ./config/dunstrc;
|
||||||
|
})
|
||||||
|
(mkIf m.desktop.media.graphics.vector.enable {
|
||||||
|
"inkscape/templates/default.svg".source = ./config/inkscape/default-template.svg;
|
||||||
|
})
|
||||||
|
];
|
||||||
})
|
})
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue