1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-23 03:29:45 +01:00

rofi: modes option

Adds `programs.rofi.modes` option.
For the tiny convenience of supporting the custom mode syntax.
This commit is contained in:
Shahar "Dawn" Or 2024-11-22 12:57:59 +07:00
parent a46e702093
commit e3d18bf7bf
3 changed files with 39 additions and 3 deletions

View file

@ -99,6 +99,10 @@ let
else
cfg.theme;
modes =
map (mode: if isString mode then mode else "${mode.name}:${mode.path}")
cfg.modes;
in {
options.programs.rofi = {
enable = mkEnableOption
@ -222,11 +226,34 @@ in {
description = "Path where to put generated configuration file.";
};
modes = mkOption {
default = null;
example = literalExpression ''
[
"drun"
"emoji"
"ssh"
{
name = "whatnot";
path = lib.getExe pkgs.rofi-whatnot;
}
]
'';
type = with types;
nullOr (listOf (either string (submodule {
options = {
name = mkOption { type = string; };
path = mkOption { type = string; };
};
})));
description = "Modes to enable. For custom modes see `man 5 rofi-script`.";
};
extraConfig = mkOption {
default = { };
example = literalExpression ''
{
modi = "drun,emoji,ssh";
show-icons = true;
kb-primary-paste = "Control+V,Shift+Insert";
kb-secondary-paste = "Control+v,Insert";
}
@ -274,6 +301,7 @@ in {
home.file."${cfg.configPath}".text = toRasi {
configuration = ({
inherit modes;
font = cfg.font;
terminal = cfg.terminal;
cycle = cfg.cycle;

View file

@ -4,7 +4,7 @@ font: "Droid Sans Mono 14";
kb-primary-paste: "Control+V,Shift+Insert";
kb-secondary-paste: "Control+v,Insert";
location: 0;
modi: "drun,emoji,ssh";
modes: [ "drun","emoji","ssh","foo:bar" ];
terminal: "/some/path";
xoffset: 0;
yoffset: 0;

View file

@ -9,13 +9,21 @@ with lib;
font = "Droid Sans Mono 14";
terminal = "/some/path";
cycle = false;
modes = [
"drun"
"emoji"
"ssh"
{
name = "foo";
path = "bar";
}
];
window = {
background = "background";
border = "border";
separator = "separator";
};
extraConfig = {
modi = "drun,emoji,ssh";
kb-primary-paste = "Control+V,Shift+Insert";
kb-secondary-paste = "Control+v,Insert";
};