fix(lib: menubar): take in account common list padding
This commit is contained in:
parent
68bde9d584
commit
b93d6a4b25
|
@ -61,7 +61,7 @@ menubar.geometry = { width = nil,
|
||||||
y = nil }
|
y = nil }
|
||||||
|
|
||||||
--- Width of blank space left in the right side.
|
--- 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 "▶▶".
|
--- Label used for "Next page", default "▶▶".
|
||||||
menubar.right_label = "▶▶"
|
menubar.right_label = "▶▶"
|
||||||
|
@ -69,6 +69,10 @@ menubar.right_label = "▶▶"
|
||||||
--- Label used for "Previous page", default "◀◀".
|
--- Label used for "Previous page", default "◀◀".
|
||||||
menubar.left_label = "◀◀"
|
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
|
--- Allows user to specify custom parameters for prompt.run function
|
||||||
-- (like colors).
|
-- (like colors).
|
||||||
menubar.prompt_args = {}
|
menubar.prompt_args = {}
|
||||||
|
@ -147,8 +151,8 @@ local function get_current_page(all_items, query, scr)
|
||||||
local current_page = {}
|
local current_page = {}
|
||||||
for i, item in ipairs(all_items) do
|
for i, item in ipairs(all_items) do
|
||||||
item.width = item.width or
|
item.width = item.width or
|
||||||
compute_text_width(" " .. item.name, scr) +
|
compute_text_width(item.name, scr) +
|
||||||
(item.icon and instance.geometry.height or 0)
|
(item.icon and instance.geometry.height or 0) + list_interspace
|
||||||
if width_sum + item.width > available_space then
|
if width_sum + item.width > available_space then
|
||||||
if current_item < i then
|
if current_item < i then
|
||||||
table.insert(current_page, { name = menubar.right_label, icon = nil })
|
table.insert(current_page, { name = menubar.right_label, icon = nil })
|
||||||
|
|
Loading…
Reference in New Issue