Rofi notification log

I’ve been trying to create a notification log that rofi displays. I figured out the logging thanks to a video by DT, but there are a few issues.

The log file seems to be storing extra information.

This is the output of one test notification sent with notify-send "Protonmail" "test":

--- 2023-05-11 11:47:36 ---
notify-send
Protonmail
test
--- 2023-05-11 11:47:36 ---
string "notify-send",string "",string "Protonmail",string "test",string "urgency",string "sender-pid"
--- 2023-05-11 11:47:36 ---
string "notify-send",string "Protonmail",string "test"
--- 2023-05-11 11:47:36 ---
notify-send,Protonmail,test
--- 2023-05-11 11:47:36 ---
string "notify-send",string "Protonmail",string "test"
--- 2023-05-11 11:47:36 ---
string "notify-send",string "Protonmail",string "test"
--- 2023-05-11 11:47:36 ---
string "notify-send",string "",string "Protonmail",string "test",string "urgency",string "sender-pid"
--- 2023-05-11 11:47:36 ---
string "notify-send",string "Protonmail",string "test"
--- 2023-05-11 11:47:36 ---
--- 2023-05-11 11:47:36 ---
string "notify-send",string "Protonmail",string "test"
string "notify-send",string "Protonmail",string "test"

Optimally I only want this information:

--- DATE ---
--- TITLE ---
--- CONTENT ---

As a result, what rofi displays has a lot of useless information.

I don’t know much about bash scripting so I’ve been relying on chatGPT for the most part, but am out of ideas. If anyone is interested in taking a look at the code, here are the relevant files:

logging script
rofi script

If you are using dunst for the notifications, try dunstctl.

dunstctl -h