Skip to content

Get the number of notifications#793

Merged
tsipinakis merged 5 commits intodunst-project:masterfrom
ritze:get-number-of-notifications
Dec 28, 2020
Merged

Get the number of notifications#793
tsipinakis merged 5 commits intodunst-project:masterfrom
ritze:get-number-of-notifications

Conversation

@ritze
Copy link
Contributor

@ritze ritze commented Dec 21, 2020

This will add the dbus properties

  • displayed
  • waiting
  • history

and extends dunstctl with the sub-command status, which provides this information.

Currently I'm not sure, if history is the right term. Maybe shown fits here better.

See also the feature request #792.

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.

Some naming nitpicks. Otherwise LGTM 👍

dunstctl Outdated
property_set paused variant:boolean:"$2"
fi
;;
"status")
Copy link
Member

Choose a reason for hiding this comment

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

status is a bit ambiguous, one could assume this is paused status. I'd suggest count as the command (unless you have a better idea?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have no better idea as count. I'll change it…

src/dbus.c Outdated

" <property name=\"displayed\" type=\"u\" access=\"read\" />"
" <property name=\"history\" type=\"u\" access=\"read\" />"
" <property name=\"waiting\" type=\"u\" access=\"read\" />"
Copy link
Member

Choose a reason for hiding this comment

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

Similar here, I'd name it displayedLength to avoid naming conflicts for future expansions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would name them all in the same way:

  • displayedLength
  • historyLength
  • waitingLength

Without the technical knowledge, it's hard to get, what those properties shall return. Maybe we can find names?

Copy link
Member

Choose a reason for hiding this comment

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

I gave an example for displayed but I did mean to change all of them :). Your list of names looks good to me.

@codecov-io
Copy link

codecov-io commented Dec 23, 2020

Codecov Report

Merging #793 (4d74c7b) into master (a89287c) will decrease coverage by 0.11%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #793      +/-   ##
==========================================
- Coverage   65.02%   64.91%   -0.12%     
==========================================
  Files          30       30              
  Lines        5275     5284       +9     
==========================================
  Hits         3430     3430              
- Misses       1845     1854       +9     
Flag Coverage Δ
unittests 64.91% <0.00%> (-0.12%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/dbus.c 62.71% <0.00%> (-1.98%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a89287c...4d74c7b. Read the comment docs.

@ritze
Copy link
Contributor Author

ritze commented Dec 25, 2020

Shall I provide unit tests too? As I can see there are no tests for the dbus interface or dunstctl yet.

@fwsmit
Copy link
Member

fwsmit commented Dec 25, 2020

Yeah that'd be great. More testing is always better

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, as @fwsmit said, if you can also add some tests for this it'd be great but I'm happy to merge as-is if you don't have the time.

@ritze
Copy link
Contributor Author

ritze commented Dec 28, 2020

I guess that it makes sense to merge it now. I won't find time to write tests for the next days or even weeks.

@tsipinakis tsipinakis merged commit 167d7dd into dunst-project:master Dec 28, 2020
@ritze ritze deleted the get-number-of-notifications branch January 16, 2021 15:34
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.

4 participants