WIP: home: zsh: add 'zsh-done'
Some checks failed
ci/woodpecker/push/check Pipeline failed

This commit is contained in:
Bruno BELANYI 2023-08-13 16:19:47 +01:00
parent 03a404699d
commit 4d6e7aff25

View file

@ -15,6 +15,12 @@ in
enable = my.mkDisableOption "zsh configuration";
launchTmux = mkEnableOption "auto launch tmux at shell start";
notify = {
enable = mkEnableOption "zsh-done notification";
enableSsh = mkEnableOption "notify through SSH connections";
};
};
config = lib.mkIf cfg.enable (lib.mkMerge [
@ -93,5 +99,33 @@ in
enableVteIntegration = true;
};
}
(lib.mkIf cfg.notify.enable {
home.zsh = {
plugins = [
{
name = "zsh-done";
file = "share/zsh/site-functions/done.plugin.zsh";
src = pkgs.my.zsh-done;
}
];
localVariables = {
# Enable `zsh-done` through SSH, if configured
DONE_ALLOW_NONGRAPHICAL = lib.mkIf cfg.notify.enableSsh 1;
};
# Use OSC-777 to send the notification through SSH
initExtra = lib.mkIf cfg.notify.enableSsh ''
done_send_notification() {
local exit_status="$1"
local title="$2"
local message="$3"
${lib.getExe pkgs.my.osc777} "$title" "$message"
}
'';
};
})
]);
}