✨ Feat(dashboard): add option and dynamic visibility for github contribs on dash
This commit is contained in:
@@ -35,6 +35,8 @@ vim.g.usetinyinline = true ---@type boolean Options: <true|
|
|||||||
|
|
||||||
-- Github username for dashboard and other customizations
|
-- Github username for dashboard and other customizations
|
||||||
vim.g.gitname = 'rootiest' ---@type string Options: <github username>
|
vim.g.gitname = 'rootiest' ---@type string Options: <github username>
|
||||||
|
-- Show GitHub Contributions on dashboard
|
||||||
|
vim.g.show_github_contrib = true ---@type boolean Options: <true|false>
|
||||||
-- Highlight lines with git changes
|
-- Highlight lines with git changes
|
||||||
vim.g.git_line_hl = false ---@type boolean Options: <true|false>
|
vim.g.git_line_hl = false ---@type boolean Options: <true|false>
|
||||||
-- Highlight words with git changes
|
-- Highlight words with git changes
|
||||||
|
|||||||
@@ -4,6 +4,12 @@
|
|||||||
|
|
||||||
local fallback_logo = require('data.dash').fallback_logo
|
local fallback_logo = require('data.dash').fallback_logo
|
||||||
|
|
||||||
|
local function get_window_size()
|
||||||
|
local width = vim.api.nvim_win_get_width(0)
|
||||||
|
local height = vim.api.nvim_win_get_height(0)
|
||||||
|
return width, height
|
||||||
|
end
|
||||||
|
|
||||||
local function read_file(file_path)
|
local function read_file(file_path)
|
||||||
local success, content_or_error = pcall(function()
|
local success, content_or_error = pcall(function()
|
||||||
local file = assert(io.open(file_path, 'r')) -- Open the file in read mode
|
local file = assert(io.open(file_path, 'r')) -- Open the file in read mode
|
||||||
@@ -67,8 +73,10 @@ local function create_sections(neovide)
|
|||||||
indent = 60,
|
indent = 60,
|
||||||
})
|
})
|
||||||
|
|
||||||
if not neovide then
|
if vim.g.show_github_contrib and not neovide then
|
||||||
|
local w, h = get_window_size()
|
||||||
local usrname = vim.g.gitname or 'rootiest'
|
local usrname = vim.g.gitname or 'rootiest'
|
||||||
|
if w > 130 and h > 30 then
|
||||||
table.insert(sections, {
|
table.insert(sections, {
|
||||||
section = 'terminal',
|
section = 'terminal',
|
||||||
cmd = 'kusa ' .. usrname .. ' && sleep 0.2',
|
cmd = 'kusa ' .. usrname .. ' && sleep 0.2',
|
||||||
@@ -78,6 +86,7 @@ local function create_sections(neovide)
|
|||||||
indent = 8,
|
indent = 8,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
return sections
|
return sections
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user