Compare commits

...

2 commits

Author SHA1 Message Date
0b97f65691 homes: bazin: enable zsh notifications
All checks were successful
ci/woodpecker/push/check Pipeline was successful
2024-02-13 11:09:49 +00:00
7f005d1723 home: zsh: add 'zsh-done' 2024-02-13 11:09:49 +00:00
2 changed files with 42 additions and 0 deletions

View file

@ -21,5 +21,11 @@
package = pkgs.emptyDirectory;
};
};
zsh = {
notify = {
enable = true;
};
};
};
}

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,35 @@ in
enableVteIntegration = true;
};
}
(lib.mkIf cfg.notify.enable {
programs.zsh = {
plugins = [
{
name = "zsh-done";
file = "share/zsh/site-functions/done.plugin.zsh";
src = pkgs.ambroisie.zsh-done;
}
];
# `localVariables` values don't get merged correctly due to their type,
# don't use `mkIf`
localVariables = { }
# Enable `zsh-done` through SSH, if configured
// lib.optionalAttrs cfg.notify.enableSsh { DONE_ALLOW_NONGRAPHICAL = 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.ambroisie.osc777} "$title" "$message"
}
'';
};
})
]);
}