1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-08 19:46:05 +01:00

lorri: better notifications

- They disappear automatically in GNOME.
- They display an icon indicating the status.
- The app name is "Lorri".

@moduon MT-1075
This commit is contained in:
Jairo Llopis 2025-10-24 12:50:04 +01:00 committed by Matthieu Coudron
parent 82b58f3820
commit c644cb018f

View file

@ -104,16 +104,20 @@ in
let
jqFile = ''
(
(.Started? | values | "Build starting in \(.nix_file)"),
(.Completed? | values | "Build complete in \(.nix_file)"),
(.Failure? | values | "Build failed in \(.nix_file)")
(.Started? | values | ["Build starting", .nix_file, "emblem-synchronizing"]),
(.Completed? | values | ["Build complete", .nix_file, "checkmark"]),
(.Failure? | values | ["Build failed", .nix_file, "dialog-error"])
)
| @tsv
'';
notifyScript = pkgs.writeShellScript "lorri-notify" ''
lorri internal stream-events --kind live \
| jq --unbuffered '${jqFile}' \
| xargs -n 1 notify-send "Lorri Build"
| jq --unbuffered -r '${jqFile}' \
| while IFS=$'\t' read -r status nixFile icon; do
notify-send --app-name "Lorri" --hint=int:transient:1 \
--icon "$icon" "$status" "$nixFile"
done
'';
in
toString notifyScript;
@ -125,7 +129,6 @@ in
[
bash
jq
findutils
libnotify
cfg.package
]