Hayes stood on the street and screamed for her to come out and see him.
The woman walked down the driveway to meet him.
He pulled a gas-powered pistol from his hoodie pocket and fired it at the victim three times.
One pellet struck her in the leg and was embedded under her skin, the court heard.
She yelled for help and collapsed to the ground.
The next day, Hayes threatened to shoot the woman between her eyes.
As a result of the attack, the victim spent days undergoing surgery to have the pellet removed.
The man said he did not believe the slug gun was loaded and he did not mean to shoot her.
At the defendant’s house, three crossbows, gas and pellets for the pistol and cannabis were located.
Judge Duncan Harvey said it was “nasty offending” and he noted it was not the first time the defendant had been violent towards the woman.
“You could have killed her,” he said.
The court heard the incident had arisen out of jealousy.
The judge sentenced Hayes to nine months’ home detention and ordered the destruction of the crossbows, cannabis and pistol.
He also made a firearm prohibition order, which prevents high-risk people from accessing, being around or using firearms for 10 years.
Under legislation passed last year, breaching the order would be a criminal offence with a penalty of up to two years’ imprisonment.