From 527439cf9d61b3cc1fd8f55c0ba57ed0fec1ed25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kier=C3=A1n=20Meinhardt?= Date: Wed, 8 May 2024 06:37:17 +0200 Subject: [PATCH] dunst: add command to list recent notifications --- configs/dunst.nix | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/configs/dunst.nix b/configs/dunst.nix index 223a0c6..e041014 100644 --- a/configs/dunst.nix +++ b/configs/dunst.nix @@ -4,7 +4,18 @@ ... }: let inherit (import ../lib) defaultApplications theme; + sgr = code: string: ''\u001b[${code}m${string}\u001b[0m''; in { + environment.systemPackages = [ + (pkgs.writers.writeDashBin "notifications" '' + ${pkgs.dunst}/bin/dunstctl history \ + | ${pkgs.jq}/bin/jq -r ' + .data[] + | map("${sgr "90" ''\(.appname.data)''} ${sgr "1" ''\(.summary.data)''} ${sgr "31" ''\(.body.data | gsub("\n"; " | "))''}") + | join("\n")' + '') + ]; + home-manager.users.me.services.dunst = { enable = true; iconTheme = (theme pkgs).icon;