You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd love to be able to vertically center my Alpha dashboard.
I followed the advice here and implemented dynamic padding in my Alpha opts:
-- The content_height calculation is based on my custom Alpha configlocalcontent_height=#opts.section.header.val+ (#opts.section.buttons.val*2-1) +3opts.opts.layout[1].val=vim.fn.floor((vim.fn.winheight(0) -content_height+2) /2)
The problem is this function is only run once when Neovim starts up. I often switch between my laptop and desktop, which means that Alpha is always going to be off on one of them.
I think there are a couple of solutions to this issue:
Allow the padding to be calculated dynamically. Rather than providing a value to opts.opts.layout[1].val, you could allow a function that returns the value to be passed. Then, Alpha could call this function on every render, which would achieve dynamic padding.
opts.opts.layout[1].val=function()
localcontent_height=#opts.section.header.val+ (#opts.section.buttons.val*2-1) +3returnvim.fn.floor((vim.fn.winheight(0) -content_height+2) /2)
end
Provide a setting for vertically centering content. To me, this would be better DX, and would avoid requiring the settings to understand and calculate the dashboard height.
Thank you!
The text was updated successfully, but these errors were encountered:
Hello 👋
I'd love to be able to vertically center my Alpha dashboard.
I followed the advice here and implemented dynamic padding in my Alpha opts:
The problem is this function is only run once when Neovim starts up. I often switch between my laptop and desktop, which means that Alpha is always going to be off on one of them.
I think there are a couple of solutions to this issue:
Allow the padding to be calculated dynamically. Rather than providing a value to
opts.opts.layout[1].val
, you could allow a function that returns the value to be passed. Then, Alpha could call this function on every render, which would achieve dynamic padding.Provide a setting for vertically centering content. To me, this would be better DX, and would avoid requiring the settings to understand and calculate the dashboard height.
Thank you!
The text was updated successfully, but these errors were encountered: