Skip to content

Commit cfc4540

Browse files
committed
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.
1 parent 90c8bd8 commit cfc4540

File tree

1 file changed

+16
-19
lines changed

1 file changed

+16
-19
lines changed

src/controlCenter/controlCenter.vala

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -366,20 +366,6 @@ namespace SwayNotificationCenter {
366366
ConfigModel.instance.control_center_height);
367367
}
368368

369-
private void on_visibility_change () {
370-
// Updates all widgets on visibility change
371-
foreach (var widget in widgets) {
372-
widget.on_cc_visibility_change (visible);
373-
}
374-
375-
if (this.visible) {
376-
add_css_class ("open");
377-
} else {
378-
remove_css_class ("open");
379-
}
380-
swaync_daemon.emit_subscribe ();
381-
}
382-
383369
public bool toggle_visibility () {
384370
var cc_visibility = !this.visible;
385371
set_visibility (cc_visibility);
@@ -390,13 +376,24 @@ namespace SwayNotificationCenter {
390376
if (this.visible == visibility) {
391377
return;
392378
}
393-
if (visibility) {
394-
// Destroy the wl_surface to get a new "enter-monitor" signal
395-
((Gtk.Widget) this).unrealize ();
396-
}
379+
// Destroy the wl_surface to get a new "enter-monitor" signal and
380+
// fixes issues where keyboard shortcuts stop working after clearing
381+
// all notifications.
382+
((Gtk.Widget) this).unrealize ();
383+
397384
this.set_visible (visibility);
398385

399-
on_visibility_change ();
386+
// Updates all widgets on visibility change
387+
foreach (var widget in widgets) {
388+
widget.on_cc_visibility_change (visible);
389+
}
390+
391+
if (this.visible) {
392+
add_css_class ("open");
393+
} else {
394+
remove_css_class ("open");
395+
}
396+
swaync_daemon.emit_subscribe ();
400397
}
401398

402399
public inline bool get_visibility () {

0 commit comments

Comments
 (0)