Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions src/AppSystem/Launcher.vala
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public class Dock.Launcher : BaseItem {
private Gtk.Revealer badge_revealer;
private Adw.TimedAnimation bounce_up;
private Adw.TimedAnimation bounce_down;
private Adw.TimedAnimation shake;
private Gtk.PopoverMenu popover_menu;
private Gtk.Popover popover_tooltip;

Expand Down Expand Up @@ -176,6 +177,25 @@ public class Dock.Launcher : BaseItem {
};
bounce_up.done.connect (bounce_down.play);

shake = new Adw.TimedAnimation (
this,
0,
0,
70,
new Adw.CallbackAnimationTarget ((val) => {
var height = overlay.get_height ();
var width = overlay.get_width ();

overlay.allocate (
width, height, -1,
new Gsk.Transform ().translate (Graphene.Point () { x = (int) val })
);
})
) {
easing = EASE_OUT_CIRC,
reverse = true
};

gesture_click.button = 0;
gesture_click.released.connect (on_click_released);

Expand Down Expand Up @@ -242,6 +262,7 @@ public class Dock.Launcher : BaseItem {
base.cleanup ();
bounce_down = null;
bounce_up = null;
shake = null;
current_count_binding.unbind ();
remove_dnd_cycle ();
}
Expand All @@ -259,6 +280,7 @@ public class Dock.Launcher : BaseItem {
if (app.launch_new_instance (context)) {
animate_launch ();
} else {
animate_shake ();
event_display.beep ();
}
break;
Expand All @@ -280,6 +302,28 @@ public class Dock.Launcher : BaseItem {
bounce_up.play ();
}

private void animate_shake () {
if (shake.state == PLAYING) {
return;
}

shake.value_to = -0.1 * overlay.get_width ();
shake.play ();

int repeat_count = 0;
ulong iterate = 0;
iterate = shake.done.connect (() => {
if (repeat_count == 4) {
disconnect (iterate);
return;
}

shake.value_to *= -1;
shake.play ();
repeat_count++;
});
}

protected override bool drag_cancelled (Gdk.Drag drag, Gdk.DragCancelReason reason) {
if (app.pinned && reason == NO_TARGET) {
var popover = new PoofPopover ();
Expand Down