aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/dot_config/waybar/executable_mako-history.sh
blob: f15ec9cdfd7f98bbda36ff4f21ac1de5f72883a5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/sh
# Fuzzel picker over mako's notification history. Read-only: mako has no
# API to re-invoke an arbitrary history item, so the selected entry is
# copied to the clipboard for reference. Use makoctl restore to bring the
# most recent dismissed notification back to the active list.

set -eu

selection=$(
  makoctl history | awk '
    /^Notification / {
      sub(/^Notification [0-9]+: /, "")
      summary = $0
      next
    }
    /^  App name: / {
      sub(/^  App name: /, "")
      print "[" $0 "] " summary
    }
  ' | fuzzel --dmenu --prompt 'History: '
)

if [ -n "$selection" ]; then
  printf '%s' "$selection" | wl-copy
fi