A brief history of curtains: They probably started life as temporary walls, covering the hole in a hovel through which humans came and went. There were no windows.
As humans settled down, hovels grew more sophisticated, and sprung more leaks in their walls. At night and other alarming times, these holes were blocked with whatever was around–in Eurpoean hovels, usually wooden shutters mounted indoors.
As humans exploited one another more efficiently, some accumulated wealth. This they spent on heavy, woven tapestry to hang on the doorways and walls of their extra-large and drafty stone hovels.
Beds, too, figure prominently in the history of curtains. In a cold, drafty hovel, a human body amounts to a radiator perking along at 98.6 degrees. Curtain that radiator off in a box, and you could be quite cozy. Hence the curtained bed.
Windows of glass got invented a few hundred years ago, and while they were “permanent” compared to a flap of leather or a wooden shutter, they also let heat out and prying eyes in. Tapestries and velvet and other insulating textiles were deployed to insulate these light-holes.
Privacy was a secondary concern, in the evolution of the curtain. Insulation was primary.
And today, this warm, summer day, you can employ your own window coverings as insulation. Covering your light-holes during the day prevents a whole swarm of therms from penetrating your house. And that will let you sleep better at night.