Let's give each daybox an alias: today.
The first daybox of the calendar and/or the recent first day of the month gets the alias day1. (That way, we're not dependent on \pgfcalendarsuggestedname.)
At the end of the calendar (equals=\pgfcalendarendiso) and/or at the end of a month (end of month=1) a line is drawn between day1 and today. (And with the next day, the name day1 gets overwritten by a new daybox for the next line to be drawn.)
This line is setup in such a way that it draws a line from somewhere around day1.north west to today.north east while adding an every month node to it. In addition, the key month line \pgfcalendarcurrentmonth is tried. You can define them manually: month line 01/.style={green} or via the month colors key which takes a list of colors and assigns them to the appropriate month line XX keys.
In the code below, the day number and the weekday name is implemented as a label to just a rectangular node without any text. This allows placing these labels in the corners and using the inner seps to adjust the padding to the box. No need to mess around with text height and depth now.
With the node contents key even the text of the labels can be made easily customizable by PGFKeys.
Unfortunately, the translator interface between PGFCalendar and the selected language is broken in beamer, we'll be using your custom redefinitions of \pgfcalendarmonthname and \pgfcalendarweekdayname. Unless you want calendars in different language, this should be the easiest approach.
Since you want to use polyglossia, I've added it here with the option french but there's no interaction with the PGFCalendar module anymore, anyway. But it's a good idea to include this anyway since we might find incompatibilities with it. The babel TikZ library is not necessary here.
Code
% !TeX TS-program = lualatex
\documentclass[french]{beamer}
\usepackage{polyglossia}
\mode<presentation> {\usetheme{metropolis}}
\newlength{\slw}\setlength{\slw}{160mm}
\newlength{\slh}\setlength{\slh}{90mm}
\geometry{verbose,papersize={\slw,\slh},hmargin=5mm}
\usepackage{fontsize, fix-cm, verbatim}
\usepackage{tikz}
\usetikzlibrary{calendar}
\definecolor{oct}{RGB}{128,128,0}
\definecolor{nov}{RGB}{255,0,255}
\tikzset{
my calendar/.style={
day list right,
% Every day ist just a day box.
% Its size should be in relation to day xshift or vice versa
day code={\node[every daybox]{};},
every daybox/.style={
minimum width=18mm,
minimum height=.25ex+15mm+.6666em,
draw, very thick, rounded corners=3mm,
name=\pgfcalendarsuggestedname,
alias=today,
label={[every day]\tikzdaytext},
label={[every weekday]north west:%wt},
},% the day and the weekday are labels in relation to that daybox
every day/.style={
label position=south east, anchor=south east, node font=\Large,
inner sep=+.5em},
every weekday/.style={
label position=north west, anchor=north west, node font=\bfseries,
inner ysep=+.5em, inner xsep=+.3em},
every month/.style={at end, above left, inner xsep=+0pt},
month xshift=2mm, month yshift=0mm,
day xshift=18mm+2mm, day yshift=15mm+2mm,
month line/.style={
draw, line cap=round, line width=1ex,
month line \pgfcalendarcurrentmonth/.try,
to path={([shift={(1ex,1.5ex)}]\tikztostart.north west)
-- ([shift={(-1ex,1.5ex)}]\tikztotarget.north east) \tikztonodes},
every to/.append style={edge node={node[every month]{%mt}}},
},
execute at begin day scope={%
% if it's the first day of the calendar or the first day of the month:
% remember that daybox as day1
\ifdate{equals=\pgfcalendarbeginiso}{% first day of calendar?
\tikzset{every daybox/.append style={alias=day1}}%
}{%
\ifdate{day of month=1}{% first day of month?
\tikzset{every daybox/.append style={alias=day1}}%
}{}%
}%
},
execute after day scope={%
% if it's the last day of a month or the last day of the calendar:
% draw a line to day1
\ifdate{end of month=1}{% last day of month?
\draw[month line] (day1) to (today);
}{%
\ifdate{equals=\pgfcalendarendiso}{% or even last day of calendar?
\draw[month line] (day1) to (today);
}{}%
}%
}
},
use shortest/.style={day text=\number%d0\relax},
%%%
month colors/.style={
/utils/exec=\def\pgfmathcounter{0},
@month colors/.list={#1}},
@month colors/.code={%
\edef\pgfmathcounter{\ifnum\pgfinteval{\pgfmathcounter+1}<10 0\fi\pgfinteval{\pgfmathcounter+1}}%
\tikzset{month line \pgfmathcounter/.append style={color=#1}}},
}
\renewcommand\pgfcalendarmonthname[1]{%
\ifcase#1\or janvier\or février\or mars\or avril\or mai\or juin\or
juillet\or août\or septembre\or octobre\or novembre\or décembre\fi}
\renewcommand\pgfcalendarweekdayname[1]{%
\ifcase#1 lundi\or mardi\or mercredi\or
jeudi\or vendredi\or samedi\or dimanche\fi}
\begin{document}
\begin{frame}{calendrier de la semaine}
\begin{tikzpicture}[month colors={,,,,,,,,,oct,nov,}]
\calendar (moncal) [my calendar, use shortest, dates=2023-10-31 to 2023-10-31+6];
\end{tikzpicture}
\end{frame}
\end{document}
Output

beamerwe apparently need\translate. – Qrrbrbirlbel Oct 24 '23 at 14:38babelas it was recommended to usepolyglossiafor devanagari script. Can you change? when you say that the daybox gets the aliasday1, actually you meant that You give that alias to it, similarly totoday. I mention it because it led me to some confusion. – user1850133 Oct 25 '23 at 16:21polyglossiaand dropped the translation aspect, it's not working properly withbeameranyway. Yes, I give each daybox node an aliastodayso I can use that name to always reference the last daybox. And the absolute first daybox and then every first of the month is given the aliasday1. – Qrrbrbirlbel Oct 25 '23 at 16:39.tryis because you have not defined colours for all months, is it? if we define all twelve colours withjanfév...décand use a\newcommand*\monthcolour[1]{\ifcase#1\or jan\or fév\or ... déc\fi}can you simplify the code? – user1850133 Oct 26 '23 at 11:46month line \pgfcalendarcurrentmonth/.trywith \monthcolour{\pgfcalendarcurrentmonth}` and it works. – user1850133 Oct 26 '23 at 11:59