@@ -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,25 @@ public class Dock.Launcher : BaseItem {
176177 };
177178 bounce_up. done. connect (bounce_down. play);
178179
180+ shake = new Adw .TimedAnimation (
181+ this ,
182+ 0 ,
183+ 0 ,
184+ 70 ,
185+ new Adw .CallbackAnimationTarget ((val) = > {
186+ var height = overlay. get_height ();
187+ var width = overlay. get_width ();
188+
189+ overlay. allocate (
190+ width, height, - 1 ,
191+ new Gsk .Transform (). translate (Graphene . Point () { x = (int ) val })
192+ );
193+ })
194+ ) {
195+ easing = EASE_OUT_CIRC ,
196+ reverse = true
197+ };
198+
179199 gesture_click. button = 0 ;
180200 gesture_click. released. connect (on_click_released);
181201
@@ -242,6 +262,7 @@ public class Dock.Launcher : BaseItem {
242262 base . cleanup ();
243263 bounce_down = null ;
244264 bounce_up = null ;
265+ shake = null ;
245266 current_count_binding. unbind ();
246267 remove_dnd_cycle ();
247268 }
@@ -259,6 +280,7 @@ public class Dock.Launcher : BaseItem {
259280 if (app. launch_new_instance (context)) {
260281 animate_launch ();
261282 } else {
283+ animate_shake ();
262284 event_display. beep ();
263285 }
264286 break ;
@@ -280,6 +302,28 @@ public class Dock.Launcher : BaseItem {
280302 bounce_up. play ();
281303 }
282304
305+ private void animate_shake () {
306+ if (shake. state == PLAYING ) {
307+ return ;
308+ }
309+
310+ shake. value_to = - 0.1 * overlay. get_width ();
311+ shake. play ();
312+
313+ int repeat_count = 0 ;
314+ ulong iterate = 0 ;
315+ iterate = shake. done. connect (() = > {
316+ if (repeat_count == 4 ) {
317+ disconnect (iterate);
318+ return ;
319+ }
320+
321+ shake. value_to * = - 1 ;
322+ shake. play ();
323+ repeat_count++ ;
324+ });
325+ }
326+
283327 protected override bool drag_cancelled (Gdk .Drag drag , Gdk .DragCancelReason reason ) {
284328 if (app. pinned && reason == NO_TARGET ) {
285329 var popover = new PoofPopover ();
0 commit comments