Skip to content
Open
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions src/controlCenter/controlCenter.vala
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ namespace SwayNotificationCenter {
HashTable<string, unowned NotificationGroup> noti_groups_name =
new HashTable<string, unowned NotificationGroup> (str_hash, str_equal);

struct HistoryEntry {
public Notification noti;
public string group_id;
}
Queue<HistoryEntry?> notification_history = new Queue<HistoryEntry?> ();

const string STACK_NOTIFICATIONS_PAGE = "notifications-list";
const string STACK_PLACEHOLDER_PAGE = "notifications-placeholder";

Expand Down Expand Up @@ -263,6 +269,22 @@ namespace SwayNotificationCenter {
var children = list_box_controller.get_children ();
var group = (NotificationGroup) list_box.get_focus_child ();
switch (Gdk.keyval_name (keyval)) {
case "z":
if (state == Gdk.ModifierType.CONTROL_MASK) {
while (notification_history.length > 0) {
var first_in_history = notification_history.pop_head ();
add_notification (first_in_history.noti.param);
if (notification_history.length /* still */ > 0) {
var next_in_history = notification_history.peek_head ();
if (first_in_history.group_id == next_in_history.group_id) {
continue;
} else {
break;
}
}
}
}
break;
case "Return":
if (group != null) {
var noti = group.get_latest_notification ();
Expand Down Expand Up @@ -651,6 +673,11 @@ namespace SwayNotificationCenter {
if (dismiss) {
noti.close_notification (false);
}

notification_history.push_head (HistoryEntry () {
noti = noti,
group_id = group.name_id
});
group.remove_notification (noti);
noti_groups_id.remove (id);
break;
Expand Down