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

Get the history stack from command line #307

Closed
ohque opened this issue Mar 4, 2017 · 8 comments
Closed

Get the history stack from command line #307

ohque opened this issue Mar 4, 2017 · 8 comments
Labels

Comments

@ohque
Copy link

ohque commented Mar 4, 2017

Let the users get notification history with something like dunstcli --get-history or dunstcli ls and then leave it to them to do with the data whatever they want.
One use case that I have in mind specifically is displaying notification count in the panel, as well as some other info based on what kind of notifications are in the history stack at the moment.

This feature request belongs to the general idea of exposing functionality to the command line: #284

@ohque ohque changed the title A way to get the history stack from command line Get the history stack from command line Mar 4, 2017
@11111000000
Copy link

11111000000 commented Mar 27, 2019

Please, help! How to get history? I lost important notification! ctrl-grave not works for some reason (exwm)... Can I restore history after dunst reload?
...
I found a way to restore last 20 elements, but unfortunately, needed notification is lost... :( Is there any way to restore all today notifications?

@tsipinakis
Copy link
Member

@11111000000 If more than 20 notifications have been sent since it's not possible unfortunately. The history_length setting controls how many notifications are kept in history, and it's set to 20 by default.

History is never saved anywhere, it's just in memory while dunst is running because it's not meant to handle important data it's there as a "I need a way to see what I missed".

@snide
Copy link

snide commented Sep 24, 2020

Just a note because I see this thread pops on google when you search for dunst history. You can run dunstctl history-pop to pull the last notification. It can be run multiple times to go back in history.

@Narrat
Copy link

Narrat commented Sep 24, 2020

If that is the case, isn't this issue a candidat for closing?

@snide
Copy link

snide commented Sep 24, 2020

I didn't make the original issue and it makes a slightly different request, looking for the data, rather than replaying the notification. I just added it in case people run into a similar need.

@dkasak
Copy link

dkasak commented Oct 25, 2021

How about getting a notification from the history without popping it from the stack? This is how it used to work with the [shortcuts] history = ... setting. Sorry, it already works this way. Doing history-pop followed by close will push the notification back into history.

The man page also erroneously calls out dunstctl history but that command doesn't exist:

Dunst saves a number of notifications (specified by history_length) in memory. These notifications can be recalled (i.e. redisplayed) by calling dunstctl history (see dunstctl(1)).

@nikp123
Copy link
Contributor

nikp123 commented Nov 9, 2021

Managed to implement it however it has REALLY ugly output. Especially because of unbroken newlines messing with the output. Posting code soon...

nikp123 added a commit to nikp123/dunst that referenced this issue Nov 9, 2021
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.
fwsmit pushed a commit that referenced this issue Nov 29, 2021
* dbus/dunstctl: add history command (#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 (#970)

* contrib: add notification-history.sh (#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
fwsmit pushed a commit to WhitePeter/dunst that referenced this issue Dec 6, 2021
…#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
@fwsmit
Copy link
Member

fwsmit commented Jan 16, 2022

I'm pleased to say that the history command has been added. This issue can be closed :)

@fwsmit fwsmit closed this as completed Jan 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants