This commit is contained in:
Erik Reider 2022-02-21 00:28:54 +01:00
parent 0ed0361291
commit 4d71fdf316

View File

@ -37,16 +37,27 @@ namespace SwayNotificationCenter {
viewport.size_allocate.connect (size_alloc);
// Only use release for closing notifications due to Escape key
// sometimes being passed through to unfucused application
// Ex: Firefox in a fullscreen YouTube video
this.key_release_event.connect ((w, event_key) => {
if (event_key.type == Gdk.EventType.KEY_RELEASE) {
var children = list_box.get_children ();
Notification noti = (Notification)
list_box.get_focus_child ();
switch (Gdk.keyval_name (event_key.keyval)) {
case "Escape":
case "Caps_Lock":
this.set_visibility (false);
return true;
}
}
return true;
});
this.key_press_event.connect ((w, event_key) => {
if (event_key.type == Gdk.EventType.KEY_PRESS) {
var children = list_box.get_children ();
Notification noti = (Notification)
list_box.get_focus_child ();
switch (Gdk.keyval_name (event_key.keyval)) {
case "Return":
if (noti != null) noti.click_default_action ();
break;