I'm trying to monitor theme changes using this command:
-shell
dbus-monitor --session "interface='org.freedesktop.portal.Settings', member=SettingChanged" | grep -o "uint32 ."
Output right now looks like this:
uint32 0
uint32 0
uint32 1
uint32 1
uint32 0
uint32 0
uint32 1
uint32 1
This output comes from theme toggling. The theme notification shows up twice for some reason. Now I want to pipe it to uniq
so I only remain with a single entry like so:
uint32 0
uint32 1
uint32 0
uint32 1
However appending uniq
at the end does not produce any output anymore.
-shell
dbus-monitor --session "interface='org.freedesktop.portal.Settings', member=SettingChanged" | grep -o "uint32 ." | uniq
From man uniq
:
> Filter adjacent matching lines from INPUT (or standard input), writing to OUTPUT (or standard output).
uniq
needs to buffer at least the last output line to be able to detect adjacent lines, I don't see any reason why it could not buffer it and pass it along the pipeline. I've tried tweaking line buffering as suggested [here](https://unix.stackexchange.com/questions/295814/uniq-is-not-realtime-when-piped) but the results are still the same for me.
-shell
dbus-monitor --session "interface='org.freedesktop.portal.Settings', member=SettingChanged" | grep -o "uint32 ." | stdbuf -oL -i0 uniq
Asked by Pavel Skipenes
(235 rep)
Jun 18, 2023, 11:31 AM
Last activity: Jun 20, 2023, 10:57 PM
Last activity: Jun 20, 2023, 10:57 PM