yes, I'm very commit lazy

This commit is contained in:
2023-03-19 19:22:02 +01:00
parent 4f3fb75687
commit f399235db0
107 changed files with 11120 additions and 10906 deletions

View File

@@ -3,83 +3,81 @@
-----------------------------
-- Awesome Libs
local awful = require("awful")
local dpi = require("beautiful").xresources.apply_dpi
local gears = require("gears")
local wibox = require("wibox")
local apopup = require('awful.popup')
local dpi = require('beautiful').xresources.apply_dpi
local wibox = require('wibox')
local abutton = require('awful.button')
local gfilesystem = require('gears.filesystem')
local gtable = require('gears.table')
local gcolor = require('gears.color')
-- Local libs
local cal = require('src.modules.calendar.init') {}
local hover = require('src.tools.hover')
-- Icon directory path
local icondir = gears.filesystem.get_configuration_dir() .. "src/assets/icons/date/"
local icondir = gfilesystem.get_configuration_dir() .. 'src/assets/icons/date/'
local capi = { mouse = mouse }
-- Returns the date widget
return function(s)
local cal = require("src.modules.calendar.init") { screen = s }
return setmetatable({}, { __call = function(_, screen)
local date_widget = wibox.widget {
{
{
{
{
{
id = "icon",
image = gears.color.recolor_image(icondir .. "calendar.svg", Theme_config.date.fg),
widget = wibox.widget.imagebox,
valign = "center",
halign = "center",
resize = false
},
id = "icon_layout",
widget = wibox.container.place
image = gcolor.recolor_image(icondir .. 'calendar.svg', Theme_config.date.fg),
widget = wibox.widget.imagebox,
valign = 'center',
halign = 'center',
resize = true,
},
id = "icon_margin",
top = dpi(2),
widget = wibox.container.margin
widget = wibox.container.constraint,
width = dpi(25),
height = dpi(25),
strategy = 'exact',
},
{
halign = 'center',
valign = 'center',
format = '%a, %b %d',
widget = wibox.widget.textclock,
},
spacing = dpi(10),
{
id = "label",
align = "center",
valign = "center",
format = "%a, %b %d",
widget = wibox.widget.textclock
},
id = "date_layout",
layout = wibox.layout.fixed.horizontal
layout = wibox.layout.fixed.horizontal,
},
id = "container",
left = dpi(8),
right = dpi(8),
widget = wibox.container.margin
widget = wibox.container.margin,
},
bg = Theme_config.date.bg,
fg = Theme_config.date.fg,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, dpi(6))
end,
widget = wibox.container.background
shape = Theme_config.date.shape,
widget = wibox.container.background,
}
local calendar_popup = awful.popup {
local calendar_popup = apopup {
widget = cal:get_widget(),
screen = s,
screen = screen,
ontop = true,
bg = "#00000000",
visible = false,
}
-- Signals
Hover_signal(date_widget)
hover.bg_hover { widget = date_widget }
date_widget:buttons {
gears.table.join(
awful.button({}, 1, function()
local geo = mouse.current_wibox:geometry()
calendar_popup.x = geo.x
calendar_popup.y = geo.y + dpi(55)
calendar_popup.visible = not calendar_popup.visible
end)
)
}
date_widget:buttons { gtable.join(
abutton({}, 1, function()
local geo = capi.mouse.coords()
calendar_popup.y = dpi(65)
if geo.x + (calendar_popup.width / 2) > capi.mouse.screen.geometry.width then
calendar_popup.x = capi.mouse.screen.geometry.x + capi.mouse.screen.geometry.width - calendar_popup.width
else
calendar_popup.x = geo.x - (calendar_popup.width / 2)
end
calendar_popup.visible = not calendar_popup.visible
end)
), }
return date_widget
end
end, })