Did a lot of stuff

This commit is contained in:
Rene Kievits
2021-10-14 01:47:52 +02:00
parent 0d2a0bb8a8
commit 7843046d5b
20 changed files with 155 additions and 275 deletions

View File

@@ -3,96 +3,76 @@ local awful = require("awful")
local gears = require("gears")
local naughty = require("naughty")
local dpi = require("beautiful").xresources.apply_dpi
local watch = awful.widget.watch
local color = require("theme.crylia.colors")
local icondir = awful.util.getdir("config") .. "theme/crylia/assets/icons/date/"
local styles = {}
local calendar_osd = function ()
local calendar_osd_time = wibox.widget{
{
widget = wibox.widget.textbox,
text = os.date("%H-%M-%S"),
id = "clock",
font = "digital-7 italic",
forced_height = dpi(50)
},
layout = wibox.layout.align.horizontal
}
--[[ local create_calendar = function (widget, date)
local d = {year = date.year, month = (date.month or 1), day = (date.day or 1)}
local weekday = tonumber(os.date("%w", os.time(d)))
local default_bg = (weekday == 0 or weekday == 6) and color.color["Grey900"]
local container = wibox.widget {
{
widget,
margins = dpi(2),
widget = wibox.container.margin
},
shape = function (cr, height, width)
gears.shape.rounded_rect(cr, height, widget)
end,
shape_border_width = dpi(1),
shape_border_color = color.color["Grey800"],
fg = color.color["White"],
bg = color.color["Grey900"],
widget = wibox.container.background
}
end ]]
local calendar = wibox.widget{
font = "digital-7 italic",
date = os.date("*t"),
spacing = dpi(15),
--fn_embed = create_calendar,
widget = wibox.widget.calendar.month()
}
local current_month = calendar:get_date().month
local update_active_month = function (i)
local date = calendar:get_date()
date.month = date.month + i,
calendar:set_date(nil),
calendar:set_date(date)
styles.month = {
padding = 15,
bg_color = color.color["Grey900"],
border_width = 1,
shape = function (cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
end
calendar:buttons(
gears.table.join(
awful.button(
{ },
4,
function ()
update_active_month(-1)
end
),
awful.button(
{ },
5,
function ()
update_active_month(1)
end
)
)
)
local calendar_widget = wibox.widget{
}
styles.normal = {
shape = function (cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
end
}
styles.focus = {
fg_color = color.color["Grey900"],
bg_color = color.color["TealA200"],
shape = function (cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
end
}
styles.header = {
fg_color = color.color["Teal200"],
markup = function(t) return '<b>' .. t .. '</b>' end,
shape = function (cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
end
}
styles.weekday = {
padding = 8,
fg_color = color.color["Teal200"],
markup = function(t) return '<b>' .. t .. '</b>' end,
shape = function (cr, width, height)
gears.shape.rounded_rect(cr, width, height, 5)
end
}
local function decorate_cell(widget, flag, date)
if flag=='monthheader' and not styles.monthheader then
flag = 'header'
end
local props = styles[flag] or {}
if props.markup and widget.get_text and widget.set_markup then
widget:set_markup(props.markup(widget:get_text()))
end
-- Change bg color for weekends
local d = {year=date.year, month=(date.month or 1), day=(date.day or 1)}
local weekday = tonumber(os.date('%w', os.time(d)))
local default_bg = (weekday==0 or weekday==6) and color.color["Grey900"] or color.color["Grey800"]
local ret = wibox.widget {
{
calendar_osd_time,
calendar,
layout = wibox.layout.fixed.vertical
widget,
margins = 10,
widget = wibox.container.margin
},
bg = color.color["White"] .. "00",
shape = function (cr, height, width)
gears.shape.rounded_rect(cr, dpi(500), dpi(300))
end,
shape = props.shape,
shape_border_color = color.color["Grey800"],
shape_border_width = 1,
fg = props.fg_color or '#999999',
bg = props.bg_color or default_bg,
widget = wibox.container.background
}
return calendar_widget
return ret
end
local cal = wibox.widget {
date = os.date('*t'),
fn_embed = decorate_cell,
widget = wibox.widget.calendar.month
}
return calendar_osd
return cal