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

Skip display rule option #590

Merged
merged 3 commits into from
Feb 9, 2019

Conversation

mgsloan
Copy link
Contributor

@mgsloan mgsloan commented Jan 16, 2019

The hack described in #588 - setting timeout = "1ms" in a rule to skip display - doesn't always work. Sometimes I see the notification for a brief flash.

There could potentially be a different workaround for this, say, skipping enqueue to the waiting list if the timeout is sufficiently low.

I've gone ahead and implemented an explicit option. This will also make things work better in the case that sticky_history is set to false. It also means that if DUNST_COMMAND_PAUSE has been used, when it gets unpaused it won't need to work its way through a queue of waiting notifications with tiny timeout.

@bebehei
Copy link
Member

bebehei commented Jan 16, 2019

On my mobile, but some thoughts:

  • There's no NotificationClosed signal sent for notifications with skip_display set.
  • The queue length of history isn't respected.

But I definitele appreciate your new PR!

@mgsloan
Copy link
Contributor Author

mgsloan commented Jan 16, 2019

@bebehei Ah, good point! I've updated the PR to address those points.

@tsipinakis
Copy link
Member

👍 As I mentioned in the previous issue, perhaps making this happen implicitly if the timeout is really short could save us adding another knob. @bebehei what do you think?

@mgsloan
Copy link
Contributor Author

mgsloan commented Jan 17, 2019

Yeah I'd be fine with timeout == 1 implying skipping display. It's a bit funky, would be better if it was timeout == 0, but that already has a special meaning.

Certainly can understand the desire to reduce the number of knobs. On the other hand, that would increase the number of particularly distinguished values on one of the knobs - maybe that's preferred?

Copy link
Member

@bebehei bebehei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, this review was lying around for a few days. I obviously forgot to click the submit button.


+1 As I mentioned in the previous issue, perhaps making this happen implicitly if the timeout is really short could save us adding another knob. @bebehei what do you think?

Well, I'd rather choose complexity over weird behavior. But actually I'd appreciate none of both 😁

The functionality is implemented as a rule and I think this just supports our main feature, the rules.

But a no merger will be: missing tests.

src/queues.c Outdated Show resolved Hide resolved
@mgsloan
Copy link
Contributor Author

mgsloan commented Jan 20, 2019

@bebehei Thanks for reviewing. I believe I've addressed your feedback in subsequent commits.

I think it's easier to review with incremental commits, but let me know if I should squash it into one (though I think it's best to keep the revert separate).

Copy link
Member

@bebehei bebehei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, we're getting into the corner cases now: What shall we do with notifications having a stack_tag, or qualify for stack_duplicates or have a replacement id. Skip_display behaves inconsistent.


queues_init();
queues_notification_insert(n);
QUEUE_LEN_ALL(0, 0, 1);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly, I'm missing another check for the signal.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do we check for the signal? Note that this code is exercising the queues, not end-to-end dbus functionality (the signal is done in dbus.c not queues.c). I don't see any end-to-end tests that also involve rules.

@mgsloan
Copy link
Contributor Author

mgsloan commented Jan 23, 2019

What shall we do with notifications having a stack_tag, or qualify for stack_duplicates or have a replacement id. Skip_display behaves inconsistent.

Good question. I considered this, but at the time thought it was reasonable that if a notification is being displayed, then stacking a skip_display notification atop it should continue being displayed.

However, I can see it being confusing if a notification that has a skip_display rule ends up being displayed in this case. I don't think there is necessarily a right answer here, but I also don't think it's worth making the knob more complicated to allow both semantics.

I can certainly try adding a commit that implements latter semantics, but I don't see a way to implement it without making the code a fair bit more complicated.

@mgsloan
Copy link
Contributor Author

mgsloan commented Jan 28, 2019

@bebehei Ping! As far as I can tell the next steps here are:

  1. Determine how skip_display and notification stacking should interact

  2. How to test signaling of issue close, particularly when the test is unit testing the queues which is not responsible for sending the close signal. At least, this is how I'm interpreting your comment on the test code.

@bebehei
Copy link
Member

bebehei commented Jan 29, 2019

Determine how skip_display and notification stacking should interact

This would be my turn master...bebehei:pr590. You can take the code fully.

Every replacement case is covered by: Just replace it as usual, but vanish the notification right with the next update. see the docs from queues_notification_insert():

dunst/src/queues.h

Lines 126 to 127 in 711b11c

* @post Call wake_up() to synchronize the queues with the UI
* (which closes old and shows new notifications on screen)

How to test signaling of issue close,

Sorry, I've sent you into the wrong direction. The basics are actually testable. But in conjunction together, it's too tricky to get tested right now.

@bebehei bebehei added this to the v1.4.0 milestone Jan 30, 2019
@mgsloan
Copy link
Contributor Author

mgsloan commented Jan 31, 2019

@bebehei LGTM, thanks for making those changes. They seem to work well. I've rebased atop master and pushed to my branch.

I think this is ready for merge, right?

@mgsloan
Copy link
Contributor Author

mgsloan commented Feb 5, 2019

@tsipinakis Ping! Looks like @bebehei is requesting that you review this. Thanks!

@tsipinakis
Copy link
Member

tsipinakis commented Feb 5, 2019

Opps, I completely missed the notification for this, sorry for the delay!

I did a review and realised halfway through that when pulling @bebehei 's tests you accidentally rolled back the commit fixing the initial mistakes.
e.g. There's still no NotificationClosed signal.

@bebehei
Copy link
Member

bebehei commented Feb 5, 2019

e.g. There's still no NotificationClosed signal.

The signal is there. But there are no tests for it. Right now the signals aren't feasible to test.

@tsipinakis
Copy link
Member

With 977a7a7 I don't see a NotificationClosed signal when skip_display is used. Am I missing something?

@bebehei
Copy link
Member

bebehei commented Feb 5, 2019

Ouch, queues_history_push is the wrong method. I should have proposed queues_notification_close 🙈

mgsloan added a commit to mgsloan/dunst that referenced this pull request Feb 5, 2019
@mgsloan
Copy link
Contributor Author

mgsloan commented Feb 5, 2019

@tsipinakis @bebehei Ah, good catch! I've pushed a commit that fixes the problem, and have verified via dbus-monitor that the notification close is sent. I also moved an invocation of g_queue_delete_link, because queues_notification_close only works if the notification is still on the waiting queue.

Copy link
Member

@tsipinakis tsipinakis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

My perfectionist side wants to somehow merge this setting and format = "" into a single value but I can't come up with a reasonable way to do that.

Will merge after that small nitpick is resolved/answered (not a blocker, just curious about why it's there).

@@ -133,6 +133,9 @@ static bool queues_notification_is_finished(struct notification *n, struct dunst
{
assert(n);

if (n->skip_display && !n->redisplayed)
return true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This hunk seems redundant, the notifications never see the displayed queue but skip directly from waiting to history. Was there a reason for adding this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, would need to ask @bebehei as he wrote this. It does seem redundant for the current use of queues_notification_is_finished, but if there are future usages of it, it might be good to have this check.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may seem redundant, but actually it isn't. For the case, that an already displayed notification gets replaced, this would trigger the immediate removal.

@mgsloan
Copy link
Contributor Author

mgsloan commented Feb 9, 2019

@tsipinakis Ping! (No rush, just wanted to check if this had fallen off your radar)

@tsipinakis
Copy link
Member

It hasn't, was just waiting for @bebehei to respond but it looks like he's busy. I'll go ahead and merge this as it's not an actual issue and as you said some redundancy is a good thing.

@tsipinakis tsipinakis merged commit 63ec283 into dunst-project:master Feb 9, 2019
@mgsloan
Copy link
Contributor Author

mgsloan commented Feb 9, 2019

Great, thanks a bunch for reviewing, y'all!

@bebehei
Copy link
Member

bebehei commented Feb 11, 2019

It hasn't, was just waiting for @bebehei to respond but it looks like he's busy

Yeah, I had been a few days off. Thanks for merging and caring here.

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

Successfully merging this pull request may close these issues.

3 participants