diff options
Diffstat (limited to '.config/awesome/ui/insightful/init.lua')
-rw-r--r-- | .config/awesome/ui/insightful/init.lua | 80 |
1 files changed, 42 insertions, 38 deletions
diff --git a/.config/awesome/ui/insightful/init.lua b/.config/awesome/ui/insightful/init.lua index e8a4a4d..3dcbbea 100644 --- a/.config/awesome/ui/insightful/init.lua +++ b/.config/awesome/ui/insightful/init.lua @@ -64,7 +64,7 @@ insightful._keymap = { XF86AudioStop = "⏹", [tostring(btn.LEFT)] = mouse .. "Left", [tostring(btn.MIDDLE)] = mouse .. "Middle", - [tostring(btn.RIGHT)] = mouse .. "Right" + [tostring(btn.RIGHT)] = mouse .. "Right", } insightful._widget = qui.popup { @@ -73,17 +73,17 @@ insightful._widget = qui.popup { placement = function(d) awful.placement.top(d, { margins = { - top = beautiful.useless_gap * 2 - } + top = beautiful.useless_gap * 2, + }, }) end, - minimum_height = screen[1].geometry.height / 2, - minimum_width = screen[1].geometry.width / 2, + minimum_height = awful.screen.focused().geometry.height / 2, + minimum_width = awful.screen.focused().geometry.width / 2, widget = { layout = wibox.layout.fixed.vertical, spacing = qvars.big_padding, - id = "layout_container" - } + id = "layout_container", + }, } function insightful:_generate() @@ -98,55 +98,59 @@ function insightful:_generate() grouped_binds[group] = {} end - table.insert(grouped_binds[group], { + table.insert(grouped_binds[group], { mods = keybind.mods, triggers = keybind.triggers, - desc = keybind.desc + desc = keybind.desc, }) end for group, keybinds in qtable.opairs(grouped_binds) do local group_layout = { spacing = qvars.padding, - layout = wibox.layout.fixed.vertical + layout = wibox.layout.fixed.vertical, } for _, keybind in ipairs(keybinds) do local key_layout = { - layout = wibox.layout.fixed.horizontal + layout = wibox.layout.fixed.horizontal, } local key_and_desc_layout = { nil, -- key nil, nil, -- description? - layout = wibox.layout.align.horizontal + layout = wibox.layout.align.horizontal, } - + for _, mod in ipairs(keybind.mods) do - table.insert(key_layout, 1, qui.styled { - widget = wibox.container.background, - bg = qvars.colors.bright.black, - border_width = 0, - { - widget = wibox.container.margin, - margins = qvars.padding, + table.insert( + key_layout, + 1, + qui.styled { + widget = wibox.container.background, + bg = qvars.colors.bright.black, + border_width = 0, { - widget = wibox.widget.textbox, - text = insightful._keymap[mod] or mod - } + widget = wibox.container.margin, + margins = qvars.padding, + { + widget = wibox.widget.textbox, + text = insightful._keymap[mod] or mod, + }, + }, } - }) + ) table.insert(key_layout, 2, { widget = wibox.widget.textbox, - text = " + " + text = " + ", }) end if type(keybind.triggers) == "string" or type(keybind.triggers) == "number" then table.insert(key_layout, { widget = wibox.widget.textbox, - text = insightful._keymap[tostring(keybind.triggers)] or keybind.triggers + text = insightful._keymap[tostring(keybind.triggers)] or keybind.triggers, }) elseif type(keybind.triggers) == "table" then local display_trigger = {} @@ -155,7 +159,7 @@ function insightful:_generate() end table.insert(key_layout, { widget = wibox.widget.textbox, - text = table.concat(display_trigger, "/") + text = table.concat(display_trigger, "/"), }) end @@ -165,16 +169,16 @@ function insightful:_generate() fg = qvars.colors.dim.fg, { widget = wibox.widget.textbox, - text = keybind.desc - } + text = keybind.desc, + }, } end key_and_desc_layout[1] = key_layout table.insert(group_layout, key_and_desc_layout) - end - + end + layout_container:add { { { @@ -187,16 +191,16 @@ function insightful:_generate() margins = qvars.padding, { widget = wibox.widget.textbox, - text = group - } - } + text = group, + }, + }, }, nil, - layout = wibox.layout.align.horizontal + layout = wibox.layout.align.horizontal, }, group_layout, spacing = qvars.padding, - layout = wibox.layout.fixed.vertical + layout = wibox.layout.fixed.vertical, } end end @@ -213,11 +217,11 @@ local timed = rubato.timed { else insightful._widget.visible = true end - end + end, } function insightful:toggle() - if first_time then + if first_time then insightful:_generate() first_time = false end |