1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-12-03 15:41:02 +01:00

rofi: modes option (#6115)

Adds `programs.rofi.modes` option.
For the tiny convenience of supporting the custom mode syntax.
This commit is contained in:
Shahar "Dawn" Or 2025-05-08 20:16:34 +07:00 committed by GitHub
parent 2ede089d11
commit cea975d46d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 39 additions and 3 deletions

View file

@ -132,6 +132,7 @@ let
else else
cfg.theme; cfg.theme;
modes = map (mode: if isString mode then mode else "${mode.name}:${mode.path}") cfg.modes;
in in
{ {
options.programs.rofi = { options.programs.rofi = {
@ -254,11 +255,36 @@ in
description = "Path where to put generated configuration file."; description = "Path where to put generated configuration file.";
}; };
modes = mkOption {
default = [ ];
example = literalExpression ''
[
"drun"
"emoji"
"ssh"
{
name = "whatnot";
path = lib.getExe pkgs.rofi-whatnot;
}
]
'';
type =
with types;
listOf (
either str (submodule {
options = {
name = mkOption { type = str; };
path = mkOption { type = str; };
};
})
);
description = "Modes to enable. For custom modes see `man 5 rofi-script`.";
};
extraConfig = mkOption { extraConfig = mkOption {
default = { }; default = { };
example = literalExpression '' example = literalExpression ''
{ {
modi = "drun,emoji,ssh";
kb-primary-paste = "Control+V,Shift+Insert"; kb-primary-paste = "Control+V,Shift+Insert";
kb-secondary-paste = "Control+v,Insert"; kb-secondary-paste = "Control+v,Insert";
} }
@ -313,6 +339,7 @@ in
toRasi { toRasi {
configuration = ( configuration = (
{ {
inherit modes;
font = cfg.font; font = cfg.font;
terminal = cfg.terminal; terminal = cfg.terminal;
cycle = cfg.cycle; cycle = cfg.cycle;

View file

@ -1,5 +1,6 @@
configuration { configuration {
location: 0; location: 0;
modes: [ ];
xoffset: 0; xoffset: 0;
yoffset: 0; yoffset: 0;
} }

View file

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

View file

@ -9,8 +9,16 @@
border = "border"; border = "border";
separator = "separator"; separator = "separator";
}; };
modes = [
"drun"
"emoji"
"ssh"
{
name = "foo";
path = "bar";
}
];
extraConfig = { extraConfig = {
modi = "drun,emoji,ssh";
kb-primary-paste = "Control+V,Shift+Insert"; kb-primary-paste = "Control+V,Shift+Insert";
kb-secondary-paste = "Control+v,Insert"; kb-secondary-paste = "Control+v,Insert";
}; };