From 98b5e08f7af96c5594471e35b5c091ec4f8163b4 Mon Sep 17 00:00:00 2001 From: Andreas Tsouchlos Date: Thu, 4 Apr 2024 15:41:39 +0200 Subject: [PATCH] Fix random title image selection --- .config/nvim/lua/plugins/alpha.lua | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/.config/nvim/lua/plugins/alpha.lua b/.config/nvim/lua/plugins/alpha.lua index 9664d8b..400e970 100644 --- a/.config/nvim/lua/plugins/alpha.lua +++ b/.config/nvim/lua/plugins/alpha.lua @@ -32,8 +32,17 @@ local function get_random_image() } } - -- local i = math.random(#images) - local i = clamp(math.random(1, 40), 1, #images) + local i = 3 + + math.randomseed(os.time()) + if math.fmod(math.random(100), 5) == 0 then + if math.random(0, 1) == 0 then + i = 1 + else + i = 2 + end + end + return images[i] end @@ -44,7 +53,7 @@ end return { { "goolord/alpha-nvim", - lazy=false, + lazy = false, config = function() local dashboard = require("alpha.themes.dashboard") dashboard.section.header.val = get_random_image()