Layer the cucumbers, onions and salt in a bowl, cover with a plate and weight down, then leave to soak for 4 hours.
Meanwhile, pour the vinegar into a saucepan, add the sugar and the remaining ingredients and heat gently, stirring from time to time, until the sugar has dissolved, then leave to cool.
Tip the cucumber and onions into a colander and drain off the liquid. Rinse with plenty of cold water and drain well.
Reheat the vinegar mixture until just boiling, add the drained cucumber and onion, cook for 1 minute, then lift out of the vinegar with a draining spoon and pack into warm, dry jars. Boil the remaining vinegar mixture for 4–5 minutes until syrupy, then leave to cool.
Pour the cold vinegar mixture over the cucumber slices to completely cover and to fill the jars to the top (adding a little extra vinegar if needed). Screw on lids, label and leave to mature in a cool, dark place for 3–4 weeks.