Harry Studley, now aged two, was shot at a block of flats in Bristol last July. He underwent emergency surgery and now suffers several seizures a day.
Jordan Walters, who pulled the trigger, has previously admitted causing grievous bodily harm.
His partner Emma Horseman is accused of the same charge on the basis she aided or abetted an offence.
The Bristol Crown Court jury heard that Harry lived with his parents and brother in a top-floor flat in Bishport Avenue, Hartcliffe, while Ms Horseman, 24, lived on the second floor with Walters and their two children.
The court was told they were all friends, with children of similar ages who spent time together.
Andrew Macfarlane, prosecuting, said: "The circumstances of this case are both simple and horrifying.
"Parents in a block of flats in Bristol meet up on a Friday afternoon with their children and within the hour a baby is fighting for its life and is airlifted to hospital."
Harry's mother, Amy Allen, told the court she saw Walters cleaning the weapon.
"I was sat on the sofa dealing with both of the children because they were crying," she said.
"Emma basically turned around and said 'How do you cope with them crying all the time?'
"I heard Emma speak to Jordan. She said 'Jordan, shoot it and scare him'."
She continued: "He aimed the gun at Harry. I looked round and said 'No' and I heard the gun".
According to Ms Allen, Walters and Ms Horseman said they thought the gun was not loaded.
Doctors at Bristol Children's Hospital found Harry suffered a displaced skull fracture and swelling and bleeding on the brain.
The air pellet was never found and it remains lodged in his brain, the jury heard.
The trial continues.
A crying toddler was shot in the head with an air rifle to "frighten him" and "shut him up", a court has heard.