Skip to content

Commit be0ad2e

Browse files
committed
Fix bell spam
1 parent 4400c72 commit be0ad2e

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/Widgets/WindowSwitcher/WindowSwitcher.vala

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ public class Gala.WindowSwitcher : CanvasActor, GestureTarget {
4949
}
5050
}
5151

52+
private double previous_progress = 0d;
53+
5254
private float scaling_factor = 1.0f;
5355

5456
public WindowSwitcher (WindowManager wm) {
@@ -230,7 +232,11 @@ public class Gala.WindowSwitcher : CanvasActor, GestureTarget {
230232
return;
231233
}
232234

233-
if (container.get_n_children () == 1 && current_icon != null) {
235+
var is_step = ((int) (previous_progress / GESTURE_STEP) - (int) (progress / GESTURE_STEP)).abs () >= 1;
236+
237+
previous_progress = progress;
238+
239+
if (container.get_n_children () == 1 && current_icon != null && is_step) {
234240
InternalUtils.bell_notify (wm.get_display ());
235241
return;
236242
}
@@ -241,7 +247,10 @@ public class Gala.WindowSwitcher : CanvasActor, GestureTarget {
241247
current_index = container.get_n_children () + current_index;
242248
}
243249

244-
current_icon = (WindowSwitcherIcon) container.get_child_at_index (current_index);
250+
var new_icon = (WindowSwitcherIcon) container.get_child_at_index (current_index);
251+
if (new_icon != current_icon) {
252+
current_icon = new_icon;
253+
}
245254
}
246255

247256
private void select_icon (WindowSwitcherIcon? icon) {

0 commit comments

Comments
 (0)