fzfmenu: make -name and -title configurable

This commit is contained in:
tv 2020-06-16 20:27:59 +02:00
parent 15d1fb2627
commit ac9d611884

View File

@ -1,4 +1,31 @@
{ pkgs, ... }:
with import <stockholm/lib>;
{ pkgs, ... }@args:
let
# config cannot be declared in the input attribute set because that would
# cause callPackage to inject the wrong config. Instead, get it from ...
# via args.
config = args.config or {};
cfg = eval.config;
eval = evalModules {
modules = singleton {
_file = toString ./profile.nix;
imports = singleton config;
options = {
appName = mkOption {
default = "fzfmenu";
type = types.label;
};
windowTitle = mkOption {
default = "fzfmenu";
type = types.str;
};
};
};
};
in
pkgs.writeDashBin "fzfmenu" ''
set -efu
@ -34,7 +61,8 @@ pkgs.writeDashBin "fzfmenu" ''
OUTPUT="$(${pkgs.coreutils}/bin/mktemp)"
if [ -z ''${TERM+x} ]; then #check if we can print fzf in the shell
${pkgs.rxvt_unicode}/bin/urxvt \
-name fzfmenu -title fzfmenu \
-name ${cfg.appName} \
-title ${shell.escape cfg.windowTitle} \
-e ${pkgs.dash}/bin/dash -c \
"echo \"$INPUT\" | ${pkgs.fzf}/bin/fzf \
--history=/dev/null \