NvChad / ui

Lightweight & high performance UI plugin for nvchad
GNU General Public License v3.0
291 stars 133 forks source link

custom nvdash with white transparent rectangle #358

Closed DelinQu closed 1 month ago

DelinQu commented 1 month ago

Hi siduck,

Thanks so much for developing Nvchad UI! I just updated the Nvchad to the latest version, and found that the Nvdash alpha page changes a lot. So I want roll back to the previous alpha page. With some customization, I got the alpha page below, but I didn't find the API to recover white transparent rectangle and icon position. Could you provide some suggestions, it will help me a lot!

---@type ChadrcConfig local M = {}

M.base46 = { theme = "github_dark",

hl_override = { Comment = { italic = true }, ["@comment"] = { italic = true }, }, }

-- NOTE: custom config for nvchad M.nvdash = { load_on_startup = true, header = { " ▄ ▄ DL", " DL ▄ ▄▄▄ ▄ ▄▄▄ ▄ ▄ ", " █ ▄ █▄█ ▄▄▄ █ █▄█ █ █ ", " DL ▄▄ █▄█▄▄▄█ █▄█▄█▄▄█▄▄█ █ DL ", " ▄ █▄▄█ ▄ ▄▄ ▄█ ▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ", " █▄▄▄▄ ▄▄▄ █ ▄ ▄▄▄ ▄ ▄▄▄ ▄ ▄ █ ▄", "▄ █ █▄█ █▄█ █ █ █▄█ █ █▄█ ▄▄▄ █ █", "█▄█ ▄ █▄▄█▄▄█ █ ▄▄█ █ ▄ █ █▄█▄█ █", " █▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█ █▄█▄▄▄█ ", " ", },

buttons = { { txt = "🎄 Find File", keys = "Spc f f", cmd = "Telescope find_files" }, { txt = "📄 Recent Files", keys = "Spc f o", cmd = "Telescope oldfiles" }, { txt = "🦙 Find Word", keys = "Spc f w", cmd = "Telescope live_grep" }, -- { txt = "🏷️ Bookmarks", keys = "Spc m a", cmd = "Telescope marks" }, { txt = "🎨 Themes", keys = "Spc t h", cmd = "Telescope themes" }, { txt = "🧪 Mappings", keys = "Spc c h", cmd = "NvCheatsheet" },

{ txt = "─", hl = "NvDashLazy", no_gap = true, rep = true },
{
  txt = function()
    local stats = require("lazy").stats()
    local ms = math.floor(stats.startuptime) .. " ms"
    return "🚀 Loaded " .. stats.loaded .. "/" .. stats.count .. " plugins in " .. ms
  end,
  hl = "NvDashLazy",
  no_gap = true,
},
{ txt = "─", hl = "NvDashLazy", no_gap = true, rep = true },

}, }

M.term = { winopts = { winhl = "Normal:term,WinSeparator:WinSeparator" }, sizes = { sp = 0.4, vsp = 0.4, ["bo sp"] = 0.4, ["bo vsp"] = 0.4 }, float = { relative = "editor", row = 0.25, height = 0.5, col = 0.2, width = 0.6, border = "rounded", }, cmd = "neofetch", }

-- Dashboard: local headers = { { "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⢿⣿⣛⣛⣛⣛⣛⣛⣛⢿⠿⠟⡛⠛⣻⣿⣿⣿⣟⣛⡿⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⢉⣴⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣧⣬⣛⡿⢿⣿⣿⣿⣷⣶⣭⣛⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⡀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⣯⣝⡻⢿⣿⣿⣿⣷⣝⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⢌⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢿⣿⢿⣿⣿⣿⣿⣿⣿⣿⣷⣟⣬⣜⢛⣿⣿⣿⡷⡝⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⣾⠮⣿⣿⣿⣿⣿⣿⣿⣿⡿⠏⠛⠋⠉⠉⠉⠉⠛⠯⣿⣿⢿⣿⣿⣿⣿⣿⣷⣧⡰⠟⢾⢻⣞⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣇⠣⢟⡿⡛⣧⡽⡿⣿⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⣼⣿⠀⠉⠛⢛⣰⣿⢿⣿⣾⣿⣿⣦⣡⣸⠹⠞⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡈⠢⣯⠊⠝⠿⠃⠁⠀⠀⠀⠀⡀⠀⠀⠀⠀⢰⣿⣿⠀⠀⠀⠀⠉⠻⡿⣿⣯⣯⣿⣿⣿⣦⣼⢰⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣯⠘⡢⠈⣗⠢⠀⠀⠀⠀⠀⠀⣠⠃⠀⢠⢁⣿⣿⣿⡞⡀⠀⠀⠀⠀⠈⠛⣿⣿⣿⣿⣿⣿⣿⣮⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣈⠀⠂⠀⠀⠀⠀⠀⣐⡰⣄⠀⠀⣸⣼⣿⣿⣟⡓⠁⠀⡀⠀⠀⠀⠀⠈⠫⣿⣿⣿⣿⣿⣿⣯⣻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⡀⠀⠀⠀⠀⢁⠤⠌⢻⣴⢀⣿⣿⠿⠉⠁⠋⢷⡀⠁⠀⠀⡀⠀⠀⠀⠐⣿⣿⣿⣿⣿⣿⣷⣹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⠀⠀⠀⣀⡏⡀⠀⣾⣿⡀⣹⣿⣧⡾⠛⠒⢄⠱⠀⠀⠀⠀⠀⠁⠀⡀⢺⣻⣿⣿⣿⣿⣿⣧⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⠀⠟⠳⢷⢾⣿⣿⣿⡾⠿⣿⡇⡄⠀⣸⣧⠆⠀⠀⠀⠃⠀⠀⠃⠀⢿⣽⣻⣻⣿⣿⣿⡎⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⢠⣿⣿⣿⣹⣿⣿⣿⣷⣶⣿⣿⣶⣾⣿⣿⠆⠀⠀⠀⠀⢠⢄⢀⠀⠓⢾⣿⣻⣿⣿⣿⡇⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⠈⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢰⠀⡀⢀⡀⠈⠘⠀⠀⢨⣥⢭⣗⢟⢿⣿⢃⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⡁⠀⠀⠸⣿⣿⠘⠋⠩⠟⢿⣿⣿⣿⣿⣿⣿⣟⠏⠀⠀⠈⠀⠀⠀⠀⠀⠀⠀⠆⣖⣛⢻⢋⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⡆⠀⠀⠹⣿⣗⣠⣤⣤⣾⣿⣿⣿⣿⣿⣿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢂⠒⢅⣵⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⢡⠀⠀⠀⠹⣿⣿⣿⣿⣿⣿⡿⠿⠟⠋⢁⡠⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣯⢰⠀⠀⠀⠀⠀⠈⠀⠀⠀⠀⠀⣀⣴⣿⡏⠠⣆⠀⠀⠀⠀⡀⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠸⠀⢀⣀⣤⣴⣶⣆⠀⢀⣴⣿⣿⣿⣿⣁⣰⣿⡄⠂⠀⠀⠀⠀⠀⢘⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡌⢠⣿⣿⣿⣿⣿⡟⢀⠻⣿⣿⣿⣿⢷⢤⣿⣿⣿⣶⡄⠀⠀⠀⠀⠠⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⣾⣿⣿⣿⢶⣿⠁⢾⣧⡹⣿⣿⣿⣿⡿⣿⣿⣿⣏⣤⣾⣮⣦⣄⠀⠘⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⣿⣿⣿⡏⣾⡏⠘⣺⡿⢿⠿⡿⣻⣷⣿⣿⣿⣿⣿⣿⣿⣷⡿⣿⣷⣄⠙⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣇⣿⣿⣏⠁⣿⣿⡌⠽⣷⡾⢛⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣾⢿⣿⣦⠽⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢹⣿⣿⡝⠀⢹⣿⣿⣶⣾⣟⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⡻⢿⣧⡹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", " ", }, }

local random_header = function() math.randomseed(os.time()) local i = math.random(#headers) return headers[i] end M.nvdash.header = random_header()

return M

siduck commented 1 month ago

nvchad doesnt use alpha nvim

siduck commented 1 month ago

and the dashbaord wont center if nvimtree gets opened, if you open it after nvimtree then it will look centered

DelinQu commented 1 month ago

and the dashbaord wont center if nvimtree gets opened, if you open it after nvimtree then it will look centered

Thanks for your reply. I want the dashboard to be vertically centered. The dashboard seems to be shifted up too much.

siduck commented 1 month ago

years ago i was unable to fix this issue , let me try agai n

DelinQu commented 1 month ago

years ago i was unable to fix this issue , let me try agai n

Appreciate it! 🙏

DelinQu commented 1 month ago

years ago i was unable to fix this issue , let me try agai n

image

I finally found that the nvim_win_set_cursor API causes the shift 🧐

https://github.com/NvChad/ui/blob/2be2b1983b5cda5b360faeff67ffe409fa668996/lua/nvchad/nvdash/init.lua#L126

siduck commented 1 month ago

you sure? nvdash isnt redrawn when nvimtree opens btw

DelinQu commented 1 month ago

This is quite strange. The btn_start_i line doesn't go beyond the screen, so it shouldn't cause the screen to scroll. However, after I commented it out, everything works fine, and the dashboard is perfectly centered.

siduck commented 1 month ago

weird, i tried your header, it was centered by default

image

the nvdash willshift if you open a new window, cuz its not redrawn whenever win width is resized

DelinQu commented 1 month ago

What is the terminal? it supports image display perfectly.

siduck commented 1 month ago

my custom build of st terminal. It just has the boxdraw patch https://st.suckless.org/patches/boxdraw/

your terminal would have the feature too probably, so the braillie characters are turned into boxes i think

DelinQu commented 1 month ago

Brilliantly cool, both you and ur terminal 🙆‍♂️