Skip to content

Commit

Permalink
Added right click to close notification (#110)
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikReider committed Apr 5, 2022
1 parent 188bef8 commit 364038e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ To reload css after changes
- Shift+C: Close all notifications
- Shift+D: Toggle Do Not Disturb
- Buttons 1-9: Execute alternative actions
- Left click button / actions: Activate notification action
- Right click notification: Close notification

## Configuring

Expand Down
4 changes: 4 additions & 0 deletions man/swaync.1.scd
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ swaync - A simple notification daemon with a GTK gui for notifications and the c

*Buttons 1-9*: Execute alternative actions

*Left click button / actions*: Activate notification action

*Right click notification*: Close notification

# CONFIGURATION

The main config file is located in */etc/xdg/swaync/config.json*. Copy it over
Expand Down
7 changes: 7 additions & 0 deletions src/notification/notification.vala
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,13 @@ namespace SwayNotificationCenter {

this.summary.set_text (param.summary ?? param.app_name);

this.button_press_event.connect ((event) => {
if (event.button != Gdk.BUTTON_SECONDARY) return false;
// Right click
this.close_notification ();
return true;
});

default_button.clicked.connect (click_default_action);

close_revealer.set_transition_duration (this.transition_time);
Expand Down

0 comments on commit 364038e

Please sign in to comment.