hover pauses notification
This commit is contained in:
@@ -12,19 +12,6 @@
|
||||
NotificationWindow::NotificationWindow(uint64_t notificationId, std::shared_ptr<Gdk::Monitor> monitor, NotifyMessage notify) : BaseNotification(notificationId, monitor) {
|
||||
set_title(notify.summary);
|
||||
|
||||
auto window_click = Gtk::GestureClick::create();
|
||||
window_click->set_button(GDK_BUTTON_PRIMARY);
|
||||
window_click->set_exclusive(false);
|
||||
window_click->signal_released().connect([this](int, double x, double y) {
|
||||
Gtk::Widget *picked = this->pick(x, y, Gtk::PickFlags::DEFAULT);
|
||||
for (auto *w = picked; w != nullptr; w = w->get_parent()) {
|
||||
if (dynamic_cast<Gtk::Button *>(w) != nullptr) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
this->signal_close.emit(this->notificationId);
|
||||
});
|
||||
add_controller(window_click);
|
||||
|
||||
// Main vertical box
|
||||
auto vbox = Gtk::make_managed<Gtk::Box>(Gtk::Orientation::VERTICAL, 8);
|
||||
@@ -88,6 +75,19 @@ NotificationWindow::NotificationWindow(uint64_t notificationId, std::shared_ptr<
|
||||
btn->set_label(action_label);
|
||||
|
||||
btn->add_css_class("notification-button");
|
||||
|
||||
switch (notify.urgency) {
|
||||
case NotificationUrgency::CRITICAL:
|
||||
btn->add_css_class("notification-critical");
|
||||
break;
|
||||
case NotificationUrgency::NORMAL:
|
||||
btn->add_css_class("notification-normal");
|
||||
break;
|
||||
case NotificationUrgency::LOW:
|
||||
btn->add_css_class("notification-low");
|
||||
break;
|
||||
}
|
||||
|
||||
btn->signal_clicked().connect([this, action_id, cb = notify.on_action]() {
|
||||
if (cb) {
|
||||
cb(action_id);
|
||||
|
||||
Reference in New Issue
Block a user