mako
mako copied to clipboard
Copy notification text with middle button click
I know the middle button click is configurable with on-button-middle=action
, but is there any way to pass the notification text to wl-copy
?
You'll need to use the $id
shell variable, combined with makoctl list
and jq
, to get the notification text.
Gotcha, I tried playing around with it for a while but it looks like makoctl list
outputs a 2d array in .data and I'm not familiar enough with json or jq to know how to get it to do a nested loop and output the message body when the id == $id
I've been playing around with this idea and came across this thread. Anyway, the following appears to do the trick:
jq -r '.data|..|select(.id?.data=='$id')|.body|.data' | wl-copy
Note the above copies the "body" of the notification into the clipboard, depending on what you're trying to do, you may want to change body
to summary
.
Unfortunately, I haven't figured out how to both copy the data and dismiss the notification, e.g. the following fails to dismiss the notification:
on-button-left=exec makoctl list | jq -r '.data|..|select(.id?.data=='$id')|.body|.data' | wl-copy; mackoctl dismiss -n $id
I'm probably missing something obvious.