From 2d486398d659252a2e720d0bc9c99373425836b7 Mon Sep 17 00:00:00 2001 From: rootiest Date: Sun, 24 Nov 2024 03:19:49 -0500 Subject: [PATCH] feat: add conditional rendering for dashboard sections based on Neovide --- lua/plugins/dashboard/snacks.lua | 107 ++++++++++++++++++++----------- 1 file changed, 68 insertions(+), 39 deletions(-) diff --git a/lua/plugins/dashboard/snacks.lua b/lua/plugins/dashboard/snacks.lua index 823e2a2..0ff97d1 100644 --- a/lua/plugins/dashboard/snacks.lua +++ b/lua/plugins/dashboard/snacks.lua @@ -31,45 +31,74 @@ return { keys = require('data.dash').dashboard_nvim.choices, header = read_file(require('data.dash').logo), }, - sections = { - -- { section = 'header' }, - { - section = 'terminal', - cmd = 'pokemon-colorscripts -n porygon-z --no-title', - padding = 0, - height = 20, - indent = 44, - }, - { section = 'keys', gap = 1, padding = 1 }, - { - pane = 2, - icon = ' ', - title = 'Recent Files', - section = 'recent_files', - indent = 2, - padding = { 2, 20 }, - }, - { - pane = 2, - icon = ' ', - title = 'Projects', - section = 'projects', - indent = 2, - padding = 2, - }, - { - pane = 2, - icon = ' ', - title = 'Git Status', - section = 'terminal', - enabled = require('data.func').is_git_repo(), - cmd = 'hub status --short --branch --renames', - padding = 2, - indent = 3, - ttl = 1 * 60, -- Time between git updates - }, - { section = 'startup' }, - }, + sections = function() + if not require('data.func').is_neovide() then + return { + -- { section = 'header' }, + { + section = 'terminal', + cmd = 'pokemon-colorscripts -n porygon-z --no-title', + padding = 0, + height = 20, + indent = 44, + }, + { section = 'keys', gap = 1, padding = 1 }, + { + pane = 2, + icon = ' ', + title = 'Recent Files', + section = 'recent_files', + indent = 2, + padding = { 2, 20 }, + }, + { + pane = 2, + icon = ' ', + title = 'Projects', + section = 'projects', + indent = 2, + padding = 2, + }, + { + pane = 2, + icon = ' ', + title = 'Git Status', + section = 'terminal', + enabled = require('data.func').is_git_repo(), + cmd = 'hub status --short --branch --renames', + padding = 2, + indent = 3, + ttl = 1 * 60, -- Time between git updates + }, + { section = 'startup' }, + } + else + return { + { + section = 'header', + indent = 40, + }, + { section = 'keys', gap = 1, padding = 1 }, + { + pane = 2, + icon = ' ', + title = 'Recent Files', + section = 'recent_files', + indent = 2, + padding = { 2, 20 }, + }, + { + pane = 2, + icon = ' ', + title = 'Projects', + section = 'projects', + indent = 2, + padding = 2, + }, + { section = 'startup' }, + } + end + end, }, }, },