From 2270b956bc0f9b4c93bdb70c57f6c92476445d33 Mon Sep 17 00:00:00 2001 From: Lukas <74739057+Luka5W@users.noreply.github.com> Date: Thu, 23 Nov 2023 16:31:08 +0000 Subject: [PATCH 1/2] Revert "calendar-widget: added option to show week numbers, possible fix for #316" --- calendar-widget/README.md | 13 ++++++------- calendar-widget/calendar.lua | 6 ++---- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/calendar-widget/README.md b/calendar-widget/README.md index b896baaa..b663a189 100644 --- a/calendar-widget/README.md +++ b/calendar-widget/README.md @@ -7,13 +7,12 @@ 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 | -| week_numbers | false | Show ISO week numbers (Mon = first) | +| 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 | - themes: diff --git a/calendar-widget/calendar.lua b/calendar-widget/calendar.lua index 91ca033a..bc4a877f 100644 --- a/calendar-widget/calendar.lua +++ b/calendar-widget/calendar.lua @@ -98,7 +98,6 @@ 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) @@ -157,7 +156,7 @@ local function worker(user_args) -- 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 = (flag == 'focus' or flag == 'normal') and (weekday == 0 or weekday == 6) + local default_bg = (weekday == 0 or weekday == 6) and calendar_themes[theme].weekend_day_bg or calendar_themes[theme].bg local ret = wibox.widget { @@ -174,7 +173,7 @@ local function worker(user_args) shape_border_color = props.border_color or '#000000', shape_border_width = props.border_width or 0, fg = props.fg_color or calendar_themes[theme].fg, - bg = default_bg, + bg = props.bg_color or default_bg, widget = wibox.container.background } @@ -187,7 +186,6 @@ 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 } From 2c58ef6fd1a19c49e39b87b915003bf78dbd429e Mon Sep 17 00:00:00 2001 From: Luka5W <74739057+Luka5W@users.noreply.github.com> Date: Thu, 23 Nov 2023 17:48:38 +0000 Subject: [PATCH 2/2] complete redesign of #417, working now (tm) --- calendar-widget/README.md | 13 +++++++------ calendar-widget/calendar.lua | 23 ++++++++++++++--------- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/calendar-widget/README.md b/calendar-widget/README.md index b663a189..b896baaa 100644 --- a/calendar-widget/README.md +++ b/calendar-widget/README.md @@ -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: diff --git a/calendar-widget/calendar.lua b/calendar-widget/calendar.lua index bc4a877f..a9fe02d3 100644 --- a/calendar-widget/calendar.lua +++ b/calendar-widget/calendar.lua @@ -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 }