-
Notifications
You must be signed in to change notification settings - Fork 351
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
dbus/dunstctl: add history command (#307) #970
Conversation
The current implementation tries to retrieve notifications stored in the history buffer (which means they've been either discarded or hidden by the user) and does so using the existing D-Bus system. However the output of the dbus-send command is (in my opinion) super ugly and unusable for any practical scripting application. This is VERY much still a work in progress.
Maybe you could use busctl? After some playing around I came up with this command: |
I like the idea. I've been also playing around the idea that instead of arrays i use a dbus dictionary instead |
A dictionary seems good, since it would create a stable interface. You can add or remove items without breaking all scripts. |
The JSON output is quite messy but usable. I'm way happier with this version compared to the last one. Changes: Added some basic error-checking to the "dunstctl history" command. Added ID, timestamp, timeout and progress to the "history" command. Used dictionary-like structure instead of arrays.
Implemented :) |
it's done |
Thanks for working on this. If you want you can add the script you're gonna use this feature with to the contrib directory |
sure |
Codecov Report
@@ Coverage Diff @@
## master #970 +/- ##
==========================================
- Coverage 60.37% 60.29% -0.09%
==========================================
Files 44 44
Lines 6655 6772 +117
==========================================
+ Hits 4018 4083 +65
- Misses 2637 2689 +52
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Could you add tests for |
sure, just not immediately |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a few more comments on the code :)
That's okay. Take your time 👍 |
seems that queues_update breaks after 5 messages in waiting. is it supposed to do that? |
let me describe the breakage in more detail. If i put into waiting more than 5 messages with |
oops seems that i have messed up the function prefixes when using sed, one sec |
b26a06a
to
8c8a1e7
Compare
here you go; added some tests unfortunately i think adding the dbus tests would create way more code than the dbus functions themselves, at which point you would most likely debug the tests themselves than the actual code |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are still 2 small things that need to be done
Thanks for adding the tests! It's fine if you don't add the dbus tests. |
It seems like a conflict was caused by me merging another PR |
here we go |
Merged it! |
I'm thinking that we don't need a separate command for |
thanks |
…#970) * dbus/dunstctl: add history command (dunst-project#307) The current implementation tries to retrieve notifications stored in the history buffer (which means they've been either discarded or hidden by the user) and does so using the existing D-Bus system. The output format is JSON, so it can be easily processed by scripts. * dbus: check string validity before sending reply * dbus/dunstctl: use dictionaries instead * dbus: change whitespace to blank string * dbus: change history callback function name * dbus/dunstctl: add history-pop-id functionality (dunst-project#970) * contrib: add notification-history.sh (dunst-project#970) * dbus/dunstctl: change i32 to u32 for history-pop-id * queues_history_pop_by_id: remove old notification from history when restore (bug) * test/queues: add notification_skip_display_redisplayed_by_random_id * test: add queue_get_history * dunstctl: history-pop-id change to uint
The current implementation tries to retrieve notifications stored in the
history buffer (which means they've been either discarded or hidden by
the user) and does so using the existing D-Bus system. However the
output of the dbus-send command is (in my opinion) super ugly and
unusable for any practical scripting application.
This is VERY much still a work in progress.
Any additional suggestions or ideas are welcome.