From 05da0e10926d4ade3b10a55999a0ed1b797caf65 Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Wed, 14 May 2025 22:50:39 +0530 Subject: added luastatus config --- .config/luastatus-scripts-dwm/time-date.lua | 58 +++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 .config/luastatus-scripts-dwm/time-date.lua (limited to '.config/luastatus-scripts-dwm/time-date.lua') diff --git a/.config/luastatus-scripts-dwm/time-date.lua b/.config/luastatus-scripts-dwm/time-date.lua new file mode 100644 index 0000000..8fce7a1 --- /dev/null +++ b/.config/luastatus-scripts-dwm/time-date.lua @@ -0,0 +1,58 @@ +months = {'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'} +wday = {'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'} +widget = { + plugin = 'timer', + cb = function() + local d = os.date('*t') + + if d.hour < 12 then + suffix = "a.m." + else + suffix = "p.m." + d.hour = d.hour - 12 + end + + local date_suffix = "th" + if not (d.day % 100 >= 11 and d.day % 100 <= 13) then + local last_digit = d.day % 10 + if last_digit == 1 then + date_suffix = "st" + elseif last_digit == 2 then + date_suffix = "nd" + elseif last_digit == 3 then + date_suffix = "rd" + end + end + + local time_icon = "" + if d.hour == 0 or d.hour == 12 then + time_icon = "󱑖" + elseif d.hour == 1 then + time_icon = "󱑋" + elseif d.hour == 2 then + time_icon = "󱑌" + elseif d.hour == 3 then + time_icon = "󱑍" + elseif d.hour == 4 then + time_icon = "󱑎" + elseif d.hour == 5 then + time_icon = "󱑏" + elseif d.hour == 6 then + time_icon = "󱑐" + elseif d.hour == 7 then + time_icon = "󱑑" + elseif d.hour == 8 then + time_icon = "󱑒" + elseif d.hour == 9 then + time_icon = "󱑓" + elseif d.hour == 10 then + time_icon = "󱑔" + elseif d.hour == 11 then + time_icon = "󱑕" + end + + return { + string.format('󰃭 %d%s %s %d (%s) %s %d:%02d %s ', d.day, date_suffix, months[d.month], d.year, wday[d.wday], time_icon, d.hour, d.min, suffix), + } + end, +} -- cgit v1.2.3