1

Lib/Rofi: Allow supplying a dmenu command for mkSimpleMenu

This commit is contained in:
2026-03-20 22:46:58 +01:00
parent 2f675e96f0
commit fe69d39769

View File

@ -21,7 +21,11 @@
|> builtins.attrValues |> builtins.attrValues
|> builtins.concatStringsSep "\n"; |> builtins.concatStringsSep "\n";
in in
prompt: attrs: {
prompt,
attrs,
command ? ''rofi -dmenu -p " ${prompt} " -i'',
}:
pkgs.writeScriptBin "rofi-menu-${prompt}" '' pkgs.writeScriptBin "rofi-menu-${prompt}" ''
#! ${pkgs.fish}/bin/fish #! ${pkgs.fish}/bin/fish
@ -29,7 +33,7 @@
set OPTIONS ${unpack-options attrs} set OPTIONS ${unpack-options attrs}
# We choose a single OPTION using Rofi # We choose a single OPTION using Rofi
set OPTION (echo -e (string join "\n" $OPTIONS) | rofi -dmenu -p " ${prompt} " -i) set OPTION (echo -e (string join "\n" $OPTIONS) | ${command})
# Check if the chosen OPTION is a valid choice from OPTIONS # Check if the chosen OPTION is a valid choice from OPTIONS
if not contains $OPTION $OPTIONS if not contains $OPTION $OPTIONS