diff --git a/src/Launcher.vala b/src/Launcher.vala index 4d0edd24..4de5f8c2 100644 --- a/src/Launcher.vala +++ b/src/Launcher.vala @@ -43,6 +43,7 @@ public class Dock.Launcher : Gtk.Button { private Adw.TimedAnimation timed_animation; private Gtk.PopoverMenu popover; + private PopoverTooltip tooltip; public Launcher (GLib.DesktopAppInfo app_info, bool pinned) { Object (app_info: app_info, pinned: pinned); @@ -83,6 +84,16 @@ public class Dock.Launcher : Gtk.Button { }; popover.set_parent (this); + tooltip = new PopoverTooltip () { + can_focus = false, + can_target = false, + focusable = false, + child = new Gtk.Label (app_info.get_display_name ()), + has_arrow = false, + position = TOP + }; + tooltip.set_parent (this); + image = new Gtk.Image () { gicon = app_info.get_icon () }; @@ -122,7 +133,6 @@ public class Dock.Launcher : Gtk.Button { box.append (overlay); child = box; - tooltip_text = app_info.get_display_name (); var launcher_manager = LauncherManager.get_default (); @@ -180,6 +190,14 @@ public class Dock.Launcher : Gtk.Button { add_controller (gesture_click); gesture_click.released.connect (popover.popup); + var motion_controller = new Gtk.EventControllerMotion (); + motion_controller.enter.connect (tooltip.popup); + motion_controller.leave.connect (() => { + tooltip.popdown (); + }); + + add_controller (motion_controller); + clicked.connect (() => launch ()); settings.bind ("icon-size", image, "pixel-size", DEFAULT); @@ -223,6 +241,8 @@ public class Dock.Launcher : Gtk.Button { ~Launcher () { popover.unparent (); popover.dispose (); + tooltip.unparent (); + tooltip.dispose (); } public void launch (string? action = null) { @@ -388,4 +408,10 @@ public class Dock.Launcher : Gtk.Button { progress_visible = false; progress = 0; } + + private class PopoverTooltip : Gtk.Popover { + class construct { + set_css_name ("tooltip"); + } + } }