nix-config

My personal nixos and home-manager configuration
Log | Files | Refs | README

rofi.nix (3178B)


      1 { config, pkgs, lib, ... }:
      2 
      3 with lib;
      4 
      5 {
      6   options.rofi = {
      7     enable = mkEnableOption "Rofi";
      8 
      9     theme = mkOption {
     10       type = types.nullOr types.string;
     11       default = null;
     12       example = "gruvbox-dark-hard";
     13       description = "Theme from rofi-theme-selector";
     14     };
     15 
     16     borderWidth = mkOption  {
     17       type = types.nullOr types.int;
     18       default = null;
     19       example = 1;
     20       description = "Border Width";
     21     };
     22 
     23     font = mkOption {
     24       type = types.str;
     25       default = "Hack 10";
     26       example = "Hack 10";
     27       description = "Font used";
     28     };
     29 
     30     padding = mkOption {
     31       type = types.nullOr types.int;
     32       default = null;
     33       example = 400;
     34       description = "Padding";
     35     };
     36 
     37     scrollbar = mkOption {
     38       type = types.nullOr types.bool;
     39       default = null;
     40       example = true;
     41       description = "Whether or not the scrollbar should be shown";
     42     };
     43 
     44     separator = mkOption {
     45       type = types.nullOr types.oneOf [ "none" "dash" "solid" ];
     46       default = null;
     47       example = "solid";
     48       description = "Separator style";
     49     };
     50 
     51     location = mkOption {
     52       type = types.oneOf [ 
     53         "bottom"
     54         "bottom-left"
     55         "bottom-right"
     56         "center"
     57         "left"
     58         "right"
     59         "top"
     60         "top-left"
     61         "top-right"
     62       ];
     63       default = "center";
     64       description = "The default location of rofi on the screen";
     65     };
     66 
     67     width = mkOption {
     68       type = types.nullOr types.int;
     69       default = null;
     70       example = 100;
     71       description = "Width of the window";
     72     };
     73 
     74     xoffset = mkOption {
     75       type = types.int;
     76       default = 0;
     77       example = 50;
     78       description = "Translate the window by this many pixels along the x axis";
     79     };
     80 
     81     yoffset = mkOption {
     82       type = types.int;
     83       default = 0;
     84       example = 50;
     85       description = "Translate the window by this many pixels along the y axis";
     86     };
     87 
     88     lines = mkOption {
     89       type = types.nullOr types.int;
     90       default = null;
     91       example = 10;
     92       description = "Number of lines";
     93     };
     94 
     95     rowHeight = mkOption {
     96       type = types.nullOr types.int;
     97       default = null;
     98       example = 1;
     99       description = "Height of each row in chars";
    100     };
    101 
    102     terminal = mkOption {
    103       type = types.nullOr types.string;
    104       default = null;
    105       example = "${pkgs.alacritty}/bin/alacritty";
    106       description = "Path to terminal";
    107     };
    108   };
    109 
    110   config = mkIf config.rofi.enable {
    111     programs.rofi = {
    112       enable = true;
    113 
    114       theme = config.rofi.theme;
    115 
    116       borderWidth = config.rofi.borderWidth;
    117 
    118       font = config.rofi.font;
    119       #padding = config.rofi.padding;
    120       #scrollbar = config.rofi.scrollbar;
    121       #separator = config.rofi.separator;
    122       #location = config.rofi.location;
    123       #width = config.rofi.width;
    124       #xoffset = config.rofi.xoffset;
    125       #yoffset = config.rofi.yoffset;
    126 
    127       lines = config.rofi.lines;
    128       rowHeight = config.rofi.rowHeight;
    129 
    130       terminal = config.rofi.terminal;
    131 
    132       plugins = with pkgs; [
    133         rofi-calc
    134         rofi-emoji
    135       ];
    136 
    137       extraConfig = {
    138         modi = "calc,combi,drun,emoji,run,ssh";
    139       };
    140     };
    141   };
    142 }