fzfmenu: make -name and -title configurable
This commit is contained in:
parent
15d1fb2627
commit
ac9d611884
@ -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" ''
|
pkgs.writeDashBin "fzfmenu" ''
|
||||||
set -efu
|
set -efu
|
||||||
@ -34,7 +61,8 @@ pkgs.writeDashBin "fzfmenu" ''
|
|||||||
OUTPUT="$(${pkgs.coreutils}/bin/mktemp)"
|
OUTPUT="$(${pkgs.coreutils}/bin/mktemp)"
|
||||||
if [ -z ''${TERM+x} ]; then #check if we can print fzf in the shell
|
if [ -z ''${TERM+x} ]; then #check if we can print fzf in the shell
|
||||||
${pkgs.rxvt_unicode}/bin/urxvt \
|
${pkgs.rxvt_unicode}/bin/urxvt \
|
||||||
-name fzfmenu -title fzfmenu \
|
-name ${cfg.appName} \
|
||||||
|
-title ${shell.escape cfg.windowTitle} \
|
||||||
-e ${pkgs.dash}/bin/dash -c \
|
-e ${pkgs.dash}/bin/dash -c \
|
||||||
"echo \"$INPUT\" | ${pkgs.fzf}/bin/fzf \
|
"echo \"$INPUT\" | ${pkgs.fzf}/bin/fzf \
|
||||||
--history=/dev/null \
|
--history=/dev/null \
|
||||||
|
Loading…
Reference in New Issue
Block a user