complete redesign of #417, working now (tm)

This commit is contained in:
Luka5W 2023-11-23 17:48:38 +00:00
parent c2714b5eaf
commit 2c58ef6fd1
2 changed files with 21 additions and 15 deletions

View File

@ -7,12 +7,13 @@ Calendar widget for Awesome WM - slightly improved version of the `wibox.widget.
### Customization
| Name | Default | Description |
|---|---|---|
| theme | `naughty` | The theme to use |
| placement | `top` | The position of the popup |
| radius | 8 | The popup radius |
| start_sunday | false | Start the week on Sunday |
| Name | Default | Description |
|--------------|-----------|-------------------------------------|
| theme | `naughty` | The theme to use |
| placement | `top` | The position of the popup |
| radius | 8 | The popup radius |
| start_sunday | false | Start the week on Sunday |
| week_numbers | false | Show ISO week numbers (Mon = first) |
- themes:

View File

@ -70,10 +70,10 @@ local function worker(user_args)
border = '#75715E'
},
naughty = {
bg = beautiful.notification_bg or beautiful.bg,
fg = beautiful.notification_fg or beautiful.fg,
focus_date_bg = beautiful.notification_fg or beautiful.fg,
focus_date_fg = beautiful.notification_bg or beautiful.bg,
bg = beautiful.notification_bg or beautiful.bg or beautiful.bg_normal,
fg = beautiful.notification_fg or beautiful.fg or beautiful.fg_normal,
focus_date_bg = beautiful.notification_fg or beautiful.fg or beautiful.fg_normal,
focus_date_fg = beautiful.notification_bg or beautiful.bg or beautiful.bg_normal,
weekend_day_bg = beautiful.bg_focus,
weekday_fg = beautiful.fg,
header_fg = beautiful.fg,
@ -98,6 +98,7 @@ local function worker(user_args)
local next_month_button = args.next_month_button or 4
local previous_month_button = args.previous_month_button or 5
local start_sunday = args.start_sunday or false
local week_numbers = args.week_numbers or false
local styles = {}
local function rounded_shape(size)
@ -154,11 +155,14 @@ local function worker(user_args)
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 calendar_themes[theme].weekend_day_bg
or calendar_themes[theme].bg
local default_bg
if (flag == "normal") then
local d = { year = date.year, month = (date.month or 1), day = (date.day or 1) }
local weekday = tonumber(os.date('%w', os.time(d)))
default_bg = (weekday == 0 or weekday == 6)
and calendar_themes[theme].weekend_day_bg
or calendar_themes[theme].bg
end
local ret = wibox.widget {
{
{
@ -186,6 +190,7 @@ local function worker(user_args)
fn_embed = decorate_cell,
long_weekdays = true,
start_sunday = start_sunday,
week_numbers = week_numbers,
widget = wibox.widget.calendar.month
}