aboutsummaryrefslogtreecommitdiffstats
path: root/modules/desktop/rofi/default.nix
blob: ed1cf058e5b0a3ca3722bc4e9f338a52a094e7a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# Application launcher and dmenu replacement
{
  config,
  lib,
  pkgs,
  ...
}:
let
  cfg = config.desktop.rofi;
  base16Colors = import ../../colors/base16 { inherit config lib pkgs; };
in
{
  options.desktop.rofi = {
    package = lib.mkOption {
      type = lib.types.package;
      readOnly = true;
      default = config.programs.rofi.finalPackage;
      description = "The rofi package to use.";
    };
  };

  config = lib.mkIf config.desktop.enable {
    programs.rofi = {
      enable = true;
      theme =
        let
          fontExpandedThemeTemplate =
            builtins.replaceStrings
              [
                "@@rofi-font@@"
                "@@rofi-font-message@@"
              ]
              [
                ''"${config.fonts.normal} Bold ${toString config.fonts.size}"''
                ''"${config.fonts.normal} Bold ${toString config.fonts.idx-size}"''
              ]
              (builtins.readFile ./theme.rasi);
        in
        "${base16Colors {
          templateFileOrContent = fontExpandedThemeTemplate;
          fileExtension = ".rasi";
        }}";
      settings = {
        modi = "drun";
        show-icons = true;
        drun-display-format = "{name}";
        sort = true;
      };
    };
  };
}