Outputting a continuously running script without interval
arafatamim opened this issue · 1 comments
arafatamim commented
An example, running the following script currently doesn't output anything.
#!/usr/bin/env sh
dbus-monitor --session "interface='org.freedesktop.Notifications',member='Notify',type='method_call'" | grep "method call"
xPMo commented
How does nwg-wrapper know what to output? The full output to that point? The most recent line? The most recent 10 lines?
However, this should be possible to script around, since nwg-wrapper has --sig_refresh
/-sr
:
#!/bin/sh
file=$(mktemp -u)
touch "$file.txt" "$file.tmp"
nwg-wrapper -t "$file.txt" -sr 13 "$@" & # other args
nwg_pid=$!
dbus-monitor --session "interface='org.freedesktop.Notifications',member='Notify',type='method_call'" | while read -r line; do
printf '%s\n' "$line" >> "$file.tmp"
tail "$file.tmp" > "$file.txt" # last 10 lines
kill -13 "$nwg_pid" || break
cp "$file.txt" "$file.tmp"
done
kill "$nwg_pid"
rm "$file"*
But, I can't get this to work either. I might look more into it, it's a nice idea.