diff --git a/modules/themes/alucard/README.org b/modules/themes/alucard/README.org new file mode 100644 index 00000000..d6f512dd --- /dev/null +++ b/modules/themes/alucard/README.org @@ -0,0 +1,14 @@ +#+TITLE: Alucard +#+AUTHOR: Henrik Lissner +#+DATE: October 1, 2019 + +A regal dracula-inspired theme for piles of miserable secrets. + +* Wallpaper +![Alucard wallpaper](config/wallpaper.jpg) + +* Screenshots +![My desktop, pretending to look busy, with gaps](/../screenshots/alucard/fakebusy.png?raw=true) +![My desktop, unfettered by windows](/../screenshots/alucard/desktop.png?raw=true) +![My app launcher, rofi](/../screenshots/alucard/rofi.png?raw=true) +![The gapless experience](/../screenshots/alucard/tiling.png?raw=true) diff --git a/modules/themes/fluorescence/config/Xresources b/modules/themes/alucard/config/Xresources similarity index 100% rename from modules/themes/fluorescence/config/Xresources rename to modules/themes/alucard/config/Xresources diff --git a/modules/themes/fluorescence/config/bspwmrc b/modules/themes/alucard/config/bspwmrc similarity index 100% rename from modules/themes/fluorescence/config/bspwmrc rename to modules/themes/alucard/config/bspwmrc diff --git a/modules/themes/fluorescence/config/dunstrc b/modules/themes/alucard/config/dunstrc similarity index 100% rename from modules/themes/fluorescence/config/dunstrc rename to modules/themes/alucard/config/dunstrc diff --git a/modules/themes/fluorescence/config/firefox/userChrome.css b/modules/themes/alucard/config/firefox/userChrome.css similarity index 100% rename from modules/themes/fluorescence/config/firefox/userChrome.css rename to modules/themes/alucard/config/firefox/userChrome.css diff --git a/modules/themes/fluorescence/config/inkscape/default-template.svg b/modules/themes/alucard/config/inkscape/default-template.svg similarity index 100% rename from modules/themes/fluorescence/config/inkscape/default-template.svg rename to modules/themes/alucard/config/inkscape/default-template.svg diff --git a/modules/themes/fluorescence/config/polybar/config b/modules/themes/alucard/config/polybar/config similarity index 100% rename from modules/themes/fluorescence/config/polybar/config rename to modules/themes/alucard/config/polybar/config diff --git a/modules/themes/fluorescence/config/polybar/modules/redshift b/modules/themes/alucard/config/polybar/modules/redshift similarity index 100% rename from modules/themes/fluorescence/config/polybar/modules/redshift rename to modules/themes/alucard/config/polybar/modules/redshift diff --git a/modules/themes/fluorescence/config/polybar/run.sh b/modules/themes/alucard/config/polybar/run.sh similarity index 100% rename from modules/themes/fluorescence/config/polybar/run.sh rename to modules/themes/alucard/config/polybar/run.sh diff --git a/modules/themes/fluorescence/config/rofi/appmenu.rasi b/modules/themes/alucard/config/rofi/appmenu.rasi similarity index 100% rename from modules/themes/fluorescence/config/rofi/appmenu.rasi rename to modules/themes/alucard/config/rofi/appmenu.rasi diff --git a/modules/themes/fluorescence/config/rofi/base.cyclemenu.rasi b/modules/themes/alucard/config/rofi/base.cyclemenu.rasi similarity index 100% rename from modules/themes/fluorescence/config/rofi/base.cyclemenu.rasi rename to modules/themes/alucard/config/rofi/base.cyclemenu.rasi diff --git a/modules/themes/fluorescence/config/rofi/bookmarkmenu.rasi b/modules/themes/alucard/config/rofi/bookmarkmenu.rasi similarity index 100% rename from modules/themes/fluorescence/config/rofi/bookmarkmenu.rasi rename to modules/themes/alucard/config/rofi/bookmarkmenu.rasi diff --git a/modules/themes/fluorescence/config/rofi/config.rasi b/modules/themes/alucard/config/rofi/config.rasi similarity index 100% rename from modules/themes/fluorescence/config/rofi/config.rasi rename to modules/themes/alucard/config/rofi/config.rasi diff --git a/modules/themes/fluorescence/config/rofi/filemenu.rasi b/modules/themes/alucard/config/rofi/filemenu.rasi similarity index 100% rename from modules/themes/fluorescence/config/rofi/filemenu.rasi rename to modules/themes/alucard/config/rofi/filemenu.rasi diff --git a/modules/themes/fluorescence/config/rofi/passmenu.rasi b/modules/themes/alucard/config/rofi/passmenu.rasi similarity index 100% rename from modules/themes/fluorescence/config/rofi/passmenu.rasi rename to modules/themes/alucard/config/rofi/passmenu.rasi diff --git a/modules/themes/fluorescence/config/rofi/powermenu.rasi b/modules/themes/alucard/config/rofi/powermenu.rasi similarity index 100% rename from modules/themes/fluorescence/config/rofi/powermenu.rasi rename to modules/themes/alucard/config/rofi/powermenu.rasi diff --git a/modules/themes/fluorescence/config/rofi/windowmenu.rasi b/modules/themes/alucard/config/rofi/windowmenu.rasi similarity index 100% rename from modules/themes/fluorescence/config/rofi/windowmenu.rasi rename to modules/themes/alucard/config/rofi/windowmenu.rasi diff --git a/modules/themes/fluorescence/config/tmux.conf b/modules/themes/alucard/config/tmux.conf similarity index 100% rename from modules/themes/fluorescence/config/tmux.conf rename to modules/themes/alucard/config/tmux.conf diff --git a/modules/themes/fluorescence/config/userstyles/firefox/stylus-2020-02-11.json b/modules/themes/alucard/config/userstyles/firefox/stylus-2020-02-11.json similarity index 100% rename from modules/themes/fluorescence/config/userstyles/firefox/stylus-2020-02-11.json rename to modules/themes/alucard/config/userstyles/firefox/stylus-2020-02-11.json diff --git a/modules/themes/fluorescence/config/userstyles/qutebrowser/github.scss b/modules/themes/alucard/config/userstyles/qutebrowser/github.scss similarity index 100% rename from modules/themes/fluorescence/config/userstyles/qutebrowser/github.scss rename to modules/themes/alucard/config/userstyles/qutebrowser/github.scss diff --git a/modules/themes/fluorescence/config/userstyles/qutebrowser/monospace-textareas.scss b/modules/themes/alucard/config/userstyles/qutebrowser/monospace-textareas.scss similarity index 100% rename from modules/themes/fluorescence/config/userstyles/qutebrowser/monospace-textareas.scss rename to modules/themes/alucard/config/userstyles/qutebrowser/monospace-textareas.scss diff --git a/modules/themes/fluorescence/config/userstyles/qutebrowser/quora.scss b/modules/themes/alucard/config/userstyles/qutebrowser/quora.scss similarity index 100% rename from modules/themes/fluorescence/config/userstyles/qutebrowser/quora.scss rename to modules/themes/alucard/config/userstyles/qutebrowser/quora.scss diff --git a/modules/themes/fluorescence/config/userstyles/qutebrowser/stackoverflow.scss b/modules/themes/alucard/config/userstyles/qutebrowser/stackoverflow.scss similarity index 100% rename from modules/themes/fluorescence/config/userstyles/qutebrowser/stackoverflow.scss rename to modules/themes/alucard/config/userstyles/qutebrowser/stackoverflow.scss diff --git a/modules/themes/fluorescence/config/userstyles/qutebrowser/xkcd.scss b/modules/themes/alucard/config/userstyles/qutebrowser/xkcd.scss similarity index 100% rename from modules/themes/fluorescence/config/userstyles/qutebrowser/xkcd.scss rename to modules/themes/alucard/config/userstyles/qutebrowser/xkcd.scss diff --git a/modules/themes/fluorescence/config/userstyles/qutebrowser/youtube.scss b/modules/themes/alucard/config/userstyles/qutebrowser/youtube.scss similarity index 100% rename from modules/themes/fluorescence/config/userstyles/qutebrowser/youtube.scss rename to modules/themes/alucard/config/userstyles/qutebrowser/youtube.scss diff --git a/modules/themes/fluorescence/config/wallpaper.png b/modules/themes/alucard/config/wallpaper.png similarity index 100% rename from modules/themes/fluorescence/config/wallpaper.png rename to modules/themes/alucard/config/wallpaper.png diff --git a/modules/themes/fluorescence/config/zsh/prompt.zsh b/modules/themes/alucard/config/zsh/prompt.zsh similarity index 100% rename from modules/themes/fluorescence/config/zsh/prompt.zsh rename to modules/themes/alucard/config/zsh/prompt.zsh diff --git a/modules/themes/alucard/default.nix b/modules/themes/alucard/default.nix new file mode 100644 index 00000000..fad85f10 --- /dev/null +++ b/modules/themes/alucard/default.nix @@ -0,0 +1,99 @@ +# modules/themes/alucard/default.nix --- a regal dracula-inspired theme + +{ options, config, lib, pkgs, ... }: + +with lib; +with lib.my; +let cfg = config.modules.theme; +in { + config = mkIf (cfg.active == "alucard") (mkMerge [ + # Desktop-agnostic configuration + { + modules = { + theme = { + wallpaper = mkDefault ./config/wallpaper.png; + gtk = { + theme = "Dracula"; + iconTheme = "Paper"; + cursorTheme = "Paper"; + }; + }; + + shell.zsh.rcFiles = [ ./config/zsh/prompt.zsh ]; + shell.tmux.rcFiles = [ ./config/tmux.conf ]; + desktop.browsers = { + firefox.userChrome = concatMapStringsSep "\n" readFile [ + ./config/firefox/userChrome.css + ]; + qutebrowser.userStyles = concatMapStringsSep "\n" toCSSFile [ + ./config/qutebrowser/github.scss + ./config/qutebrowser/monospace-textareas.scss + ./config/qutebrowser/quora.scss + ./config/qutebrowser/stackoverflow.scss + ./config/qutebrowser/xkcd.scss + ./config/qutebrowser/youtube.scss + ]; + }; + }; + } + + # Desktop (X11) theming + (mkIf config.services.xserver.enable { + user.packages = with pkgs; [ + unstable.dracula-theme + paper-icon-theme # for rofi + ]; + fonts.fonts = [ pkgs.jetbrains-mono ]; + + # Compositor + services.picom = { + fade = true; + fadeDelta = 1; + fadeSteps = [ 0.01 0.012 ]; + shadow = true; + shadowOffsets = [ (-10) (-10) ]; + shadowOpacity = 0.22; + # activeOpacity = "1.00"; + # inactiveOpacity = "0.92"; + settings = { + shadow-radius = 12; + # blur-background = true; + # blur-background-frame = true; + # blur-background-fixed = true; + blur-kern = "7x7box"; + blur-strength = 320; + }; + }; + + # Login screen theme + services.xserver.displayManager.lightdm.greeters.mini.extraConfig = '' + text-color = "#ff79c6" + password-background-color = "#1E2029" + window-color = "#181a23" + border-color = "#181a23" + ''; + + # Other dotfiles + home.configFile = mkMerge [ + { + # Sourced from sessionCommands in modules/themes/default.nix + "xtheme/90-theme".source = ./config/Xresources; + } + (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; + }) + ]; + }) + ]); +} diff --git a/modules/themes/default.nix b/modules/themes/default.nix index 6d5861e8..26c687b6 100644 --- a/modules/themes/default.nix +++ b/modules/themes/default.nix @@ -2,14 +2,123 @@ # intertwined with others, and are solely responsible for aesthetics. Disabling # a theme module should never leave a system non-functional. -{ config, lib, ... }: +{ options, config, lib, pkgs, ... }: with lib; with lib.my; -let cfg = config.modules.themes; +let cfg = config.modules.theme; in { - assertions = [{ - assertion = countAttrs (_: x: x.enable) cfg < 2; - message = "Can't have more than one theme enabled at a time"; - }]; + options.modules.theme = with types; { + active = mkOption { + type = nullOr str; + default = null; + apply = v: let theme = builtins.getEnv "THEME"; in + if theme != "" then theme else v; + description = '' + Name of the theme to enable. Can be overridden by the THEME environment + variable. Themes can also be hot-swapped with 'hey theme $THEME'. + ''; + }; + + wallpaper = mkOpt (either path null) null; + + loginWallpaper = mkOpt (either path null) + (if cfg.wallpaper != null + then toFilteredImage cfg.wallpaper "-gaussian-blur 0x2 -modulate 70 -level 5%" + else null); + + gtk = { + theme = mkOpt str ""; + iconTheme = mkOpt str ""; + cursorTheme = mkOpt str ""; + }; + + onReload = mkOpt (attrsOf lines) {}; + }; + + config = mkIf (cfg.active != null) (mkMerge [ + # Read xresources files in ~/.config/xtheme/* to allow modular + # configuration of Xresources. + (let xrdb = ''xrdb -merge "$XDG_CONFIG_HOME"/xtheme/*''; + in { + services.xserver.displayManager.sessionCommands = xrdb; + modules.theme.onReload.xtheme = xrdb; + }) + + { + home.configFile = { + # GTK + "gtk-3.0/settings.ini".text = '' + [Settings] + ${optionalString (cfg.gtk.theme != "") + ''gtk-theme-name="${cfg.gtk.theme}"''} + ${optionalString (cfg.gtk.iconTheme != "") + ''gtk-icon-theme-name="${cfg.gtk.iconTheme}"''} + ${optionalString (cfg.gtk.cursorTheme != "") + ''gtk-cursor-theme-name="${cfg.gtk.cursorTheme}"''} + gtk-fallback-icon-theme=gnome + gtk-application-prefer-dark-theme=true + gtk-xft-hinting=1 + gtk-xft-hintstyle=hintfull + gtk-xft-rgba=none + ''; + # GTK2 global theme (widget and icon theme) + "gtk-2.0/gtkrc".text = '' + ${optionalString (cfg.gtk.theme != "") + ''gtk-theme-name="${cfg.gtk.theme}"''} + ${optionalString (cfg.gtk.iconTheme != "") + ''gtk-icon-theme-name="${cfg.gtk.iconTheme}"''} + gtk-font-name="Sans 10" + ''; + # QT4/5 global theme + "Trolltech.conf".text = '' + [Qt] + ${optionalString (cfg.gtk.theme != "") + ''style="${cfg.gtk.theme}"''} + ''; + }; + } + + (mkIf (cfg.wallpaper != null) + (let wCfg = config.services.xserver.desktopManager.wallpaper; + command = '' + if [ -e "$XDG_DATA_HOME/wallpaper" ]; then + ${pkgs.feh}/bin/feh --bg-${wCfg.mode} \ + ${optionalString wCfg.combineScreens "--no-xinerama"} \ + --no-fehbg \ + $XDG_DATA_HOME/wallpaper + fi + ''; + in { + # Set the wallpaper ourselves so we don't need .background-image and/or + # .fehbg polluting $HOME + services.xserver.displayManager.sessionCommands = command; + modules.theme.onReload.wallpaper = command; + + home.dataFile = mkIf (cfg.wallpaper != null) { + "wallpaper".source = cfg.wallpaper; + }; + })) + + (mkIf (cfg.loginWallpaper != null) { + services.xserver.displayManager.lightdm.background = cfg.loginWallpaper; + }) + + (mkIf (cfg.onReload != {}) { + user.packages = [ + (pkgs.writeScriptBin "reloadTheme" '' + #!${stdenv.shell} + echo "Reloading current theme: ${cfg.active}" + ${concatStrings "\n" + (mapAttrsToList (name: script: '' + echo "[${name}]" + ${script} + '') cfg.onReload)} + '') + ]; + system.userActivationScripts.reloadTheme = '' + [ -z "$NORELOAD" ] && reloadTheme + ''; + }) + ]); } diff --git a/modules/themes/fluorescence/README.org b/modules/themes/fluorescence/README.org deleted file mode 100644 index 33ca9ea3..00000000 --- a/modules/themes/fluorescence/README.org +++ /dev/null @@ -1,14 +0,0 @@ -#+TITLE: Fluorescence -#+AUTHOR: Henrik Lissner -#+DATE: October 1, 2019 - -A regal dracula-inspired theme. - -* Wallpaper -![Fluorescence wallpaper](config/wallpaper.jpg) - -* Screenshots -![My desktop, pretending to look busy, with gaps](/../screenshots/fluorescence/fakebusy.png?raw=true) -![My desktop, unfettered by windows](/../screenshots/fluorescence/desktop.png?raw=true) -![My app launcher, rofi](/../screenshots/fluorescence/rofi.png?raw=true) -![The gapless experience](/../screenshots/fluorescence/tiling.png?raw=true) diff --git a/modules/themes/fluorescence/default.nix b/modules/themes/fluorescence/default.nix deleted file mode 100644 index 9d3fc46d..00000000 --- a/modules/themes/fluorescence/default.nix +++ /dev/null @@ -1,130 +0,0 @@ -# modules/themes/fluorescence/default.nix --- a regal dracula-inspired theme - -{ options, config, lib, pkgs, ... }: - -with lib; -with lib.my; -let m = config.modules; - cfg = m.themes.fluorescence; -in { - options.modules.themes.fluorescence = with types; { - enable = mkBoolOpt false; - wallpaper = mkOpt (either path null) ./config/wallpaper.png; - loginWallpaper = mkOpt (either path null) - (toFilteredImage cfg.wallpaper "-gaussian-blur 0x2 -modulate 70 -level 5%"); - }; - - config = mkIf cfg.enable (mkMerge [ - # Desktop-agnostic configuration - { - home.configFile = mkIf m.shell.tmux.enable { - "tmux/theme".source = ./config/tmux.conf; - }; - modules.shell.zsh.rcFiles = [ ./config/zsh/prompt.zsh ]; - } - - # Desktop (X11) theming - (mkIf config.services.xserver.enable { - user.packages = with pkgs; [ - unstable.dracula-theme - paper-icon-theme # for rofi - ]; - fonts.fonts = [ pkgs.jetbrains-mono ]; - - # Compositor - services.picom = { - fade = true; - fadeDelta = 1; - fadeSteps = [ 0.01 0.012 ]; - shadow = true; - shadowOffsets = [ (-10) (-10) ]; - shadowOpacity = 0.22; - # activeOpacity = "1.00"; - # inactiveOpacity = "0.92"; - settings = { - shadow-radius = 12; - # blur-background = true; - # blur-background-frame = true; - # blur-background-fixed = true; - blur-kern = "7x7box"; - blur-strength = 320; - }; - }; - - services.xserver.displayManager.lightdm = mkMerge [ - # Login screen theme - { - greeters.mini.extraConfig = '' - text-color = "#ff79c6" - password-background-color = "#1E2029" - window-color = "#181a23" - border-color = "#181a23" - ''; - } - - (mkIf (cfg.loginWallpaper != null) { - background = cfg.loginWallpaper; - }) - ]; - home.dataFile = mkIf (cfg.wallpaper != null) { - "wallpaper".source = cfg.wallpaper; - }; - - modules.desktop.browsers = { - firefox.userChrome = concatMapStringsSep "\n" readFile [ - ./config/firefox/userChrome.css - ]; - qutebrowser.userStyles = concatMapStringsSep "\n" toCSSFile [ - ./config/qutebrowser/github.scss - ./config/qutebrowser/monospace-textareas.scss - ./config/qutebrowser/quora.scss - ./config/qutebrowser/stackoverflow.scss - ./config/qutebrowser/xkcd.scss - ./config/qutebrowser/youtube.scss - ]; - }; - - 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=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="Dracula" - gtk-icon-theme-name="Paper-Mono-Dark" - gtk-font-name="Sans 10" - ''; - # QT4/5 global theme - "Trolltech.conf".text = "[Qt]\nstyle=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; - }) - ]; - }) - ]); -}