From b93d6a4b2569cfb5731f97ff119d4d13bec36cda Mon Sep 17 00:00:00 2001 From: actionless Date: Wed, 2 Mar 2016 02:22:08 +0100 Subject: [PATCH] fix(lib: menubar): take in account common list padding --- lib/menubar/init.lua | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/menubar/init.lua b/lib/menubar/init.lua index cd1199a1b..02f1f8a92 100644 --- a/lib/menubar/init.lua +++ b/lib/menubar/init.lua @@ -61,7 +61,7 @@ menubar.geometry = { width = nil, y = nil } --- Width of blank space left in the right side. -menubar.right_margin = 50 +menubar.right_margin = theme.xresources.apply_dpi(8) --- Label used for "Next page", default "▶▶". menubar.right_label = "▶▶" @@ -69,6 +69,10 @@ menubar.right_label = "▶▶" --- Label used for "Previous page", default "◀◀". menubar.left_label = "◀◀" +-- awful.widget.common.list_update adds three times a margin of dpi(4) +-- for each item: +local list_interspace = theme.xresources.apply_dpi(4) * 3 + --- Allows user to specify custom parameters for prompt.run function -- (like colors). menubar.prompt_args = {} @@ -147,8 +151,8 @@ local function get_current_page(all_items, query, scr) local current_page = {} for i, item in ipairs(all_items) do item.width = item.width or - compute_text_width(" " .. item.name, scr) + - (item.icon and instance.geometry.height or 0) + compute_text_width(item.name, scr) + + (item.icon and instance.geometry.height or 0) + list_interspace if width_sum + item.width > available_space then if current_item < i then table.insert(current_page, { name = menubar.right_label, icon = nil })