@@ -36,6 +36,7 @@ public class Dock.Launcher : BaseItem {
3636 private Gtk . Revealer badge_revealer;
3737 private Adw . TimedAnimation bounce_up;
3838 private Adw . TimedAnimation bounce_down;
39+ private Adw . TimedAnimation shake;
3940 private Gtk . PopoverMenu popover_menu;
4041 private Gtk . Popover popover_tooltip;
4142
@@ -176,6 +177,27 @@ public class Dock.Launcher : BaseItem {
176177 };
177178 bounce_up. done. connect (bounce_down. play);
178179
180+ var shake_animation_target = new Adw .CallbackAnimationTarget ((val) = > {
181+ var height = overlay. get_height ();
182+ var width = overlay. get_width ();
183+
184+ overlay. allocate (
185+ width, height, - 1 ,
186+ new Gsk .Transform (). translate (Graphene . Point () { x = (int ) val })
187+ );
188+ });
189+
190+ shake = new Adw .TimedAnimation (
191+ this ,
192+ 0 ,
193+ 0 ,
194+ 70 ,
195+ shake_animation_target
196+ ) {
197+ easing = EASE_OUT_CIRC ,
198+ reverse = true
199+ };
200+
179201 gesture_click. button = 0 ;
180202 gesture_click. released. connect (on_click_released);
181203
@@ -259,6 +281,7 @@ public class Dock.Launcher : BaseItem {
259281 if (app. launch_new_instance (context)) {
260282 animate_launch ();
261283 } else {
284+ animate_shake ();
262285 event_display. beep ();
263286 }
264287 break ;
@@ -280,6 +303,28 @@ public class Dock.Launcher : BaseItem {
280303 bounce_up. play ();
281304 }
282305
306+ private void animate_shake () {
307+ if (shake. state == PLAYING ) {
308+ return ;
309+ }
310+
311+ shake. value_to = - 0.1 * overlay. get_width ();
312+ shake. play ();
313+
314+ int repeat_count = 0 ;
315+ ulong iterate = 0 ;
316+ iterate = shake. done. connect (() = > {
317+ if (repeat_count == 4 ) {
318+ disconnect (iterate);
319+ return ;
320+ }
321+
322+ shake. value_to = - 1 * shake. value_to;
323+ shake. play ();
324+ repeat_count++ ;
325+ });
326+ }
327+
283328 protected override bool drag_cancelled (Gdk .Drag drag , Gdk .DragCancelReason reason ) {
284329 if (app. pinned && reason == NO_TARGET ) {
285330 var popover = new PoofPopover ();
0 commit comments