Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix duplicate mailsync notifications #640

Merged
merged 1 commit into from
Jan 24, 2021
Merged

Fix duplicate mailsync notifications #640

merged 1 commit into from
Jan 24, 2021

Conversation

friedev
Copy link
Contributor

@friedev friedev commented Jan 24, 2021

mailsync was giving me duplicate notifications because it would detect the same display twice. I manually ran the command used to get the displays, and found the following:

$ pgrep -a Xorg
387 /usr/lib/Xorg :0 -seat seat0 -auth /run/lightdm/root/:0 -nolisten tcp vt7 -novtswitch

$ pgrep -a Xorg | grep -wo "[0-9]*:[0-9]\+"
:0
:0

To fix this, I just piped the output into uniq:

$ pgrep -a Xorg | grep -wo "[0-9]*:[0-9]\+" | uniq
:0

@PRESFIL
Copy link
Contributor

PRESFIL commented Jan 26, 2021

uniq(1) says:

Note: 'uniq' does not detect repeated lines unless they are adjacent. You may want to sort the input first, or use 'sort -u' without 'uniq'.

If I were you, I would use sort -u, or are you sure that stdio of uniq is guaranteed sorted.

@friedev
Copy link
Contributor Author

friedev commented Jan 26, 2021

If I were you, I would use sort -u, or are you sure that stdio of uniq is guaranteed sorted.

I suppose it's theoretically not guaranteed that the duplicates are adjacent, so I agree that sort -u would be a more robust solution. And actually, it looks like that change already got merged over from Luke's Git server:
https://git.lukesmith.xyz/mutt-wizard/commit/b56686aae5721da0f26bfac28b97635a363896e7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants