home: zsh: add notification exclusion list
All checks were successful
ci/woodpecker/push/check Pipeline was successful
All checks were successful
ci/woodpecker/push/check Pipeline was successful
This commit is contained in:
parent
3c79a373e4
commit
a0dde6f274
|
@ -19,6 +19,27 @@ in
|
||||||
notify = {
|
notify = {
|
||||||
enable = mkEnableOption "zsh-done notification";
|
enable = mkEnableOption "zsh-done notification";
|
||||||
|
|
||||||
|
exclude = mkOption {
|
||||||
|
type = with types; listOf str;
|
||||||
|
default = [
|
||||||
|
"direnv reload"
|
||||||
|
"fg"
|
||||||
|
"git (?!push|pull|fetch)"
|
||||||
|
"htop"
|
||||||
|
"less"
|
||||||
|
"man"
|
||||||
|
"nvim"
|
||||||
|
"tail -f"
|
||||||
|
"tmux"
|
||||||
|
"vim"
|
||||||
|
];
|
||||||
|
example = [ "command --long-running-option" ];
|
||||||
|
description = ''
|
||||||
|
List of exclusions which should not be create a notification. Accepts
|
||||||
|
Perl regexes (implicitly anchored with `^\s*`).
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
ssh = {
|
ssh = {
|
||||||
enable = mkEnableOption "notify through SSH/non-graphical connections";
|
enable = mkEnableOption "notify through SSH/non-graphical connections";
|
||||||
|
|
||||||
|
@ -116,10 +137,17 @@ in
|
||||||
|
|
||||||
# `localVariables` values don't get merged correctly due to their type,
|
# `localVariables` values don't get merged correctly due to their type,
|
||||||
# don't use `mkIf`
|
# don't use `mkIf`
|
||||||
localVariables = { }
|
localVariables = {
|
||||||
|
DONE_EXCLUDE =
|
||||||
|
let
|
||||||
|
joined = lib.concatMapStringsSep "|" (c: "(${c})") cfg.notify.exclude;
|
||||||
|
in
|
||||||
|
''^\s*(${joined})'';
|
||||||
|
}
|
||||||
# Enable `zsh-done` through SSH, if configured
|
# Enable `zsh-done` through SSH, if configured
|
||||||
// lib.optionalAttrs cfg.notify.ssh.enable { DONE_ALLOW_NONGRAPHICAL = 1; }
|
// lib.optionalAttrs cfg.notify.ssh.enable {
|
||||||
;
|
DONE_ALLOW_NONGRAPHICAL = 1;
|
||||||
|
};
|
||||||
|
|
||||||
# Use OSC-777 to send the notification through SSH
|
# Use OSC-777 to send the notification through SSH
|
||||||
initExtra = lib.mkIf cfg.notify.ssh.useOsc777 ''
|
initExtra = lib.mkIf cfg.notify.ssh.useOsc777 ''
|
||||||
|
|
Loading…
Reference in a new issue