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

Command to remove a notification from history #308

Closed
ohque opened this issue Mar 5, 2017 · 5 comments
Closed

Command to remove a notification from history #308

ohque opened this issue Mar 5, 2017 · 5 comments
Labels

Comments

@ohque
Copy link

ohque commented Mar 5, 2017

While it is useful to browse through past notifications, there are some that you want to remove from the stack completely after reading them. As far as I know there is no way to manage the history stack at the moment.
I'm aware of the history_ignore option, however that makes notifications bypass history completely. Whereas the feature I'm requesting here makes it possible to use the history stack somewhat like an inbox where you can delete notifications you have already read and don't want to see anymore.

I think this feature would be useful in two forms:

  • configuration of mouse click commands in dunstrc (e.g. the user maps middle mouse button to the "remove from history" command, this applies to clicking notifications currently displayed on screen)
  • command line interface (users can then map it to keys on their own or use it in scripts):
    • dunstcli rm to remove currently focused notification (similar to the existing "close" command)
    • dunstcli rm <notification-id> to remove a specific notification by ID
@ohque
Copy link
Author

ohque commented Mar 5, 2017

Here's a patch that implements removing displayed notifications from history with middle-mouse-click:

https://gist.github.com/ohque/19df172fb9b7109732daffc1809eb672

It works for me without any noticeable issues, but this is just a quick "proof of concept". Ideally mouse button mappings would be configurable in dunstrc, so that close, close_all, and remove commands could be assigned to whichever mouse buttons the user wants.

@tsipinakis
Copy link
Member

A bit of feedback about that patch, the close reason is defined in the notification spec. The value 4 is defined as undefined/reserved reasons while in this case it should be a 2. Not using the correct close value can confuse programs that do any further processing on notifications. (i.e. mark messages read if the notification was dismissed by a user for example).

@ohque
Copy link
Author

ohque commented Mar 13, 2017

How about using reason = -2 and a local bool remove variable, reassigning reason back to 2 at the start of the function:

https://gist.github.com/ohque/a6d681b9329b6d9b23753c72ae4f5020

Or you could add a remove flag to notification_close_by_id and notification_close:

https://gist.github.com/ohque/72f73b9c7ef9034f1c0b06d0502d6608

@tsipinakis
Copy link
Member

If notification_closed is called with a reason of 2 then it's fine for a simple personal hack to get this to work but this wouldn't be how I'd implement it if it was to be merged to master.

I'll look into all the open feature request issues once the next minor version is released and see what can be done about them.

@bynect
Copy link
Member

bynect commented Apr 29, 2024

now there is dunstctl history-rm

@bynect bynect closed this as completed Apr 29, 2024
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

3 participants