diff --git a/inkycal/modules/inkycal_calendar.py b/inkycal/modules/inkycal_calendar.py index 56b288c..6e3ad5d 100644 --- a/inkycal/modules/inkycal_calendar.py +++ b/inkycal/modules/inkycal_calendar.py @@ -80,7 +80,15 @@ class Calendar(inkycal_module): im_width, calendar_height)) # Create grid and calculate icon sizes - calendar_rows, calendar_cols = 6, 7 + now = arrow.now(tz = self.timezone) + monthstart = now.span('month')[0].weekday() + monthdays = now.ceil('month').day + + if monthstart > 4 and monthdays == 31: + calendar_rows, calendar_cols = 7, 7 + else: + calendar_rows, calendar_cols = 6, 7 + icon_width = im_width // calendar_cols icon_height = calendar_height // calendar_rows @@ -98,8 +106,6 @@ class Calendar(inkycal_module): weekday_pos = [(grid_start_x + icon_width*_, month_name_height) for _ in range(calendar_cols)] - now = arrow.now(tz = self.timezone) - # Set weekstart of calendar to specified weekstart if self.weekstart == "Monday": cal.setfirstweekday(cal.MONDAY)