calendar: allow to change first day of week

Closes #293
This commit is contained in:
Aurélien LAJOIE 2021-10-20 14:27:00 +02:00
parent 3d611c0531
commit 42ddeeb509
No known key found for this signature in database
GPG Key ID: B843917229D6F3CE
2 changed files with 15 additions and 7 deletions

View File

@ -12,6 +12,7 @@ Calendar widget for Awesome WM - slightly improved version of the `wibox.widget.
| theme | `naughty` | The theme to use | | theme | `naughty` | The theme to use |
| placement | `top` | The position of the popup | | placement | `top` | The position of the popup |
| radius | 8 | The popup radius | | radius | 8 | The popup radius |
| start_sunday | false | Start the week on Sunday |
- themes: - themes:
@ -37,6 +38,10 @@ Calendar widget for Awesome WM - slightly improved version of the `wibox.widget.
![calendar_bottom_right](./calendar_bottom_right.png) ![calendar_bottom_right](./calendar_bottom_right.png)
- setup first day of week
By setting `start_sunday` to true:
![calendar_start_sunday](./calendar_start_sunday.png)
- mouse support: - mouse support:
move to the next and previous month. Using mouse buttons or scroll wheel. move to the next and previous month. Using mouse buttons or scroll wheel.
@ -44,13 +49,13 @@ Calendar widget for Awesome WM - slightly improved version of the `wibox.widget.
You can configure this by specifying the button to move to next/previous. You can configure this by specifying the button to move to next/previous.
Usually these are configured as follows. If you want to use other mouse buttons, you can find their number using `xev`. Usually these are configured as follows. If you want to use other mouse buttons, you can find their number using `xev`.
| number | button | | number | button |
|--------|--------| |--------|---------------|
| 4 | scroll up | | 4 | scroll up |
| 5 | scroll down | | 5 | scroll down |
| 1 | left click | | 1 | left click |
| 2 | right click | | 2 | right click |
| 3 | middles click | | 3 | middles click |
By default `previous_month_button` is 5, `next_month_button` is 4. By default `previous_month_button` is 5, `next_month_button` is 4.
@ -71,6 +76,7 @@ local cw = calendar_widget()
local cw = calendar_widget({ local cw = calendar_widget({
theme = 'outrun', theme = 'outrun',
placement = 'bottom_right', placement = 'bottom_right',
start_sunday = true,
radius = 8, radius = 8,
-- with customized next/previous (see table above) -- with customized next/previous (see table above)
previous_month_button = 1, previous_month_button = 1,

View File

@ -97,6 +97,7 @@ local function worker(user_args)
local radius = args.radius or 8 local radius = args.radius or 8
local next_month_button = args.next_month_button or 4 local next_month_button = args.next_month_button or 4
local previous_month_button = args.previous_month_button or 5 local previous_month_button = args.previous_month_button or 5
local start_sunday = args.start_sunday or false
local styles = {} local styles = {}
local function rounded_shape(size) local function rounded_shape(size)
@ -184,6 +185,7 @@ local function worker(user_args)
font = beautiful.get_font(), font = beautiful.get_font(),
fn_embed = decorate_cell, fn_embed = decorate_cell,
long_weekdays = true, long_weekdays = true,
start_sunday = start_sunday,
widget = wibox.widget.calendar.month widget = wibox.widget.calendar.month
} }