Commit cfc45406 authored by Erik Reider's avatar Erik Reider

Fixed keyboard shortcuts sometimes not working

Would fail if clearing all notifications with `C` which would hide the window. When later opening the Control Center, shortcuts wouldn't work until manually focused. Might be a Sway bug, but this fixes it on my end.
parent 90c8bd85
......@@ -366,20 +366,6 @@ namespace SwayNotificationCenter {
ConfigModel.instance.control_center_height);
}
private void on_visibility_change () {
// Updates all widgets on visibility change
foreach (var widget in widgets) {
widget.on_cc_visibility_change (visible);
}
if (this.visible) {
add_css_class ("open");
} else {
remove_css_class ("open");
}
swaync_daemon.emit_subscribe ();
}
public bool toggle_visibility () {
var cc_visibility = !this.visible;
set_visibility (cc_visibility);
......@@ -390,13 +376,24 @@ namespace SwayNotificationCenter {
if (this.visible == visibility) {
return;
}
if (visibility) {
// Destroy the wl_surface to get a new "enter-monitor" signal
// Destroy the wl_surface to get a new "enter-monitor" signal and
// fixes issues where keyboard shortcuts stop working after clearing
// all notifications.
((Gtk.Widget) this).unrealize ();
}
this.set_visible (visibility);
on_visibility_change ();
// Updates all widgets on visibility change
foreach (var widget in widgets) {
widget.on_cc_visibility_change (visible);
}
if (this.visible) {
add_css_class ("open");
} else {
remove_css_class ("open");
}
swaync_daemon.emit_subscribe ();
}
public inline bool get_visibility () {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment