From 30757d4b2da121d5b27702e710359f441839604b Mon Sep 17 00:00:00 2001 From: Lyndon Sanche Date: Thu, 4 Aug 2022 12:53:06 -0600 Subject: [PATCH] Initial bemenu module --- flake.nix | 1 + modules/bemenu.nix | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 modules/bemenu.nix diff --git a/flake.nix b/flake.nix index 6ffd9814..61f3127d 100644 --- a/flake.nix +++ b/flake.nix @@ -56,6 +56,7 @@ nixosModules.stylix = { pkgs, ... }@args: { imports = [ ./modules/alacritty.nix + ./modules/bemenu.nix ./modules/console.nix ./modules/dunst.nix ./modules/feh.nix diff --git a/modules/bemenu.nix b/modules/bemenu.nix new file mode 100644 index 00000000..59c2f023 --- /dev/null +++ b/modules/bemenu.nix @@ -0,0 +1,34 @@ +{pkgs, config, lib, ... }: + +with config.lib.stylix.colors.withHashtag; +with config.stylix.fonts; +{ + options.stylix.targets.bemenu = { + enable = config.lib.stylix.mkEnableTarget "bemenu" true; + fontSize = lib.mkOption { type = lib.types.str; default = ""; }; # optional argument + alternate = lib.mkOption { type = lib.types.bool; default = false; }; + }; + + config.home-manager.sharedModules = lib.mkIf config.stylix.targets.mako.enable [{ + home.sessionVariables.BEMENU_OPTS = with config.stylix.targets.bemenu; builtins.concatStringsSep " " [ + # Inspired from https://git.sr.ht/~h4n1/base16-bemenu_opts + "--tb '${base01}'" + "--nb '${base01}'" + "--fb '${base01}'" + "--hb '${base03}'" + "--sb '${base03}'" + "--hf '${base0A}'" + "--sf '${base0B}'" + "--tf '${base05}'" + "--ff '${base05}'" + "--nf '${base05}'" + "--scb '${base01}'" + "--scf '${base03}'" + # Alternating colours, currently set to match primary. Adding a module option to enable or disable alternating in Stylix could be useful + "--ab '${if alternate then base00 else base01}'" + "--af '${if alternate then base04 else base05}'" + + "--fn '${sansSerif.name} ${fontSize}'" + ]; + }]; +}