dunst icon indicating copy to clipboard operation
dunst copied to clipboard

Feature Request: Configurable Notification Sorting Order (Ascending / Descending / Random?)

Open S-u-b opened this issue 4 years ago • 4 comments

This request is related to the following bug report: #838 Disabled Sorting Order Is Not Honored While Dunst Is Paused

Lets call the new global option being made available to control this behavior: "sort_order" (or go with whatever you prefer). Once implemented, generating notifications as follows: notify-send 1 notify-send 2 notify-send 3 notify-send 4 notify-send -u low 1 notify-send -u low 2 notify-send -u low 3 notify-send -u low 4 notify-send -u critical 1 notify-send -u critical 2 notify-send -u critical 3 notify-send -u critical 4

Would produce these notification results (when using the default "true" value for the "sort", or more aptly named: "sort_urgency", option; a "false" value would simply make Dunst not group the notifications by urgency at all):

  • when sort_order in the dunstrc configuration is set to ascending: 1 (critical) 2 (critical) 3 (critical) 4 (critical) 1 2 3 4 1 (low) 2 (low) 3 (low) 4 (low)

  • when sort_order in the dunstrc configuration is set to descending: 4 (low) 3 (low) 2 (low) 1 (low) 4 3 2 1 4 (critical) 3 (critical) 2 (critical) 1 (critical)

  • when sort_order in the dunstrc configuration is set to random (results may actually vary; I'm also not strongly attached to getting this particular setting choice, so I'd be fine with you deciding that it's too much of a gimmick and not implementing it): 1 (low) 4 (low) 3 (low) 2 (low) 1 4 2 3 3 (critical) 1 (critical) 2 (critical) 4 (critical)

S-u-b avatar Mar 26 '21 12:03 S-u-b

Thank you for the clear feature request. I agree we should add an setting sort_order with the options of descending or ascending (random isn't useful I think), and rename sort to sort_urgency (and add a deprecation warning message for the old name). Edit: I just noticed that my interpretation of ascending is different from yours. I would say that ascending means higher urgency, the more you go down the list. Is there a better name for those options?

fwsmit avatar Mar 31 '21 12:03 fwsmit

There is also one thing I would like to change internally. Currently the notifications are sorted based on their ID, which is almost, but not exactly the same as ordering based on their time. For I will change that to sorting based on their arival time (which is not updated when the notification is updated). There's also the option of sorting based on their update time, which we maybe could add later.

fwsmit avatar Mar 31 '21 12:03 fwsmit

Thank you for the clear feature request. I agree we should add an setting sort_order with the options of descending or ascending (random isn't useful I think), and rename sort to sort_urgency (and add a deprecation warning message for the old name). Edit: I just noticed that my interpretation of ascending is different from yours. I would say that ascending means higher urgency, the more you go down the list. Is there a better name for those options?

I think that this sort ordering could then perhaps be applied to both options, which would yield the following combinations (based on my original notify-send ... command examples):

1) sort_order -> ascending ("lowest id or oldest arrival/update time" -> "highest id or newest arrival/update time") + sort_urgency -> ascending (low -> normal -> critical) = 1 (low) 2 (low) 3 (low) 4 (low) 1 2 3 4 1 (critical) 2 (critical) 3 (critical) 4 (critical)

2) sort_order -> ascending ("lowest id or oldest arrival/update time" -> "highest id or newest arrival/update time") + sort_urgency -> descending (critical -> normal -> low) = 1 (critical) 2 (critical) 3 (critical) 4 (critical) 1 2 3 4 1 (low) 2 (low) 3 (low) 4 (low)

3) sort_order -> descending ("highest id or newest arrival/update time" -> "lowest id or oldest arrival/update time") + sort_urgency -> ascending (low -> normal -> critical) = 4 (low) 3 (low) 2 (low) 1 (low) 4 3 2 1 4 (critical) 3 (critical) 2 (critical) 1 (critical)

4) sort_order -> descending ("highest id or newest arrival/update time" -> "lowest id or oldest arrival/update time") + sort_urgency -> descending (critical -> normal -> low) = 4 (critical) 3 (critical) 2 (critical) 1 (critical) 4 3 2 1 4 (low) 3 (low) 2 (low) 1 (low)

Also, for those who don't care to group the notifications by urgency at all, the sort_urgency option should probably take an additional "none" value, so that it produces the same behavior that the original sort option used to produce when it was set to "false"? This would provide 2 additional sort_order / sort_urgency combinations (the notifications only appear to be grouped by urgency because of the order in which the notify-send ... commands were run, but should no longer really appear at fixed points in the overall list of notifications):

1) sort_order -> ascending ("lowest id or oldest arrival/update time" -> "highest id or newest arrival/update time") + sort_urgency -> none = 1 2 3 4 1 (low) 2 (low) 3 (low) 4 (low) 1 (critical) 2 (critical) 3 (critical) 4 (critical)

2) sort_order -> descending ("highest id or newest arrival/update time" -> "lowest id or oldest arrival/update time") + sort_urgency -> none = 4 (critical) 3 (critical) 2 (critical) 1 (critical) 4 (low) 3 (low) 2 (low) 1 (low) 4 3 2 1

Making what the notification sorting is based on (ie id, arrival time, update time, etc) configurable too sounds like a good idea to me :slightly_smiling_face:, and will likely help close out past issue requests asking for this, but I'm content with the current id based sorting.

In any case, feel free to implement these changes as you best see fit.

S-u-b avatar Apr 01 '21 01:04 S-u-b

Ref: #206

fwsmit avatar Jun 07 '21 11:06 fwsmit