From 3380fd85fccc5279f4adbbd0c02806e797eff8f8 Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee Date: Fri, 21 Dec 2018 21:29:56 -0500 Subject: [PATCH] tooltip: Add alignment options. It's a list of preferred alignments because sometime the best one wont fit in the screen. --- lib/awful/tooltip.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/awful/tooltip.lua b/lib/awful/tooltip.lua index 39aa0910..df0a35db 100644 --- a/lib/awful/tooltip.lua +++ b/lib/awful/tooltip.lua @@ -124,6 +124,7 @@ local function apply_outside_mode(self) local _, position = a_placement.next_to(w, { geometry = self._private.widget_geometry, preferred_positions = self.preferred_positions, + preferred_anchors = self.preferred_alignments, honor_workarea = true, }) @@ -326,6 +327,18 @@ function tooltip:set_preferred_positions(value) set_geometry(self) end + +function tooltip:get_preferred_alignments() + return self._private.preferred_alignments or + {"front", "back", "middle"} +end + +function tooltip:set_preferred_alignments(value) + self._private.preferred_alignments = value + + set_geometry(self) +end + --- Change displayed text. -- -- @property text